aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Core/CFRefCount.cpp
diff options
context:
space:
mode:
authorJordy Rose <jediknil@belkadan.com>2011-08-23 21:06:32 +0000
committerJordy Rose <jediknil@belkadan.com>2011-08-23 21:06:32 +0000
commitd02b4af7bd6ca4a743c7074d64e205d718aa221d (patch)
tree22daddda249395196f34f7d8fbb97dea897d960a /lib/StaticAnalyzer/Core/CFRefCount.cpp
parentd7cb46c316808169679a8d72c69f02a1e55d78a8 (diff)
[analyzer] Cleanup: Move temporary declarations of CFRefCount variables closer to their uses. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138382 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/CFRefCount.cpp')
-rw-r--r--lib/StaticAnalyzer/Core/CFRefCount.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/lib/StaticAnalyzer/Core/CFRefCount.cpp b/lib/StaticAnalyzer/Core/CFRefCount.cpp
index ddae5d73a8..2d1b822b3e 100644
--- a/lib/StaticAnalyzer/Core/CFRefCount.cpp
+++ b/lib/StaticAnalyzer/Core/CFRefCount.cpp
@@ -2963,9 +2963,6 @@ void RetainReleaseChecker::checkSummary(const RetainSummary &Summ,
const CallOrObjCMessage &CallOrMsg,
InstanceReceiver Receiver,
CheckerContext &C) const {
- // FIXME: This goes away when the RetainSummaryManager moves to the checker.
- CFRefCount &TF = static_cast<CFRefCount&>(C.getEngine().getTF());
-
const ProgramState *state = C.getState();
// Evaluate the effect of the arguments.
@@ -3013,10 +3010,13 @@ void RetainReleaseChecker::checkSummary(const RetainSummary &Summ,
RetEffect RE = Summ.getRetEffect();
if (RE.getKind() == RetEffect::OwnedWhenTrackedReceiver) {
- if (ReceiverIsTracked)
- RE = TF.Summaries.getObjAllocRetEffect();
- else
+ if (ReceiverIsTracked) {
+ // FIXME: This goes away if the RetainSummaryManager moves to the checker.
+ CFRefCount &TF = static_cast<CFRefCount&>(C.getEngine().getTF());
+ RE = TF.Summaries.getObjAllocRetEffect();
+ } else {
RE = RetEffect::MakeNoRet();
+ }
}
switch (RE.getKind()) {
@@ -3399,17 +3399,12 @@ void RetainReleaseChecker::checkPreStmt(const ReturnStmt *S,
if (!Pred)
return;
- ExprEngine &Eng = C.getEngine();
- // FIXME: This goes away once HandleAutoreleaseCount() and the
- // RetainSummariesManager move to RetainReleaseChecker.
- CFRefCount &TF = static_cast<CFRefCount&>(Eng.getTF());
-
// Update the autorelease counts.
static SimpleProgramPointTag
AutoreleaseTag("RetainReleaseChecker : Autorelease");
GenericNodeBuilderRefCount Bd(C.getNodeBuilder(), S, &AutoreleaseTag);
- llvm::tie(Pred, state) = handleAutoreleaseCounts(state, Bd, Pred, Eng,
- Sym, X);
+ llvm::tie(Pred, state) = handleAutoreleaseCounts(state, Bd, Pred,
+ C.getEngine(), Sym, X);
// Did we cache out?
if (!Pred)
@@ -3423,6 +3418,9 @@ void RetainReleaseChecker::checkPreStmt(const ReturnStmt *S,
// Consult the summary of the enclosing method.
const Decl *CD = &Pred->getCodeDecl();
+ // FIXME: This goes away once the RetainSummariesManager moves to the checker.
+ CFRefCount &TF = static_cast<CFRefCount&>(C.getEngine().getTF());
+
if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(CD)) {
// Unlike regular functions, /all/ ObjC methods are assumed to always
// follow Cocoa retain-count conventions, not just those with special