[PATCH] D17043: Check that the result of a library call w/o side effects is used
Sidney San MartÃn via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 9 14:23:05 PST 2016
sidney created this revision.
sidney added reviewers: mclow.lists, alexfh.
sidney added a subscriber: cfe-commits.
Currently has a whitelist of methods like std::vector::empty() which,
in a standalone statement, likely won't do what the programmer wants.
The whitelist is brittle (Did I misspell a method? Does a container
other than std::vector have a base class like std::__vector_base?) and
unlikely to be maintained, so two directions for improvement could be:
1. Use the compiler to determine whether a method has side effects.
2. Annotate methods without side effects. A newly-added method is more
likely to end up with the annotation than in this check's whitelist.
...but this might be a good start.
Project from https://trello.com/c/4sbyrOSv/15-clang-checker-check-that-the-result-of-library-calls-w-o-side-effects-are-used
http://reviews.llvm.org/D17043
Files:
clang-tidy/misc/CMakeLists.txt
clang-tidy/misc/MiscTidyModule.cpp
clang-tidy/misc/NoSideEffectsCheck.cpp
clang-tidy/misc/NoSideEffectsCheck.h
docs/clang-tidy/checks/list.rst
docs/clang-tidy/checks/misc-no-side-effects.rst
test/clang-tidy/misc-no-side-effects.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17043.47367.patch
Type: text/x-patch
Size: 7908 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160209/463bb0d1/attachment.bin>
More information about the cfe-commits
mailing list