diff options
author | Ted Kremenek <kremenek@apple.com> | 2012-06-22 23:55:50 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2012-06-22 23:55:50 +0000 |
commit | 10f77ad7fc5e5cf3f37a9b14ff5843468b8b84d2 (patch) | |
tree | 70d4950719bc055639f30d99828c8aee603888c1 /lib/StaticAnalyzer/Core/RegionStore.cpp | |
parent | c1fb54265614845ee1e09856af6e46961c6209f4 (diff) |
Implement initial static analysis inlining support for C++ methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159047 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/RegionStore.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/RegionStore.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/StaticAnalyzer/Core/RegionStore.cpp b/lib/StaticAnalyzer/Core/RegionStore.cpp index 7f6aa9f935..1698316d61 100644 --- a/lib/StaticAnalyzer/Core/RegionStore.cpp +++ b/lib/StaticAnalyzer/Core/RegionStore.cpp @@ -2097,8 +2097,19 @@ StoreRef RegionStoreManager::enterStackFrame(ProgramStateRef state, svalBuilder.makeLoc(MRMgr.getVarRegion(*PI, calleeCtx)), ArgVal); } - } else if (const CXXConstructExpr *CE = - dyn_cast<CXXConstructExpr>(calleeCtx->getCallSite())) { + + // For C++ method calls, also include the 'this' pointer. + if (const CXXMemberCallExpr *CME = dyn_cast<CXXMemberCallExpr>(CE)) { + loc::MemRegionVal This = + svalBuilder.getCXXThis(cast<CXXMethodDecl>(CME->getCalleeDecl()), + calleeCtx); + SVal CalledObj = state->getSVal(CME->getImplicitObjectArgument(), + callerCtx); + store = Bind(store.getStore(), This, CalledObj); + } + } + else if (const CXXConstructExpr *CE = + dyn_cast<CXXConstructExpr>(calleeCtx->getCallSite())) { CXXConstructExpr::const_arg_iterator AI = CE->arg_begin(), AE = CE->arg_end(); @@ -2109,8 +2120,10 @@ StoreRef RegionStoreManager::enterStackFrame(ProgramStateRef state, svalBuilder.makeLoc(MRMgr.getVarRegion(*PI, calleeCtx)), ArgVal); } - } else + } + else { assert(isa<CXXDestructorDecl>(calleeCtx->getDecl())); + } return store; } |