[analyzer] Remove LocationContext creation methods from AnalysisManager, and change clients to use AnalysisContext instead.

WIP to remove/reduce ExprEngine's usage of AnalysisManager.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142739 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/StaticAnalyzer/Core/CoreEngine.cpp b/lib/StaticAnalyzer/Core/CoreEngine.cpp
index 93eb142..20ee5abb 100644
--- a/lib/StaticAnalyzer/Core/CoreEngine.cpp
+++ b/lib/StaticAnalyzer/Core/CoreEngine.cpp
@@ -725,14 +725,16 @@
     ExprEngine NewEng(AMgr, GCEnabled);
 
     // Create the new LocationContext.
-    AnalysisContext *NewAnaCtx = AMgr.getAnalysisContext(CalleeCtx->getDecl(), 
-                                               CalleeCtx->getTranslationUnit());
+    AnalysisContext *NewAnaCtx =
+      AMgr.getAnalysisContext(CalleeCtx->getDecl(), 
+                              CalleeCtx->getTranslationUnit());
+
     const StackFrameContext *OldLocCtx = CalleeCtx;
-    const StackFrameContext *NewLocCtx = AMgr.getStackFrame(NewAnaCtx, 
-                                               OldLocCtx->getParent(),
-                                               OldLocCtx->getCallSite(),
-                                               OldLocCtx->getCallSiteBlock(), 
-                                               OldLocCtx->getIndex());
+    const StackFrameContext *NewLocCtx =
+      NewAnaCtx->getStackFrame(OldLocCtx->getParent(),
+                               OldLocCtx->getCallSite(),
+                               OldLocCtx->getCallSiteBlock(), 
+                               OldLocCtx->getIndex());
 
     // Now create an initial state for the new engine.
     const ProgramState *NewState =
diff --git a/lib/StaticAnalyzer/Core/ExprEngine.cpp b/lib/StaticAnalyzer/Core/ExprEngine.cpp
index 5f1fe1b..628ab85 100644
--- a/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ b/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -53,6 +53,7 @@
 
 ExprEngine::ExprEngine(AnalysisManager &mgr, bool gcEnabled)
   : AMgr(mgr),
+    AnalysisContexts(mgr.getAnalysisContextManager()),
     Engine(*this),
     G(Engine.getGraph()),
     Builder(NULL),
diff --git a/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp b/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
index acb0074..41c6035 100644
--- a/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
+++ b/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
@@ -215,17 +215,18 @@
 }
 
 void ExprEngine::VisitCXXDestructor(const CXXDestructorDecl *DD,
-                                      const MemRegion *Dest,
-                                      const Stmt *S,
-                                      ExplodedNode *Pred, 
-                                      ExplodedNodeSet &Dst) {
+                                    const MemRegion *Dest,
+                                    const Stmt *S,
+                                    ExplodedNode *Pred, 
+                                    ExplodedNodeSet &Dst) {
   if (!(DD->doesThisDeclarationHaveABody() && AMgr.shouldInlineCall()))
     return;
+
   // Create the context for 'this' region.
-  const StackFrameContext *SFC = AMgr.getStackFrame(DD,
-                                                    Pred->getLocationContext(),
-                                                    S, Builder->getBlock(),
-                                                    Builder->getIndex());
+  const StackFrameContext *SFC =
+    AnalysisContexts.getContext(DD)->
+      getStackFrame(Pred->getLocationContext(), S,
+                    Builder->getBlock(), Builder->getIndex());
 
   const CXXThisRegion *ThisR = getCXXThisRegion(DD->getParent(), SFC);
 
diff --git a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
index 34a358f..fdf95b4 100644
--- a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
+++ b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
@@ -318,7 +318,8 @@
   }
 
   // Execute the worklist algorithm.
-  Eng.ExecuteWorkList(mgr.getStackFrame(D, 0), mgr.getMaxNodes());
+  Eng.ExecuteWorkList(mgr.getAnalysisContextManager().getStackFrame(D, 0),
+                      mgr.getMaxNodes());
 
   // Release the auditor (if any) so that it doesn't monitor the graph
   // created BugReporter.