summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2012-03-27 01:12:45 +0000
committerTed Kremenek <kremenek@apple.com>2012-03-27 01:12:45 +0000
commite9a5bcf17efdd874879dfe5bb1789ff6b03a5be2 (patch)
tree8c5bb004ead60a0bbd5c2bcdabfb056c5c1ae39c /clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
parentefd009de1c1ff206d32aa2b9db96bfc6a25d5256 (diff)
downloadbcm5719-llvm-e9a5bcf17efdd874879dfe5bb1789ff6b03a5be2.tar.gz
bcm5719-llvm-e9a5bcf17efdd874879dfe5bb1789ff6b03a5be2.zip
Change RetainCountChecker to eagerly "escape" retained objects when they are
assigned to a struct. This is fallout from inlining results, which expose far more patterns where people stuff CF objects into structs and pass them around (and we can reason about it). The problem is that we don't have a general way to detect when values have escaped, so as an intermediate step we need to eagerly prune out such tracking. Fixes <rdar://problem/11104566>. llvm-svn: 153489
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
index 92557961728..a6d33ad2a0f 100644
--- a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
@@ -3341,6 +3341,12 @@ void RetainCountChecker::checkBind(SVal loc, SVal val, const Stmt *S,
// the binding).
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