summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2011-10-27 00:59:28 +0000
committerAnna Zaks <ganna@apple.com>2011-10-27 00:59:28 +0000
commit0ec04bf73885df3e10bd7fcd5c8ce901cad7d76c (patch)
tree8c1288c3f2982d89c7a253e7b1249e070641c1e3 /clang/lib
parentb1d3d968725baf28a00b12aad760434036cbe704 (diff)
downloadbcm5719-llvm-0ec04bf73885df3e10bd7fcd5c8ce901cad7d76c.tar.gz
bcm5719-llvm-0ec04bf73885df3e10bd7fcd5c8ce901cad7d76c.zip
[analyzer] Move enqueueEndOfFunction into CoreEngine.
llvm-svn: 143090
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/StaticAnalyzer/Core/CoreEngine.cpp29
-rw-r--r--clang/lib/StaticAnalyzer/Core/ExprEngine.cpp31
2 files changed, 30 insertions, 30 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp b/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
index e88a8f1963d..5ab55b5ee39 100644
--- a/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
+++ b/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
@@ -491,6 +491,22 @@ void CoreEngine::enqueueStmtNode(ExplodedNode *N,
WList->enqueue(Succ, Block, Idx+1);
}
+ExplodedNode *CoreEngine::generateCallExitNode(ExplodedNode *N) {
+ // Create a CallExit node and enqueue it.
+ const StackFrameContext *LocCtx
+ = cast<StackFrameContext>(N->getLocationContext());
+ const Stmt *CE = LocCtx->getCallSite();
+
+ // Use the the callee location context.
+ CallExit Loc(CE, LocCtx);
+
+ bool isNew;
+ ExplodedNode *Node = G->getNode(Loc, N->getState(), &isNew);
+ Node->addPredecessor(N, *G);
+ return isNew ? Node : 0;
+}
+
+
void CoreEngine::enqueue(ExplodedNodeSet &Set) {
for (ExplodedNodeSet::iterator I = Set.begin(),
E = Set.end(); I != E; ++I) {
@@ -506,6 +522,19 @@ void CoreEngine::enqueue(ExplodedNodeSet &Set,
}
}
+void CoreEngine::enqueueEndOfFunction(ExplodedNodeSet &Set) {
+ for (ExplodedNodeSet::iterator I = Set.begin(), E = Set.end(); I != E; ++I) {
+ ExplodedNode *N = *I;
+ // If we are in an inlined call, generate CallExit node.
+ if (N->getLocationContext()->getParent()) {
+ N = generateCallExitNode(N);
+ if (N)
+ WList->enqueue(N);
+ } else
+ G->addEndOfPath(N);
+ }
+}
+
ExplodedNode* NodeBuilder::generateNodeImpl(const ProgramPoint &Loc,
const ProgramState *State,
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
index 2c5379f66a7..3924154f6f4 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -1100,42 +1100,13 @@ void ExprEngine::processIndirectGoto(IndirectGotoNodeBuilder &builder) {
builder.generateNode(I, state);
}
-// TODO: The next two functions should be moved into CoreEngine.
-void ExprEngine::GenerateCallExitNode(ExplodedNode *N) {
- // Create a CallExit node and enqueue it.
- const StackFrameContext *LocCtx
- = cast<StackFrameContext>(N->getLocationContext());
- const Stmt *CE = LocCtx->getCallSite();
-
- // Use the the callee location context.
- CallExit Loc(CE, LocCtx);
-
- bool isNew;
- ExplodedNode *Node = Engine.G->getNode(Loc, N->getState(), &isNew);
- Node->addPredecessor(N, *Engine.G);
-
- if (isNew)
- Engine.WList->enqueue(Node);
-}
-
-void ExprEngine::enqueueEndOfPath(ExplodedNodeSet &S) {
- for (ExplodedNodeSet::iterator I = S.begin(), E = S.end(); I != E; ++I) {
- ExplodedNode *N = *I;
- // If we are in an inlined call, generate CallExit node.
- if (N->getLocationContext()->getParent())
- GenerateCallExitNode(N);
- else
- Engine.G->addEndOfPath(N);
- }
-}
-
/// ProcessEndPath - Called by CoreEngine. Used to generate end-of-path
/// nodes when the control reaches the end of a function.
void ExprEngine::processEndOfFunction(NodeBuilderContext& BC) {
StateMgr.EndPath(BC.Pred->getState());
ExplodedNodeSet Dst;
getCheckerManager().runCheckersForEndPath(BC, Dst, *this);
- enqueueEndOfPath(Dst);
+ Engine.enqueueEndOfFunction(Dst);
}
/// ProcessSwitch - Called by CoreEngine. Used to generate successor
OpenPOWER on IntegriCloud