diff options
author | Anders Carlsson <andersca@mac.com> | 2011-03-26 14:30:44 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2011-03-26 14:30:44 +0000 |
commit | 642b03413f9dc377c8fcffe868521bf61fffeea6 (patch) | |
tree | 23a6e2deffcf5bf57d860a97e205c6f407b6c770 /clang/lib | |
parent | 8aef596decfce37bc15ab45a4e00105b62f188d1 (diff) | |
download | bcm5719-llvm-642b03413f9dc377c8fcffe868521bf61fffeea6.tar.gz bcm5719-llvm-642b03413f9dc377c8fcffe868521bf61fffeea6.zip |
Don't add a symbolic region for 'this' if the member function is static.
llvm-svn: 128340
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/BasicStore.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/BasicStore.cpp b/clang/lib/StaticAnalyzer/Core/BasicStore.cpp index 98365e7f4e6..4faa84ca266 100644 --- a/clang/lib/StaticAnalyzer/Core/BasicStore.cpp +++ b/clang/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; |