From: Marcin Swiderski Date: Wed, 17 Nov 2010 06:22:54 +0000 (+0000) Subject: Added mapping from 'this' to it's SymbolicRegion in BasicStoreManager::getInitialStore. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0aac2ba128eb0c4b7ad5e0e28a6fa55091bfad2e;p=clang 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 d3860235ec..3a5d20ca00 100644 --- a/lib/Checker/BasicStore.cpp +++ b/lib/Checker/BasicStore.cpp @@ -419,6 +419,15 @@ Store BasicStoreManager::getInitialStore(const LocationContext *InitLoc) { } } + if (const CXXMethodDecl *MD = dyn_cast(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; }