Rename AnalysisContext to AnalysisDeclContext.  Not only is this name more accurate, but it frees up the name AnalysisContext for other uses.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142782 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp b/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp
index cd977bf..66b3290 100644
--- a/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp
@@ -54,7 +54,7 @@
 
   // Get the CFG and the Decl of this block
   C = LC->getCFG();
-  D = LC->getAnalysisContext()->getDecl();
+  D = LC->getAnalysisDeclContext()->getDecl();
 
   unsigned total = 0, unreachable = 0;
 
diff --git a/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp b/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
index bf7ba18..06899fc 100644
--- a/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
+++ b/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
@@ -36,14 +36,14 @@
 namespace {
 class WalkAST : public StmtVisitor<WalkAST> {
   BugReporter &BR;
-  AnalysisContext* AC;
+  AnalysisDeclContext* AC;
   enum { num_setids = 6 };
   IdentifierInfo *II_setid[num_setids];
 
   const bool CheckRand;
 
 public:
-  WalkAST(BugReporter &br, AnalysisContext* ac)
+  WalkAST(BugReporter &br, AnalysisDeclContext* ac)
   : BR(br), AC(ac), II_setid(),
     CheckRand(isArc4RandomAvailable(BR.getContext())) {}
 
@@ -611,7 +611,7 @@
 public:
   void checkASTCodeBody(const Decl *D, AnalysisManager& mgr,
                         BugReporter &BR) const {
-    WalkAST walker(BR, mgr.getAnalysisContext(D));
+    WalkAST walker(BR, mgr.getAnalysisDeclContext(D));
     walker.Visit(D->getBody());
   }
 };
diff --git a/lib/StaticAnalyzer/Checkers/CheckSizeofPointer.cpp b/lib/StaticAnalyzer/Checkers/CheckSizeofPointer.cpp
index 469be05..55945e6 100644
--- a/lib/StaticAnalyzer/Checkers/CheckSizeofPointer.cpp
+++ b/lib/StaticAnalyzer/Checkers/CheckSizeofPointer.cpp
@@ -24,10 +24,10 @@
 namespace {
 class WalkAST : public StmtVisitor<WalkAST> {
   BugReporter &BR;
-  AnalysisContext* AC;
+  AnalysisDeclContext* AC;
 
 public:
-  WalkAST(BugReporter &br, AnalysisContext* ac) : BR(br), AC(ac) {}
+  WalkAST(BugReporter &br, AnalysisDeclContext* ac) : BR(br), AC(ac) {}
   void VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E);
   void VisitStmt(Stmt *S) { VisitChildren(S); }
   void VisitChildren(Stmt *S);
@@ -80,7 +80,7 @@
 public:
   void checkASTCodeBody(const Decl *D, AnalysisManager& mgr,
                         BugReporter &BR) const {
-    WalkAST walker(BR, mgr.getAnalysisContext(D));
+    WalkAST walker(BR, mgr.getAnalysisDeclContext(D));
     walker.Visit(D->getBody());
   }
 };
diff --git a/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp b/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
index 901af43..79c889d 100644
--- a/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
@@ -72,7 +72,7 @@
   const CFG &cfg;
   ASTContext &Ctx;
   BugReporter& BR;
-  AnalysisContext* AC;
+  AnalysisDeclContext* AC;
   ParentMap& Parents;
   llvm::SmallPtrSet<const VarDecl*, 20> Escaped;
   llvm::OwningPtr<ReachableCode> reachableCode;
@@ -82,7 +82,7 @@
 
 public:
   DeadStoreObs(const CFG &cfg, ASTContext &ctx,
-               BugReporter& br, AnalysisContext* ac, ParentMap& parents,
+               BugReporter& br, AnalysisDeclContext* ac, ParentMap& parents,
                llvm::SmallPtrSet<const VarDecl*, 20> &escaped)
     : cfg(cfg), Ctx(ctx), BR(br), AC(ac), Parents(parents),
       Escaped(escaped), currentBlock(0) {}
@@ -350,7 +350,7 @@
                         BugReporter &BR) const {
     if (LiveVariables *L = mgr.getAnalysis<LiveVariables>(D)) {
       CFG &cfg = *mgr.getCFG(D);
-      AnalysisContext *AC = mgr.getAnalysisContext(D);
+      AnalysisDeclContext *AC = mgr.getAnalysisDeclContext(D);
       ParentMap &pmap = mgr.getParentMap(D);
       FindEscaped FS(&cfg);
       FS.getCFG().VisitBlockStmts(FS);
diff --git a/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp b/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp
index 5c257e5..a3ebf0b 100644
--- a/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp
@@ -82,16 +82,16 @@
 
   // False positive reduction methods
   static bool isSelfAssign(const Expr *LHS, const Expr *RHS);
-  static bool isUnused(const Expr *E, AnalysisContext *AC);
+  static bool isUnused(const Expr *E, AnalysisDeclContext *AC);
   static bool isTruncationExtensionAssignment(const Expr *LHS,
                                               const Expr *RHS);
-  static bool pathWasCompletelyAnalyzed(AnalysisContext *AC,
+  static bool pathWasCompletelyAnalyzed(AnalysisDeclContext *AC,
                                         const CFGBlock *CB,
                                         const CoreEngine &CE);
   static bool CanVary(const Expr *Ex,
-                      AnalysisContext *AC);
+                      AnalysisDeclContext *AC);
   static bool isConstantOrPseudoConstant(const DeclRefExpr *DR,
-                                         AnalysisContext *AC);
+                                         AnalysisDeclContext *AC);
   static bool containsNonLocalVarDecl(const Stmt *S);
 
   // Hash table and related data structures
@@ -116,7 +116,7 @@
   // been created yet.
   BinaryOperatorData &Data = hash[B];
   Assumption &A = Data.assumption;
-  AnalysisContext *AC = C.getCurrentAnalysisContext();
+  AnalysisDeclContext *AC = C.getCurrentAnalysisDeclContext();
 
   // If we already have visited this node on a path that does not contain an
   // idempotent operation, return immediately.
@@ -366,8 +366,8 @@
     // warning
     if (Eng.hasWorkRemaining()) {
       // If we can trace back
-      AnalysisContext *AC = (*ES.begin())->getLocationContext()
-                                         ->getAnalysisContext();
+      AnalysisDeclContext *AC = (*ES.begin())->getLocationContext()
+                                         ->getAnalysisDeclContext();
       if (!pathWasCompletelyAnalyzed(AC,
                                      AC->getCFGStmtMap()->getBlock(B),
                                      Eng.getCoreEngine()))
@@ -487,7 +487,7 @@
 // Returns true if the Expr points to a VarDecl that is not read anywhere
 // outside of self-assignments.
 bool IdempotentOperationChecker::isUnused(const Expr *E,
-                                          AnalysisContext *AC) {
+                                          AnalysisDeclContext *AC) {
   if (!E)
     return false;
 
@@ -531,7 +531,7 @@
 // Returns false if a path to this block was not completely analyzed, or true
 // otherwise.
 bool
-IdempotentOperationChecker::pathWasCompletelyAnalyzed(AnalysisContext *AC,
+IdempotentOperationChecker::pathWasCompletelyAnalyzed(AnalysisDeclContext *AC,
                                                       const CFGBlock *CB,
                                                       const CoreEngine &CE) {
 
@@ -615,7 +615,7 @@
 // expression may also involve a variable that behaves like a constant. The
 // function returns true if the expression varies, and false otherwise.
 bool IdempotentOperationChecker::CanVary(const Expr *Ex,
-                                         AnalysisContext *AC) {
+                                         AnalysisDeclContext *AC) {
   // Parentheses and casts are irrelevant here
   Ex = Ex->IgnoreParenCasts();
 
@@ -699,7 +699,7 @@
 // Returns true if a DeclRefExpr is or behaves like a constant.
 bool IdempotentOperationChecker::isConstantOrPseudoConstant(
                                                           const DeclRefExpr *DR,
-                                                          AnalysisContext *AC) {
+                                                          AnalysisDeclContext *AC) {
   // Check if the type of the Decl is const-qualified
   if (DR->getType().isConstQualified())
     return true;
diff --git a/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp b/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp
index cf5501a..c9d315a 100644
--- a/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp
@@ -205,7 +205,7 @@
 
   // Delete any possible overflows which have a comparison.
   CheckOverflowOps c(PossibleMallocOverflows, BR.getContext());
-  c.Visit(mgr.getAnalysisContext(D)->getBody());
+  c.Visit(mgr.getAnalysisDeclContext(D)->getBody());
 
   // Output warnings for all overflows that are left.
   for (CheckOverflowOps::theVecType::iterator
diff --git a/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp b/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp
index 2fb9944..8b29a20 100644
--- a/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp
@@ -194,7 +194,7 @@
 
   // FIXME: A callback should disable checkers at the start of functions.
   if (!shouldRunOnFunctionOrMethod(dyn_cast<NamedDecl>(
-                                     C.getCurrentAnalysisContext()->getDecl())))
+                                     C.getCurrentAnalysisDeclContext()->getDecl())))
     return;
 
   if (isInitMessage(msg)) {
@@ -221,7 +221,7 @@
                                         CheckerContext &C) const {
   // FIXME: A callback should disable checkers at the start of functions.
   if (!shouldRunOnFunctionOrMethod(dyn_cast<NamedDecl>(
-                                     C.getCurrentAnalysisContext()->getDecl())))
+                                     C.getCurrentAnalysisDeclContext()->getDecl())))
     return;
 
   checkForInvalidSelf(E->getBase(), C,
@@ -233,7 +233,7 @@
                                        CheckerContext &C) const {
   // FIXME: A callback should disable checkers at the start of functions.
   if (!shouldRunOnFunctionOrMethod(dyn_cast<NamedDecl>(
-                                     C.getCurrentAnalysisContext()->getDecl())))
+                                     C.getCurrentAnalysisDeclContext()->getDecl())))
     return;
 
   checkForInvalidSelf(S->getRetValue(), C,
@@ -335,7 +335,7 @@
 
 /// \brief Returns true if the location is 'self'.
 static bool isSelfVar(SVal location, CheckerContext &C) {
-  AnalysisContext *analCtx = C.getCurrentAnalysisContext(); 
+  AnalysisDeclContext *analCtx = C.getCurrentAnalysisDeclContext(); 
   if (!analCtx->getSelfDecl())
     return false;
   if (!isa<loc::MemRegionVal>(location))
diff --git a/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp b/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
index 459ee65..ae28300 100644
--- a/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
@@ -69,7 +69,7 @@
 
     // Save the CFG if we don't have it already
     if (!C)
-      C = LC->getAnalysisContext()->getUnoptimizedCFG();
+      C = LC->getAnalysisDeclContext()->getUnoptimizedCFG();
     if (!PM)
       PM = &LC->getParentMap();
 
diff --git a/lib/StaticAnalyzer/Core/AnalysisManager.cpp b/lib/StaticAnalyzer/Core/AnalysisManager.cpp
index 17ec70d..72aed74 100644
--- a/lib/StaticAnalyzer/Core/AnalysisManager.cpp
+++ b/lib/StaticAnalyzer/Core/AnalysisManager.cpp
@@ -66,8 +66,8 @@
 }
 
 
-AnalysisContext *
-AnalysisManager::getAnalysisContextInAnotherTU(const Decl *D) {
+AnalysisDeclContext *
+AnalysisManager::getAnalysisDeclContextInAnotherTU(const Decl *D) {
   idx::Entity Ent = idx::Entity::get(const_cast<Decl *>(D), 
                                      Idxer->getProgram());
   FunctionDecl *FuncDef;
@@ -77,7 +77,7 @@
   if (FuncDef == 0)
     return 0;
 
-  // This AnalysisContext wraps function definition in another translation unit.
+  // This AnalysisDeclContext wraps function definition in another translation unit.
   // But it is still owned by the AnalysisManager associated with the current
   // translation unit.
   return AnaCtxMgr.getContext(FuncDef, TU);
diff --git a/lib/StaticAnalyzer/Core/CoreEngine.cpp b/lib/StaticAnalyzer/Core/CoreEngine.cpp
index 20ee5abb..525bd71 100644
--- a/lib/StaticAnalyzer/Core/CoreEngine.cpp
+++ b/lib/StaticAnalyzer/Core/CoreEngine.cpp
@@ -725,8 +725,8 @@
     ExprEngine NewEng(AMgr, GCEnabled);
 
     // Create the new LocationContext.
-    AnalysisContext *NewAnaCtx =
-      AMgr.getAnalysisContext(CalleeCtx->getDecl(), 
+    AnalysisDeclContext *NewAnaCtx =
+      AMgr.getAnalysisDeclContext(CalleeCtx->getDecl(), 
                               CalleeCtx->getTranslationUnit());
 
     const StackFrameContext *OldLocCtx = CalleeCtx;
diff --git a/lib/StaticAnalyzer/Core/ExprEngine.cpp b/lib/StaticAnalyzer/Core/ExprEngine.cpp
index 628ab85..269d7c7 100644
--- a/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ b/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -53,7 +53,7 @@
 
 ExprEngine::ExprEngine(AnalysisManager &mgr, bool gcEnabled)
   : AMgr(mgr),
-    AnalysisContexts(mgr.getAnalysisContextManager()),
+    AnalysisDeclContexts(mgr.getAnalysisDeclContextManager()),
     Engine(*this),
     G(Engine.getGraph()),
     Builder(NULL),
@@ -1509,7 +1509,7 @@
   // Check if the function definition is in the same translation unit.
   if (FD->hasBody(FD)) {
     const StackFrameContext *stackFrame = 
-      AMgr.getStackFrame(AMgr.getAnalysisContext(FD), 
+      AMgr.getStackFrame(AMgr.getAnalysisDeclContext(FD), 
                          Pred->getLocationContext(),
                          CE, Builder->getBlock(), Builder->getIndex());
     // Now we have the definition of the callee, create a CallEnter node.
@@ -1522,7 +1522,7 @@
 
   // Check if we can find the function definition in other translation units.
   if (AMgr.hasIndexer()) {
-    AnalysisContext *C = AMgr.getAnalysisContextInAnotherTU(FD);
+    AnalysisDeclContext *C = AMgr.getAnalysisDeclContextInAnotherTU(FD);
     if (C == 0)
       return false;
     const StackFrameContext *stackFrame = 
diff --git a/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp b/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
index 41c6035..e9d5e2c 100644
--- a/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
+++ b/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
@@ -224,7 +224,7 @@
 
   // Create the context for 'this' region.
   const StackFrameContext *SFC =
-    AnalysisContexts.getContext(DD)->
+    AnalysisDeclContexts.getContext(DD)->
       getStackFrame(Pred->getLocationContext(), S,
                     Builder->getBlock(), Builder->getIndex());
 
diff --git a/lib/StaticAnalyzer/Core/MemRegion.cpp b/lib/StaticAnalyzer/Core/MemRegion.cpp
index 6f92da8..2cc0607 100644
--- a/lib/StaticAnalyzer/Core/MemRegion.cpp
+++ b/lib/StaticAnalyzer/Core/MemRegion.cpp
@@ -337,7 +337,7 @@
 
 void BlockTextRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
                                     const BlockDecl *BD, CanQualType,
-                                    const AnalysisContext *AC,
+                                    const AnalysisDeclContext *AC,
                                     const MemRegion*) {
   ID.AddInteger(MemRegion::BlockTextRegionKind);
   ID.AddPointer(BD);
@@ -590,7 +590,7 @@
           const BlockTextRegion *BTR =
             getBlockTextRegion(BD,
                      C.getCanonicalType(BD->getSignatureAsWritten()->getType()),
-                     STC->getAnalysisContext());
+                     STC->getAnalysisDeclContext());
           sReg = getGlobalsRegion(BTR);
         }
         else {
@@ -678,7 +678,7 @@
 
 const BlockTextRegion *
 MemRegionManager::getBlockTextRegion(const BlockDecl *BD, CanQualType locTy,
-                                     AnalysisContext *AC) {
+                                     AnalysisDeclContext *AC) {
   return getSubRegion<BlockTextRegion>(BD, locTy, AC, getCodeRegion());
 }
 
@@ -928,8 +928,8 @@
   if (ReferencedVars)
     return;
 
-  AnalysisContext *AC = getCodeRegion()->getAnalysisContext();
-  AnalysisContext::referenced_decls_iterator I, E;
+  AnalysisDeclContext *AC = getCodeRegion()->getAnalysisDeclContext();
+  AnalysisDeclContext::referenced_decls_iterator I, E;
   llvm::tie(I, E) = AC->getReferencedBlockVars(BC->getDecl());
 
   if (I == E) {
diff --git a/lib/StaticAnalyzer/Core/PathDiagnostic.cpp b/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
index 3a87903..1152b3f 100644
--- a/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
+++ b/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
@@ -94,9 +94,9 @@
 //===----------------------------------------------------------------------===//
 
 static SourceLocation getValidSourceLocation(const Stmt* S,
-                                             LocationOrAnalysisContext LAC) {
+                                             LocationOrAnalysisDeclContext LAC) {
   SourceLocation L = S->getLocStart();
-  assert(!LAC.isNull() && "A valid LocationContext or AnalysisContext should "
+  assert(!LAC.isNull() && "A valid LocationContext or AnalysisDeclContext should "
                           "be passed to PathDiagnosticLocation upon creation.");
 
   // S might be a temporary statement that does not have a location in the
@@ -107,7 +107,7 @@
     if (LAC.is<const LocationContext*>())
       PM = &LAC.get<const LocationContext*>()->getParentMap();
     else
-      PM = &LAC.get<AnalysisContext*>()->getParentMap();
+      PM = &LAC.get<AnalysisDeclContext*>()->getParentMap();
 
     while (!L.isValid()) {
       S = PM->getParent(S);
@@ -127,7 +127,7 @@
 PathDiagnosticLocation
   PathDiagnosticLocation::createBegin(const Stmt *S,
                                       const SourceManager &SM,
-                                      LocationOrAnalysisContext LAC) {
+                                      LocationOrAnalysisDeclContext LAC) {
   return PathDiagnosticLocation(getValidSourceLocation(S, LAC),
                                 SM, SingleLocK);
 }
@@ -229,7 +229,7 @@
 
 FullSourceLoc
   PathDiagnosticLocation::genLocation(SourceLocation L,
-                                      LocationOrAnalysisContext LAC) const {
+                                      LocationOrAnalysisDeclContext LAC) const {
   assert(isValid());
   // Note that we want a 'switch' here so that the compiler can warn us in
   // case we add more cases.
@@ -248,7 +248,7 @@
 }
 
 PathDiagnosticRange
-  PathDiagnosticLocation::genRange(LocationOrAnalysisContext LAC) const {
+  PathDiagnosticLocation::genRange(LocationOrAnalysisDeclContext LAC) const {
   assert(isValid());
   // Note that we want a 'switch' here so that the compiler can warn us in
   // case we add more cases.
diff --git a/lib/StaticAnalyzer/Core/SValBuilder.cpp b/lib/StaticAnalyzer/Core/SValBuilder.cpp
index ebf7ae2..f118f4a 100644
--- a/lib/StaticAnalyzer/Core/SValBuilder.cpp
+++ b/lib/StaticAnalyzer/Core/SValBuilder.cpp
@@ -155,7 +155,7 @@
                                          CanQualType locTy,
                                          const LocationContext *locContext) {
   const BlockTextRegion *BC =
-    MemMgr.getBlockTextRegion(block, locTy, locContext->getAnalysisContext());
+    MemMgr.getBlockTextRegion(block, locTy, locContext->getAnalysisDeclContext());
   const BlockDataRegion *BD = MemMgr.getBlockDataRegion(BC, locContext);
   return loc::MemRegionVal(BD);
 }
diff --git a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
index fdf95b4..ded86b7 100644
--- a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
+++ b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
@@ -278,7 +278,7 @@
   if (!Opts.AnalyzeAll && !SM.isFromMainFile(SL))
     return;
 
-  // Clear the AnalysisManager of old AnalysisContexts.
+  // Clear the AnalysisManager of old AnalysisDeclContexts.
   Mgr->ClearContexts();
 
   // Dispatch on the actions.
@@ -318,7 +318,7 @@
   }
 
   // Execute the worklist algorithm.
-  Eng.ExecuteWorkList(mgr.getAnalysisContextManager().getStackFrame(D, 0),
+  Eng.ExecuteWorkList(mgr.getAnalysisDeclContextManager().getStackFrame(D, 0),
                       mgr.getMaxNodes());
 
   // Release the auditor (if any) so that it doesn't monitor the graph