aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Core/BasicStore.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2011-03-26 14:30:44 +0000
committerAnders Carlsson <andersca@mac.com>2011-03-26 14:30:44 +0000
commit65b427f96821b7ba0646a40979059573faf25040 (patch)
tree6ce84548fca45d5056707294f36c4c7ff3dbc1b2 /lib/StaticAnalyzer/Core/BasicStore.cpp
parentda57f3eeab7b7f7f6e6788956f0a0d9adf196a7d (diff)
Don't add a symbolic region for 'this' if the member function is static.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128340 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/BasicStore.cpp')
-rw-r--r--lib/StaticAnalyzer/Core/BasicStore.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/StaticAnalyzer/Core/BasicStore.cpp b/lib/StaticAnalyzer/Core/BasicStore.cpp
index 98365e7f4e..4faa84ca26 100644
--- a/lib/StaticAnalyzer/Core/BasicStore.cpp
+++ b/lib/StaticAnalyzer/Core/BasicStore.cpp
@@ -429,12 +429,15 @@ StoreRef BasicStoreManager::getInitialStore(const LocationContext *InitLoc) {
}
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 = svalBuilder.getRegionManager();
- const CXXThisRegion *ThisR = RegMgr.getCXXThisRegion(ThisT, InitLoc);
- SVal ThisV = svalBuilder.getRegionValueSymbolVal(ThisR);
- St = Bind(St.getStore(), svalBuilder.makeLoc(ThisR), ThisV);
+ // For C++ non-static member variables, add a symbolic region for 'this' in
+ // the initial stack frame.
+ if (MD->isInstance()) {
+ QualType ThisT = MD->getThisType(StateMgr.getContext());
+ MemRegionManager &RegMgr = svalBuilder.getRegionManager();
+ const CXXThisRegion *ThisR = RegMgr.getCXXThisRegion(ThisT, InitLoc);
+ SVal ThisV = svalBuilder.getRegionValueSymbolVal(ThisR);
+ St = Bind(St.getStore(), svalBuilder.makeLoc(ThisR), ThisV);
+ }
}
return St;