summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2013-02-06 00:01:14 +0000
committerAnna Zaks <ganna@apple.com>2013-02-06 00:01:14 +0000
commit258f9357ef613372d5b5f96d0a9f7f98173dbc3e (patch)
treef7869e8d95e3b4ba5627e9edb3a74bdea94cd99d /clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
parentae89a0fbc24aa7cdc1c35aa1b55d3685f7067f4a (diff)
downloadbcm5719-llvm-258f9357ef613372d5b5f96d0a9f7f98173dbc3e.tar.gz
bcm5719-llvm-258f9357ef613372d5b5f96d0a9f7f98173dbc3e.zip
[analyzer]Revert part of r161511; suppresses leak false positives in C++
This is a "quick fix". The underlining issue is that when a const pointer to a struct is passed into a function, we do not invalidate the pointer fields. This results in false positives that are common in C++ (since copy constructors are prevalent). (Silences two llvm false positives.) llvm-svn: 174468
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/ExprEngine.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Core/ExprEngine.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
index 26a3f9b1f53..636aa3bd0d9 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -1627,6 +1627,12 @@ ProgramStateRef ExprEngine::processPointerEscapedOnBind(ProgramStateRef State,
if (StoredVal != Val)
escapes = (State == (State->bindLoc(*regionLoc, Val)));
}
+ if (!escapes) {
+ // Case 4: We do not currently model what happens when a symbol is
+ // assigned to a struct field, so be conservative here and let the symbol
+ // go. TODO: This could definitely be improved upon.
+ escapes = !isa<VarRegion>(regionLoc->getRegion());
+ }
}
// If our store can represent the binding and we aren't storing to something
OpenPOWER on IntegriCloud