From: Ted Kremenek Date: Wed, 16 Jan 2008 19:47:19 +0000 (+0000) Subject: Added support from retrieving stored values to variables. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0525a4fcd0e9c00a07c32d8120dfc1b1d5911881;p=clang Added support from retrieving stored values to variables. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46087 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Analysis/GRConstants.cpp b/Analysis/GRConstants.cpp index 1502fd4fb8..50950ce68b 100644 --- a/Analysis/GRConstants.cpp +++ b/Analysis/GRConstants.cpp @@ -40,7 +40,7 @@ using llvm::cast; //===----------------------------------------------------------------------===// namespace { class VISIBILITY_HIDDEN DSPtr { - const uintptr_t Raw; + uintptr_t Raw; public: enum VariantKind { IsDecl=0x1, IsBlkLvl=0x2, IsSubExp=0x3, Flags=0x3 }; inline void* getPtr() const { return reinterpret_cast(Raw & ~Flags); } @@ -218,7 +218,11 @@ void GRConstants::ProcessStmt(Stmt* S, NodeBuilder& builder) { } ExprVariantTy GRConstants::GetBinding(Expr* E) { - DSPtr P(E, getCFG().isBlkExpr(E)); + DSPtr P(NULL); + + if (DeclRefExpr* D = dyn_cast(E)) P = DSPtr(D->getDecl()); + else P = DSPtr(E, getCFG().isBlkExpr(E)); + StateTy::iterator I = CurrentState.find(P); if (I == CurrentState.end())