summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2013-01-26 01:28:23 +0000
committerJordan Rose <jordan_rose@apple.com>2013-01-26 01:28:23 +0000
commitaea020f04ec86ba9165ad701ad58cc467a0906fe (patch)
tree8cb1df5caa1e0927e7c8db1552a4105eab6b8f4b /clang/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp
parentc362edad85bfa1f143cc94ab58e16a0543b6c06a (diff)
downloadbcm5719-llvm-aea020f04ec86ba9165ad701ad58cc467a0906fe.tar.gz
bcm5719-llvm-aea020f04ec86ba9165ad701ad58cc467a0906fe.zip
[analyzer] Track null object lvalues back through C++ method calls.
The expression 'a->b.c()' contains a call to the 'c' method of 'a->b'. We emit an error if 'a' is NULL, but previously didn't actually track the null value back through the 'a->b' expression, which caused us to miss important false-positive-suppression cases, including <rdar://problem/12676053>. llvm-svn: 173547
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp
index 1285d321f09..e32091e2286 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp
@@ -76,6 +76,8 @@ void CallAndMessageChecker::emitBadCall(BugType *BT, CheckerContext &C,
BugReport *R = new BugReport(*BT, BT->getName(), N);
if (BadE) {
R->addRange(BadE->getSourceRange());
+ if (BadE->isGLValue())
+ BadE = bugreporter::getDerefExpr(BadE);
bugreporter::trackNullOrUndefValue(N, BadE, *R);
}
C.emitReport(R);
OpenPOWER on IntegriCloud