summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/CFRefCount.cpp
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2009-04-20 05:24:46 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2009-04-20 05:24:46 +0000
commitac1294318d36e91e0cbbde5c5c451c79fbba1d3b (patch)
tree0ef12744f43e4ccb8a1e30c13df5906fd994e6f1 /clang/lib/Analysis/CFRefCount.cpp
parent6840825137dbe955af9b612da9d42cb80051c95d (diff)
downloadbcm5719-llvm-ac1294318d36e91e0cbbde5c5c451c79fbba1d3b.tar.gz
bcm5719-llvm-ac1294318d36e91e0cbbde5c5c451c79fbba1d3b.zip
get a CodeTextRegion when visiting FunctionDecl reference.
get FunctionDecl with more general utility method. llvm-svn: 69570
Diffstat (limited to 'clang/lib/Analysis/CFRefCount.cpp')
-rw-r--r--clang/lib/Analysis/CFRefCount.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/clang/lib/Analysis/CFRefCount.cpp b/clang/lib/Analysis/CFRefCount.cpp
index 7443c521b3b..0e8d67ca292 100644
--- a/clang/lib/Analysis/CFRefCount.cpp
+++ b/clang/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.
OpenPOWER on IntegriCloud