summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-02-12 01:01:31 +0000
committerTed Kremenek <kremenek@apple.com>2011-02-12 01:01:31 +0000
commit10b5926e292c4afb0101972322be857f4bb11875 (patch)
tree6b62e777a6ab7ff6a326f66d16970622e6847883 /clang/lib
parent1173fbdc4b9516f34e6ee54750721b3dc70532d3 (diff)
downloadbcm5719-llvm-10b5926e292c4afb0101972322be857f4bb11875.tar.gz
bcm5719-llvm-10b5926e292c4afb0101972322be857f4bb11875.zip
static analyzer: Also invalidate instance variables of a receiver in a message expression, just as we do with parameters.
Fixes <rdar://problem/8725041>. llvm-svn: 125422
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/StaticAnalyzer/Core/CFRefCount.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/CFRefCount.cpp b/clang/lib/StaticAnalyzer/Core/CFRefCount.cpp
index 09e69239d64..92bd4116a74 100644
--- a/clang/lib/StaticAnalyzer/Core/CFRefCount.cpp
+++ b/clang/lib/StaticAnalyzer/Core/CFRefCount.cpp
@@ -2514,6 +2514,18 @@ void CFRefCount::evalSummary(ExplodedNodeSet& Dst,
// done an invalidation pass.
llvm::DenseSet<SymbolRef> WhitelistedSymbols;
+ // Invalidate all instance variables of the receiver of a message.
+ // FIXME: We should be able to do better with inter-procedural analysis.
+ if (Receiver) {
+ SVal V = Receiver.getSValAsScalarOrLoc(state);
+ if (SymbolRef Sym = V.getAsLocSymbol()) {
+ if (state->get<RefBindings>(Sym))
+ WhitelistedSymbols.insert(Sym);
+ }
+ if (const MemRegion *region = V.getAsRegion())
+ RegionsToInvalidate.push_back(region);
+ }
+
for (unsigned idx = 0, e = callOrMsg.getNumArgs(); idx != e; ++idx) {
SVal V = callOrMsg.getArgSValAsScalarOrLoc(idx);
SymbolRef Sym = V.getAsLocSymbol();
OpenPOWER on IntegriCloud