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 1502fd4..50950ce 100644
--- a/Analysis/GRConstants.cpp
+++ b/Analysis/GRConstants.cpp
@@ -40,7 +40,7 @@
//===----------------------------------------------------------------------===//
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<void*>(Raw & ~Flags); }
@@ -218,7 +218,11 @@
}
ExprVariantTy GRConstants::GetBinding(Expr* E) {
- DSPtr P(E, getCFG().isBlkExpr(E));
+ DSPtr P(NULL);
+
+ if (DeclRefExpr* D = dyn_cast<DeclRefExpr>(E)) P = DSPtr(D->getDecl());
+ else P = DSPtr(E, getCFG().isBlkExpr(E));
+
StateTy::iterator I = CurrentState.find(P);
if (I == CurrentState.end())