aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Core/ProgramState.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2012-12-20 00:38:25 +0000
committerAnna Zaks <ganna@apple.com>2012-12-20 00:38:25 +0000
commitbf53dfac8195835028bd6347433f7dbebcc29fc1 (patch)
tree52e15cb639417b3c9a1df69fb37c4221ee680ba3 /lib/StaticAnalyzer/Core/ProgramState.cpp
parentb29740ae158f9421096a28bcc7ad6af7171b1874 (diff)
[analyzer] Add the pointer escaped callback.
Instead of using several callbacks to identify the pointer escape event, checkers now can register for the checkPointerEscape. Converted the Malloc checker to use the new callback. SimpleStreamChecker will be converted next. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170625 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/ProgramState.cpp')
-rw-r--r--lib/StaticAnalyzer/Core/ProgramState.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/StaticAnalyzer/Core/ProgramState.cpp b/lib/StaticAnalyzer/Core/ProgramState.cpp
index 3b96cc899f..15662776d9 100644
--- a/lib/StaticAnalyzer/Core/ProgramState.cpp
+++ b/lib/StaticAnalyzer/Core/ProgramState.cpp
@@ -144,31 +144,41 @@ ProgramStateRef
ProgramState::invalidateRegions(ArrayRef<const MemRegion *> Regions,
const Expr *E, unsigned Count,
const LocationContext *LCtx,
- StoreManager::InvalidatedSymbols *IS,
+ bool ResultsInPointerEscape,
+ InvalidatedSymbols *IS,
const CallEvent *Call) const {
if (!IS) {
- StoreManager::InvalidatedSymbols invalidated;
+ InvalidatedSymbols invalidated;
return invalidateRegionsImpl(Regions, E, Count, LCtx,
+ ResultsInPointerEscape,
invalidated, Call);
}
- return invalidateRegionsImpl(Regions, E, Count, LCtx, *IS, Call);
+ return invalidateRegionsImpl(Regions, E, Count, LCtx, ResultsInPointerEscape,
+ *IS, Call);
}
ProgramStateRef
ProgramState::invalidateRegionsImpl(ArrayRef<const MemRegion *> Regions,
const Expr *E, unsigned Count,
const LocationContext *LCtx,
- StoreManager::InvalidatedSymbols &IS,
+ bool ResultsInPointerEscape,
+ InvalidatedSymbols &IS,
const CallEvent *Call) const {
ProgramStateManager &Mgr = getStateManager();
SubEngine* Eng = Mgr.getOwningEngine();
- if (Eng && Eng->wantsRegionChangeUpdate(this)) {
+ if (Eng) {
StoreManager::InvalidatedRegions Invalidated;
const StoreRef &newStore
= Mgr.StoreMgr->invalidateRegions(getStore(), Regions, E, Count, LCtx, IS,
Call, &Invalidated);
+
ProgramStateRef newState = makeWithStore(newStore);
+
+ if (ResultsInPointerEscape)
+ newState = Eng->processPointerEscapedOnInvalidateRegions(newState,
+ &IS, Regions, Invalidated, Call);
+
return Eng->processRegionChanges(newState, &IS, Regions, Invalidated, Call);
}