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/GRExprEngine.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/GRExprEngine.cpp')
-rw-r--r-- | lib/Analysis/GRExprEngine.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp index 43d7331dd9..d00bfe640a 100644 --- a/lib/Analysis/GRExprEngine.cpp +++ b/lib/Analysis/GRExprEngine.cpp @@ -976,7 +976,7 @@ void GRExprEngine::VisitDeclRefExpr(DeclRefExpr* Ex, NodeTy* Pred, NodeSet& Dst, } else if (const FunctionDecl* FD = dyn_cast<FunctionDecl>(D)) { assert(asLValue); - SVal V = loc::FuncVal(FD); + SVal V = ValMgr.getFunctionPointer(FD); MakeNode(Dst, Ex, Pred, BindExpr(state, Ex, V)); return; } @@ -1369,11 +1369,10 @@ static bool EvalOSAtomic(ExplodedNodeSet<GRState>& Dst, GRStmtNodeBuilder<GRState>& Builder, CallExpr* CE, SVal L, ExplodedNode<GRState>* Pred) { - - if (!isa<loc::FuncVal>(L)) + const FunctionDecl* FD = L.getAsFunctionDecl(); + if (!FD) return false; - - const FunctionDecl *FD = cast<loc::FuncVal>(L).getDecl(); + const char *FName = FD->getNameAsCString(); // Check for compare and swap. @@ -1473,11 +1472,8 @@ void GRExprEngine::VisitCallRec(CallExpr* CE, NodeTy* Pred, // Check for the "noreturn" attribute. SaveAndRestore<bool> OldSink(Builder->BuildSinks); - - if (isa<loc::FuncVal>(L)) { - - FunctionDecl* FD = cast<loc::FuncVal>(L).getDecl(); - + const FunctionDecl* FD = L.getAsFunctionDecl(); + if (FD) { if (FD->getAttr<NoReturnAttr>() || FD->getAttr<AnalyzerNoReturnAttr>()) Builder->BuildSinks = true; else { @@ -1559,10 +1555,9 @@ void GRExprEngine::VisitCallRec(CallExpr* CE, NodeTy* Pred, // Evaluate the call. - if (isa<loc::FuncVal>(L)) { + if (FD) { - if (unsigned id - = cast<loc::FuncVal>(L).getDecl()->getBuiltinID(getContext())) + if (unsigned id = FD->getBuiltinID(getContext())) switch (id) { case Builtin::BI__builtin_expect: { // For __builtin_expect, just return the value of the subexpression. |