aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Checker/AnalysisManager.cpp2
-rw-r--r--lib/Checker/GRCXXExprEngine.cpp6
-rw-r--r--lib/Checker/GRCoreEngine.cpp9
-rw-r--r--lib/Checker/GRExprEngine.cpp32
4 files changed, 23 insertions, 26 deletions
diff --git a/lib/Checker/AnalysisManager.cpp b/lib/Checker/AnalysisManager.cpp
index 339cdab80b..1bc22a320b 100644
--- a/lib/Checker/AnalysisManager.cpp
+++ b/lib/Checker/AnalysisManager.cpp
@@ -13,7 +13,7 @@
using namespace clang;
-const AnalysisContext *
+AnalysisContext *
AnalysisManager::getAnalysisContextInAnotherTU(const Decl *D) {
idx::Entity Ent = idx::Entity::get(const_cast<Decl *>(D),
Idxer->getProgram());
diff --git a/lib/Checker/GRCXXExprEngine.cpp b/lib/Checker/GRCXXExprEngine.cpp
index ecc1490ce6..e9939af1eb 100644
--- a/lib/Checker/GRCXXExprEngine.cpp
+++ b/lib/Checker/GRCXXExprEngine.cpp
@@ -130,7 +130,7 @@ void GRExprEngine::VisitCXXConstructExpr(const CXXConstructExpr *E,
const CXXThisRegion *ThisR =getCXXThisRegion(E->getConstructor()->getParent(),
SFC);
- CallEnter Loc(E, SFC->getAnalysisContext(), Pred->getLocationContext());
+ CallEnter Loc(E, SFC, Pred->getLocationContext());
for (ExplodedNodeSet::iterator NI = ArgsEvaluated.begin(),
NE = ArgsEvaluated.end(); NI != NE; ++NI) {
const GRState *state = GetState(*NI);
@@ -158,7 +158,7 @@ void GRExprEngine::VisitCXXDestructor(const CXXDestructorDecl *DD,
const CXXThisRegion *ThisR = getCXXThisRegion(DD->getParent(), SFC);
- CallEnter PP(S, SFC->getAnalysisContext(), Pred->getLocationContext());
+ CallEnter PP(S, SFC, Pred->getLocationContext());
const GRState *state = Pred->getState();
state = state->bindLoc(loc::MemRegionVal(ThisR), loc::MemRegionVal(Dest));
@@ -243,7 +243,7 @@ void GRExprEngine::EvalMethodCall(const CallExpr *MCE, const CXXMethodDecl *MD,
Builder->getBlock(),
Builder->getIndex());
const CXXThisRegion *ThisR = getCXXThisRegion(MD->getParent(), SFC);
- CallEnter Loc(MCE, SFC->getAnalysisContext(), Pred->getLocationContext());
+ CallEnter Loc(MCE, SFC, Pred->getLocationContext());
for (ExplodedNodeSet::iterator I = PreVisitChecks.begin(),
E = PreVisitChecks.end(); I != E; ++I) {
// Set up 'this' region.
diff --git a/lib/Checker/GRCoreEngine.cpp b/lib/Checker/GRCoreEngine.cpp
index a121cbbcd1..270985f416 100644
--- a/lib/Checker/GRCoreEngine.cpp
+++ b/lib/Checker/GRCoreEngine.cpp
@@ -715,8 +715,7 @@ void GREndPathNodeBuilder::GenerateCallExitNode(const GRState *state) {
}
-void GRCallEnterNodeBuilder::GenerateNode(const GRState *state,
- const LocationContext *LocCtx) {
+void GRCallEnterNodeBuilder::GenerateNode(const GRState *state) {
// Check if the callee is in the same translation unit.
if (CalleeCtx->getTranslationUnit() !=
Pred->getLocationContext()->getTranslationUnit()) {
@@ -756,7 +755,7 @@ void GRCallEnterNodeBuilder::GenerateNode(const GRState *state,
// Create the new LocationContext.
AnalysisContext *NewAnaCtx = AMgr.getAnalysisContext(CalleeCtx->getDecl(),
CalleeCtx->getTranslationUnit());
- const StackFrameContext *OldLocCtx = cast<StackFrameContext>(LocCtx);
+ const StackFrameContext *OldLocCtx = CalleeCtx;
const StackFrameContext *NewLocCtx = AMgr.getStackFrame(NewAnaCtx,
OldLocCtx->getParent(),
OldLocCtx->getCallSite(),
@@ -773,7 +772,7 @@ void GRCallEnterNodeBuilder::GenerateNode(const GRState *state,
}
// Get the callee entry block.
- const CFGBlock *Entry = &(LocCtx->getCFG()->getEntry());
+ const CFGBlock *Entry = &(CalleeCtx->getCFG()->getEntry());
assert(Entry->empty());
assert(Entry->succ_size() == 1);
@@ -781,7 +780,7 @@ void GRCallEnterNodeBuilder::GenerateNode(const GRState *state,
const CFGBlock *SuccB = *(Entry->succ_begin());
// Construct an edge representing the starting location in the callee.
- BlockEdge Loc(Entry, SuccB, LocCtx);
+ BlockEdge Loc(Entry, SuccB, CalleeCtx);
bool isNew;
ExplodedNode *Node = Eng.G->getNode(Loc, state, &isNew);
diff --git a/lib/Checker/GRExprEngine.cpp b/lib/Checker/GRExprEngine.cpp
index 30ac9cefbb..f0aa38b07c 100644
--- a/lib/Checker/GRExprEngine.cpp
+++ b/lib/Checker/GRExprEngine.cpp
@@ -1619,24 +1619,16 @@ void GRExprEngine::ProcessSwitch(GRSwitchNodeBuilder& builder) {
}
void GRExprEngine::ProcessCallEnter(GRCallEnterNodeBuilder &B) {
- const StackFrameContext *LocCtx
- = AMgr.getStackFrame(B.getCalleeContext(),
- B.getLocationContext(),
- B.getCallExpr(),
- B.getBlock(),
- B.getIndex());
-
- const GRState *state = B.getState()->EnterStackFrame(LocCtx);
-
- B.GenerateNode(state, LocCtx);
+ const GRState *state = B.getState()->EnterStackFrame(B.getCalleeContext());
+ B.GenerateNode(state);
}
void GRExprEngine::ProcessCallExit(GRCallExitNodeBuilder &B) {
const GRState *state = B.getState();
const ExplodedNode *Pred = B.getPredecessor();
- const StackFrameContext *LocCtx =
+ const StackFrameContext *calleeCtx =
cast<StackFrameContext>(Pred->getLocationContext());
- const Stmt *CE = LocCtx->getCallSite();
+ const Stmt *CE = calleeCtx->getCallSite();
// If the callee returns an expression, bind its value to CallExpr.
const Stmt *ReturnedExpr = state->get<ReturnExpr>();
@@ -1650,7 +1642,7 @@ void GRExprEngine::ProcessCallExit(GRCallExitNodeBuilder &B) {
// Bind the constructed object value to CXXConstructExpr.
if (const CXXConstructExpr *CCE = dyn_cast<CXXConstructExpr>(CE)) {
const CXXThisRegion *ThisR =
- getCXXThisRegion(CCE->getConstructor()->getParent(), LocCtx);
+ getCXXThisRegion(CCE->getConstructor()->getParent(), calleeCtx);
// We might not have 'this' region in the binding if we didn't inline
// the ctor call.
SVal ThisV = state->getSVal(ThisR);
@@ -2078,8 +2070,12 @@ bool GRExprEngine::InlineCall(ExplodedNodeSet &Dst, const CallExpr *CE,
// Check if the function definition is in the same translation unit.
if (FD->hasBody(FD)) {
+ const StackFrameContext *stackFrame =
+ AMgr.getStackFrame(AMgr.getAnalysisContext(FD),
+ Pred->getLocationContext(),
+ CE, Builder->getBlock(), Builder->getIndex());
// Now we have the definition of the callee, create a CallEnter node.
- CallEnter Loc(CE, AMgr.getAnalysisContext(FD), Pred->getLocationContext());
+ CallEnter Loc(CE, stackFrame, Pred->getLocationContext());
ExplodedNode *N = Builder->generateNode(Loc, state, Pred);
Dst.Add(N);
@@ -2088,11 +2084,13 @@ bool GRExprEngine::InlineCall(ExplodedNodeSet &Dst, const CallExpr *CE,
// Check if we can find the function definition in other translation units.
if (AMgr.hasIndexer()) {
- const AnalysisContext *C = AMgr.getAnalysisContextInAnotherTU(FD);
+ AnalysisContext *C = AMgr.getAnalysisContextInAnotherTU(FD);
if (C == 0)
return false;
-
- CallEnter Loc(CE, C, Pred->getLocationContext());
+ const StackFrameContext *stackFrame =
+ AMgr.getStackFrame(C, Pred->getLocationContext(),
+ CE, Builder->getBlock(), Builder->getIndex());
+ CallEnter Loc(CE, stackFrame, Pred->getLocationContext());
ExplodedNode *N = Builder->generateNode(Loc, state, Pred);
Dst.Add(N);
return true;