summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2019-08-28 18:44:38 +0000
committerArtem Dergachev <artem.dergachev@gmail.com>2019-08-28 18:44:38 +0000
commit630f7daf80fe36d3aa4a9ebe60e7abefae514bba (patch)
tree476edc9fbf1518b032ec8188114f17e501780205 /clang/lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
parent0909a392f318872a1eacbdc9a6044cb437095a11 (diff)
downloadbcm5719-llvm-630f7daf80fe36d3aa4a9ebe60e7abefae514bba.tar.gz
bcm5719-llvm-630f7daf80fe36d3aa4a9ebe60e7abefae514bba.zip
[analyzer] Fix analyzer warnings on analyzer.
Write tests for the actual crash that was found. Write comments and refactor code around 17 style bugs and suppress 3 false positives. Differential Revision: https://reviews.llvm.org/D66847 llvm-svn: 370246
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/IteratorChecker.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/IteratorChecker.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/IteratorChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
index 3c1a79dd318..5fe7ba55786 100644
--- a/clang/lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
@@ -567,7 +567,8 @@ void IteratorChecker::checkPostCall(const CallEvent &Call,
if (Func->isOverloadedOperator()) {
const auto Op = Func->getOverloadedOperator();
if (isAssignmentOperator(Op)) {
- const auto *InstCall = dyn_cast<CXXInstanceCall>(&Call);
+ // Overloaded 'operator=' must be a non-static member function.
+ const auto *InstCall = cast<CXXInstanceCall>(&Call);
if (cast<CXXMethodDecl>(Func)->isMoveAssignmentOperator()) {
handleAssign(C, InstCall->getCXXThisVal(), Call.getOriginExpr(),
Call.getArgSVal(0));
OpenPOWER on IntegriCloud