diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-05-21 21:56:53 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-05-21 21:56:53 +0000 |
commit | 8f326751df18e78bdb7edf786a842def8a4f41e3 (patch) | |
tree | ede1d051725d1d82406b1427309e759e953fa792 /lib/Checker/CFRefCount.cpp | |
parent | db9b12e32c988e4a6ac49404fd2513d0b05bba32 (diff) |
Pass around an error SourceRange instead of an Expr* when reporting errors
in the Objective-C memory checker.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104388 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Checker/CFRefCount.cpp')
-rw-r--r-- | lib/Checker/CFRefCount.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/Checker/CFRefCount.cpp b/lib/Checker/CFRefCount.cpp index 475670a123..feca0d5819 100644 --- a/lib/Checker/CFRefCount.cpp +++ b/lib/Checker/CFRefCount.cpp @@ -1374,7 +1374,7 @@ RetainSummaryManager::getInstanceMethodSummary(const ObjCMessageExpr *ME, // we just use the 'ID' from the message expression. SVal receiverV; - if (const Expr *Receiver = ME->getInstanceReceiver()) { + if (Receiver) { receiverV = state->getSValAsScalarOrLoc(Receiver); // FIXME: Eventually replace the use of state->get<RefBindings> with @@ -1724,7 +1724,7 @@ private: void ProcessNonLeakError(ExplodedNodeSet& Dst, GRStmtNodeBuilder& Builder, - Expr* NodeExpr, Expr* ErrorExpr, + Expr* NodeExpr, SourceRange ErrorRange, ExplodedNode* Pred, const GRState* St, RefVal::Kind hasErr, SymbolRef Sym); @@ -2572,7 +2572,7 @@ void CFRefCount::EvalSummary(ExplodedNodeSet& Dst, // Evaluate the effect of the arguments. RefVal::Kind hasErr = (RefVal::Kind) 0; unsigned idx = 0; - Expr* ErrorExpr = NULL; + SourceRange ErrorRange; SymbolRef ErrorSym = 0; llvm::SmallVector<const MemRegion*, 10> RegionsToInvalidate; @@ -2585,7 +2585,7 @@ void CFRefCount::EvalSummary(ExplodedNodeSet& Dst, if (RefBindings::data_type* T = state->get<RefBindings>(Sym)) { state = Update(state, Sym, *T, Summ.getArg(idx), hasErr); if (hasErr) { - ErrorExpr = *I; + ErrorRange = (*I)->getSourceRange(); ErrorSym = Sym; break; } @@ -2678,13 +2678,13 @@ void CFRefCount::EvalSummary(ExplodedNodeSet& Dst, } // Evaluate the effect on the message receiver. - if (!ErrorExpr && Receiver) { + if (!ErrorRange.isValid() && Receiver) { SymbolRef Sym = state->getSValAsScalarOrLoc(Receiver).getAsLocSymbol(); if (Sym) { if (const RefVal* T = state->get<RefBindings>(Sym)) { state = Update(state, Sym, *T, Summ.getReceiverEffect(), hasErr); if (hasErr) { - ErrorExpr = Receiver; + ErrorRange = Receiver->getSourceRange(); ErrorSym = Sym; } } @@ -2693,7 +2693,7 @@ void CFRefCount::EvalSummary(ExplodedNodeSet& Dst, // Process any errors. if (hasErr) { - ProcessNonLeakError(Dst, Builder, Ex, ErrorExpr, Pred, state, + ProcessNonLeakError(Dst, Builder, Ex, ErrorRange, Pred, state, hasErr, ErrorSym); return; } @@ -2760,7 +2760,7 @@ void CFRefCount::EvalSummary(ExplodedNodeSet& Dst, } case RetEffect::ReceiverAlias: { - assert (Receiver); + assert(Receiver); SVal V = state->getSValAsScalarOrLoc(Receiver); state = state->BindExpr(Ex, V, false); break; @@ -3409,7 +3409,7 @@ void CFRefCount::EvalDeadSymbols(ExplodedNodeSet& Dst, void CFRefCount::ProcessNonLeakError(ExplodedNodeSet& Dst, GRStmtNodeBuilder& Builder, - Expr* NodeExpr, Expr* ErrorExpr, + Expr* NodeExpr, SourceRange ErrorRange, ExplodedNode* Pred, const GRState* St, RefVal::Kind hasErr, SymbolRef Sym) { @@ -3440,7 +3440,7 @@ void CFRefCount::ProcessNonLeakError(ExplodedNodeSet& Dst, } CFRefReport *report = new CFRefReport(*BT, *this, N, Sym); - report->addRange(ErrorExpr->getSourceRange()); + report->addRange(ErrorRange); BR->EmitReport(report); } |