diff options
author | Ted Kremenek <kremenek@apple.com> | 2012-03-27 01:12:45 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2012-03-27 01:12:45 +0000 |
commit | e9a5bcf17efdd874879dfe5bb1789ff6b03a5be2 (patch) | |
tree | 8c5bb004ead60a0bbd5c2bcdabfb056c5c1ae39c /clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp | |
parent | efd009de1c1ff206d32aa2b9db96bfc6a25d5256 (diff) | |
download | bcm5719-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.cpp | 6 |
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 |