diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-04-20 05:24:46 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-04-20 05:24:46 +0000 |
commit | 369f447eded97e6048ced02c0c2be3842f61fc1c (patch) | |
tree | 54b9a91bb2c1d4438eaea591715cad10e09a1357 /lib/Analysis/CFRefCount.cpp | |
parent | 5c3074f3cd4c33e30c55e851a3ecf21ebec0769e (diff) |
get a CodeTextRegion when visiting FunctionDecl reference.
get FunctionDecl with more general utility method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69570 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CFRefCount.cpp')
-rw-r--r-- | lib/Analysis/CFRefCount.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp index 7443c521b3..0e8d67ca29 100644 --- a/lib/Analysis/CFRefCount.cpp +++ b/lib/Analysis/CFRefCount.cpp @@ -1694,7 +1694,7 @@ void CFRefCount::EvalSummary(ExplodedNodeSet<GRState>& Dst, Expr* Ex, Expr* Receiver, RetainSummary* Summ, - ExprIterator arg_beg, ExprIterator arg_end, + ExprIterator arg_beg, ExprIterator arg_end, ExplodedNode<GRState>* Pred) { // Get the state. @@ -1930,9 +1930,9 @@ void CFRefCount::EvalCall(ExplodedNodeSet<GRState>& Dst, GRStmtNodeBuilder<GRState>& Builder, CallExpr* CE, SVal L, ExplodedNode<GRState>* Pred) { - - RetainSummary* Summ = !isa<loc::FuncVal>(L) ? 0 - : Summaries.getSummary(cast<loc::FuncVal>(L).getDecl()); + const FunctionDecl* FD = L.getAsFunctionDecl(); + RetainSummary* Summ = !FD ? 0 + : Summaries.getSummary(const_cast<FunctionDecl*>(FD)); EvalSummary(Dst, Eng, Builder, CE, 0, Summ, CE->arg_begin(), CE->arg_end(), Pred); @@ -2582,9 +2582,9 @@ PathDiagnosticPiece* CFRefReport::VisitNode(const ExplodedNode<GRState>* N, if (CallExpr *CE = dyn_cast<CallExpr>(S)) { // Get the name of the callee (if it is available). - SVal X = CurrSt.GetSValAsScalarOrLoc(CE->getCallee()); - if (loc::FuncVal* FV = dyn_cast<loc::FuncVal>(&X)) - os << "Call to function '" << FV->getDecl()->getNameAsString() <<'\''; + SVal X = CurrSt.GetSValAsScalarOrLoc(CE->getCallee()); + if (const FunctionDecl* FD = X.getAsFunctionDecl()) + os << "Call to function '" << FD->getNameAsString() <<'\''; else os << "function call"; } @@ -2675,9 +2675,9 @@ PathDiagnosticPiece* CFRefReport::VisitNode(const ExplodedNode<GRState>* N, if (contains(AEffects, MakeCollectable)) { // Get the name of the function. Stmt* S = cast<PostStmt>(N->getLocation()).getStmt(); - loc::FuncVal FV = - cast<loc::FuncVal>(CurrSt.GetSValAsScalarOrLoc(cast<CallExpr>(S)->getCallee())); - const std::string& FName = FV.getDecl()->getNameAsString(); + SVal X = CurrSt.GetSValAsScalarOrLoc(cast<CallExpr>(S)->getCallee()); + const FunctionDecl* FD = X.getAsFunctionDecl(); + const std::string& FName = FD->getNameAsString(); if (TF.isGCEnabled()) { // Determine if the object's reference count was pushed to zero. |