summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core/CFRefCount.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-04-11 22:22:05 +0000
committerTed Kremenek <kremenek@apple.com>2011-04-11 22:22:05 +0000
commit8ef59e5c03c937056cd0282fe9747be2978a973e (patch)
treeb9f9cf1866a36f33f7a9bb0a42d935582b4c4d2a /clang/lib/StaticAnalyzer/Core/CFRefCount.cpp
parent0f85789800846dc3beeab75bd7e8d3af0f26a362 (diff)
downloadbcm5719-llvm-8ef59e5c03c937056cd0282fe9747be2978a973e.tar.gz
bcm5719-llvm-8ef59e5c03c937056cd0282fe9747be2978a973e.zip
C++ static analysis: also invalidate fields of objects that are the callees in C++ method calls.
llvm-svn: 129308
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/CFRefCount.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Core/CFRefCount.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/CFRefCount.cpp b/clang/lib/StaticAnalyzer/Core/CFRefCount.cpp
index 5131c739257..df82c582049 100644
--- a/clang/lib/StaticAnalyzer/Core/CFRefCount.cpp
+++ b/clang/lib/StaticAnalyzer/Core/CFRefCount.cpp
@@ -2529,6 +2529,14 @@ void CFRefCount::evalSummary(ExplodedNodeSet& Dst,
RegionsToInvalidate.push_back(region);
}
+ // Invalidate all instance variables for the callee of a C++ method call.
+ // FIXME: We should be able to do better with inter-procedural analysis.
+ // FIXME: we can probably do better for const versus non-const methods.
+ if (callOrMsg.isCXXCall()) {
+ if (const MemRegion *callee = callOrMsg.getCXXCallee().getAsRegion())
+ RegionsToInvalidate.push_back(callee);
+ }
+
for (unsigned idx = 0, e = callOrMsg.getNumArgs(); idx != e; ++idx) {
SVal V = callOrMsg.getArgSValAsScalarOrLoc(idx);
SymbolRef Sym = V.getAsLocSymbol();
OpenPOWER on IntegriCloud