Added mapping from 'this' to it's SymbolicRegion in BasicStoreManager::getInitialStore.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119467 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Checker/BasicStore.cpp b/lib/Checker/BasicStore.cpp
index d386023..3a5d20c 100644
--- a/lib/Checker/BasicStore.cpp
+++ b/lib/Checker/BasicStore.cpp
@@ -419,6 +419,15 @@
}
}
+ if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(InitLoc->getDecl())) {
+ // For C++ methods add symbolic region for 'this' in initial stack frame.
+ QualType ThisT = MD->getThisType(StateMgr.getContext());
+ MemRegionManager &RegMgr = ValMgr.getRegionManager();
+ const CXXThisRegion *ThisR = RegMgr.getCXXThisRegion(ThisT, InitLoc);
+ SVal ThisV = ValMgr.getRegionValueSymbolVal(ThisR);
+ St = Bind(St, ValMgr.makeLoc(ThisR), ThisV);
+ }
+
return St;
}