Added mapping from 'this' to it's SymbolicRegion in BasicStoreManager::getInitialStore.
llvm-svn: 119467
diff --git a/clang/lib/Checker/BasicStore.cpp b/clang/lib/Checker/BasicStore.cpp
index d386023..3a5d20c 100644
--- a/clang/lib/Checker/BasicStore.cpp
+++ b/clang/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;
}