summaryrefslogtreecommitdiff
path: root/clang-tools-extra/docs/clang-tidy
diff options
context:
space:
mode:
authorJonathan Coe <jbcoe@me.com>2018-04-24 21:25:16 +0000
committerJonathan Coe <jbcoe@me.com>2018-04-24 21:25:16 +0000
commit6d3c234e5bcf7c950bda57913b54e495cd35409e (patch)
treee9a2a0f211473796f79994854c67cbf14c223b1c /clang-tools-extra/docs/clang-tidy
parentfc7d250e5ee04d01d313d208327b2319526f0140 (diff)
[clang-tidy] Improve bugprone-unused-return-value check
Summary: Add support for checking class template member functions. Also add the following functions to be checked by default: - std::unique_ptr::release - std::basic_string::empty - std::vector::empty Reviewers: alexfh, hokein, aaron.ballman, ilya-biryukov Reviewed By: aaron.ballman Subscribers: jbcoe, xazax.hun, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D45891 Patch by khuttun (Kalle Huttunen)
Diffstat (limited to 'clang-tools-extra/docs/clang-tidy')
-rw-r--r--clang-tools-extra/docs/clang-tidy/checks/bugprone-unused-return-value.rst9
1 files changed, 8 insertions, 1 deletions
diff --git a/clang-tools-extra/docs/clang-tidy/checks/bugprone-unused-return-value.rst b/clang-tools-extra/docs/clang-tidy/checks/bugprone-unused-return-value.rst
index 83b243f02f6..68d8e739f93 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/bugprone-unused-return-value.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/bugprone-unused-return-value.rst
@@ -11,7 +11,7 @@ Options
.. option:: CheckedFunctions
Semicolon-separated list of functions to check. Defaults to
- ``::std::async;::std::launder;::std::remove;::std::remove_if;::std::unique``.
+ ``::std::async;::std::launder;::std::remove;::std::remove_if;::std::unique;::std::unique_ptr::release;::std::basic_string::empty;::std::vector::empty``.
This means that the calls to following functions are checked by default:
- ``std::async()``. Not using the return value makes the call synchronous.
@@ -22,3 +22,10 @@ Options
iterator indicates the boundary between elements to keep and elements to be
removed. Not using the return value means that the information about which
elements to remove is lost.
+ - ``std::unique_ptr::release()``. Not using the return value can lead to
+ resource leaks if the same pointer isn't stored anywhere else. Often,
+ ignoring the ``release()`` return value indicates that the programmer
+ confused the function with ``reset()``.
+ - ``std::basic_string::empty()`` and ``std::vector::empty()``. Not using the
+ return value often indicates that the programmer confused the function with
+ ``clear()``.