diff options
Diffstat (limited to 'lib/StaticAnalyzer/Core/LoopWidening.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/LoopWidening.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/StaticAnalyzer/Core/LoopWidening.cpp b/lib/StaticAnalyzer/Core/LoopWidening.cpp index 9192f49eac6d2..8f6cb9a6b09ef 100644 --- a/lib/StaticAnalyzer/Core/LoopWidening.cpp +++ b/lib/StaticAnalyzer/Core/LoopWidening.cpp @@ -81,11 +81,12 @@ ProgramStateRef getWidenedLoopState(ProgramStateRef PrevState, // 'this' pointer is not an lvalue, we should not invalidate it. If the loop // is located in a method, constructor or destructor, the value of 'this' - // pointer shoule remain unchanged. - if (const CXXMethodDecl *CXXMD = dyn_cast<CXXMethodDecl>(STC->getDecl())) { - const CXXThisRegion *ThisR = MRMgr.getCXXThisRegion( - CXXMD->getThisType(STC->getAnalysisDeclContext()->getASTContext()), - STC); + // pointer should remain unchanged. Ignore static methods, since they do not + // have 'this' pointers. + const CXXMethodDecl *CXXMD = dyn_cast<CXXMethodDecl>(STC->getDecl()); + if (CXXMD && !CXXMD->isStatic()) { + const CXXThisRegion *ThisR = + MRMgr.getCXXThisRegion(CXXMD->getThisType(), STC); ITraits.setTrait(ThisR, RegionAndSymbolInvalidationTraits::TK_PreserveContents); } |