diff options
author | Artem Dergachev <artem.dergachev@gmail.com> | 2018-12-04 03:38:08 +0000 |
---|---|---|
committer | Artem Dergachev <artem.dergachev@gmail.com> | 2018-12-04 03:38:08 +0000 |
commit | f3f03662961820510b1deb9daaa61aec280c586e (patch) | |
tree | 9f7088c8c86b1e51344a479afa7553db4976aff9 /clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp | |
parent | 821b38f52696e26350f61a66ee43ac60a9b00198 (diff) | |
download | bcm5719-llvm-f3f03662961820510b1deb9daaa61aec280c586e.tar.gz bcm5719-llvm-f3f03662961820510b1deb9daaa61aec280c586e.zip |
[analyzer] MoveChecker: Add more common state resetting methods.
Includes "resize" and "shrink" because they can reset the object to a known
state in certain circumstances.
Differential Revision: https://reviews.llvm.org/D54563
llvm-svn: 348235
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp index d9ea0d967cd..c93ba9d3b4e 100644 --- a/clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp @@ -343,8 +343,11 @@ bool MoveChecker::isStateResetMethod(const CXXMethodDecl *MethodDec) const { return true; if (MethodDec->getDeclName().isIdentifier()) { std::string MethodName = MethodDec->getName().lower(); + // TODO: Some of these methods (eg., resize) are not always resetting + // the state, so we should consider looking at the arguments. if (MethodName == "reset" || MethodName == "clear" || - MethodName == "destroy") + MethodName == "destroy" || MethodName == "resize" || + MethodName == "shrink") return true; } return false; |