diff options
author | Jordan Rose <jordan_rose@apple.com> | 2013-08-01 22:16:36 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2013-08-01 22:16:36 +0000 |
commit | 7699e4a50b14faf8a0dd821d0bda87eaa67b45eb (patch) | |
tree | fbb1cb674838f14c181c1c0a2717f89e6bf036da /clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp | |
parent | 5fbe7f97664dc2024252c03729198eb4b958a03c (diff) | |
download | bcm5719-llvm-7699e4a50b14faf8a0dd821d0bda87eaa67b45eb.tar.gz bcm5719-llvm-7699e4a50b14faf8a0dd821d0bda87eaa67b45eb.zip |
[analyzer] Don't process autorelease counts in synthesized function bodies.
We process autorelease counts when we exit functions, but if there's an
issue in a synthesized body the report will get dropped. Just skip the
processing for now and let it get handled when the caller gets around to
processing autoreleases.
(This is still suboptimal: objects autoreleased in the caller context
should never be warned about when exiting a callee context, synthesized
or not.)
Second half of <rdar://problem/14611722>
llvm-svn: 187625
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp index 0f456ea8d78..c681c810867 100644 --- a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp @@ -3635,6 +3635,13 @@ void RetainCountChecker::checkEndFunction(CheckerContext &Ctx) const { RefBindingsTy B = state->get<RefBindings>(); ExplodedNode *Pred = Ctx.getPredecessor(); + // Don't process anything within synthesized bodies. + const LocationContext *LCtx = Pred->getLocationContext(); + if (LCtx->getAnalysisDeclContext()->isBodyAutosynthesized()) { + assert(LCtx->getParent()); + return; + } + for (RefBindingsTy::iterator I = B.begin(), E = B.end(); I != E; ++I) { state = handleAutoreleaseCounts(state, Pred, /*Tag=*/0, Ctx, I->first, I->second); @@ -3646,7 +3653,7 @@ void RetainCountChecker::checkEndFunction(CheckerContext &Ctx) const { // We will do that later. // FIXME: we should instead check for imbalances of the retain/releases, // and suggest annotations. - if (Ctx.getLocationContext()->getParent()) + if (LCtx->getParent()) return; B = state->get<RefBindings>(); |