summaryrefslogtreecommitdiffstats
path: root/clang/lib/Checker
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2010-03-04 09:04:52 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2010-03-04 09:04:52 +0000
commit5cb8d9d40f15058e96e9327dc15b0962b1cfe060 (patch)
tree3391f84d499c8cca5efca6965f772600e771dc68 /clang/lib/Checker
parent1a7ed5868b754c31aabc5614fe6dd0535b095904 (diff)
downloadbcm5719-llvm-5cb8d9d40f15058e96e9327dc15b0962b1cfe060.tar.gz
bcm5719-llvm-5cb8d9d40f15058e96e9327dc15b0962b1cfe060.zip
When profiling Environment, also profile with AnalysisContext*, bacause
we now may have identical states with different analysis context. Set the right AnalysisContext in state when entering and leaving a callee. With both of the above changes, we can pass the test case. llvm-svn: 97724
Diffstat (limited to 'clang/lib/Checker')
-rw-r--r--clang/lib/Checker/GRCoreEngine.cpp1
-rw-r--r--clang/lib/Checker/GRExprEngine.cpp1
-rw-r--r--clang/lib/Checker/GRState.cpp6
3 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Checker/GRCoreEngine.cpp b/clang/lib/Checker/GRCoreEngine.cpp
index a9347d01641..63ac31d6064 100644
--- a/clang/lib/Checker/GRCoreEngine.cpp
+++ b/clang/lib/Checker/GRCoreEngine.cpp
@@ -682,6 +682,7 @@ void GRCallExitNodeBuilder::GenerateNode(const GRState *state) {
// Get the callee's location context.
const StackFrameContext *LocCtx
= cast<StackFrameContext>(Pred->getLocationContext());
+ state = state->setAnalysisContext(LocCtx->getParent()->getAnalysisContext());
PostStmt Loc(LocCtx->getCallSite(), LocCtx->getParent());
bool isNew;
diff --git a/clang/lib/Checker/GRExprEngine.cpp b/clang/lib/Checker/GRExprEngine.cpp
index ad229c7b8fb..d25526e1ede 100644
--- a/clang/lib/Checker/GRExprEngine.cpp
+++ b/clang/lib/Checker/GRExprEngine.cpp
@@ -1309,6 +1309,7 @@ void GRExprEngine::ProcessCallEnter(GRCallEnterNodeBuilder &B) {
const GRState *state = B.getState();
state = getStoreManager().EnterStackFrame(state, LocCtx);
+ state = state->setAnalysisContext(LocCtx->getAnalysisContext());
B.GenerateNode(state, LocCtx);
}
diff --git a/clang/lib/Checker/GRState.cpp b/clang/lib/Checker/GRState.cpp
index 592f930316e..ce7d6e2a838 100644
--- a/clang/lib/Checker/GRState.cpp
+++ b/clang/lib/Checker/GRState.cpp
@@ -23,6 +23,12 @@ using namespace clang;
// FIXME: Move this elsewhere.
ConstraintManager::~ConstraintManager() {}
+const GRState *GRState::setAnalysisContext(AnalysisContext *ctx) const {
+ GRState NewState = *this;
+ NewState.Env.setAnalysisContext(ctx);
+ return StateMgr->getPersistentState(NewState);
+}
+
GRStateManager::~GRStateManager() {
for (std::vector<GRState::Printer*>::iterator I=Printers.begin(),
E=Printers.end(); I!=E; ++I)
OpenPOWER on IntegriCloud