浏览代码

[analyzer] Remove references to idx::TranslationUnit. Index is dead, cross-TU inlining never panned out.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155751 91177308-0d34-0410-b5e6-96231b3b80d8
Jordy Rose 13 年之前
父节点
当前提交
d200187bd2

+ 4 - 16
include/clang/Analysis/AnalysisContext.h

@@ -73,9 +73,6 @@ class AnalysisDeclContext {
 
 
   const Decl *D;
   const Decl *D;
 
 
-  // TranslationUnit is NULL if we don't have multiple translation units.
-  idx::TranslationUnit *TU;
-
   OwningPtr<CFG> cfg, completeCFG;
   OwningPtr<CFG> cfg, completeCFG;
   OwningPtr<CFGStmtMap> cfgStmtMap;
   OwningPtr<CFGStmtMap> cfgStmtMap;
 
 
@@ -98,12 +95,10 @@ class AnalysisDeclContext {
 
 
 public:
 public:
   AnalysisDeclContext(AnalysisDeclContextManager *Mgr,
   AnalysisDeclContext(AnalysisDeclContextManager *Mgr,
-                  const Decl *D,
-                  idx::TranslationUnit *TU);
+                  const Decl *D);
 
 
   AnalysisDeclContext(AnalysisDeclContextManager *Mgr,
   AnalysisDeclContext(AnalysisDeclContextManager *Mgr,
                   const Decl *D,
                   const Decl *D,
-                  idx::TranslationUnit *TU,
                   const CFG::BuildOptions &BuildOptions);
                   const CFG::BuildOptions &BuildOptions);
 
 
   ~AnalysisDeclContext();
   ~AnalysisDeclContext();
@@ -111,8 +106,6 @@ public:
   ASTContext &getASTContext() { return D->getASTContext(); }
   ASTContext &getASTContext() { return D->getASTContext(); }
   const Decl *getDecl() const { return D; }
   const Decl *getDecl() const { return D; }
 
 
-  idx::TranslationUnit *getTranslationUnit() const { return TU; }
-
   /// Return the build options used to construct the CFG.
   /// Return the build options used to construct the CFG.
   CFG::BuildOptions &getCFGBuildOptions() {
   CFG::BuildOptions &getCFGBuildOptions() {
     return cfgBuildOptions;
     return cfgBuildOptions;
@@ -212,10 +205,6 @@ public:
 
 
   AnalysisDeclContext *getAnalysisDeclContext() const { return Ctx; }
   AnalysisDeclContext *getAnalysisDeclContext() const { return Ctx; }
 
 
-  idx::TranslationUnit *getTranslationUnit() const {
-    return Ctx->getTranslationUnit();
-  }
-
   const LocationContext *getParent() const { return Parent; }
   const LocationContext *getParent() const { return Parent; }
 
 
   bool isParentOf(const LocationContext *LC) const;
   bool isParentOf(const LocationContext *LC) const;
@@ -383,7 +372,7 @@ public:
 
 
   ~AnalysisDeclContextManager();
   ~AnalysisDeclContextManager();
 
 
-  AnalysisDeclContext *getContext(const Decl *D, idx::TranslationUnit *TU = 0);
+  AnalysisDeclContext *getContext(const Decl *D);
 
 
   bool getUseUnoptimizedCFG() const {
   bool getUseUnoptimizedCFG() const {
     return !cfgBuildOptions.PruneTriviallyFalseEdges;
     return !cfgBuildOptions.PruneTriviallyFalseEdges;
@@ -402,9 +391,8 @@ public:
   }
   }
 
 
   // Get the top level stack frame.
   // Get the top level stack frame.
-  const StackFrameContext *getStackFrame(Decl const *D,
-                                         idx::TranslationUnit *TU) {
-    return LocContexts.getStackFrame(getContext(D, TU), 0, 0, 0, 0);
+  const StackFrameContext *getStackFrame(const Decl *D) {
+    return LocContexts.getStackFrame(getContext(D), 0, 0, 0, 0);
   }
   }
 
 
   // Get a stack frame with parent.
   // Get a stack frame with parent.

+ 0 - 4
include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h

@@ -190,10 +190,6 @@ public:
     return AnaCtxMgr.getContext(D);
     return AnaCtxMgr.getContext(D);
   }
   }
 
 
-  AnalysisDeclContext *getAnalysisDeclContext(const Decl *D, idx::TranslationUnit *TU) {
-    return AnaCtxMgr.getContext(D, TU);
-  }
-
 };
 };
 
 
 } // enAnaCtxMgrspace
 } // enAnaCtxMgrspace

+ 3 - 8
lib/Analysis/AnalysisDeclContext.cpp

@@ -34,11 +34,9 @@ typedef llvm::DenseMap<const void *, ManagedAnalysis *> ManagedAnalysisMap;
 
 
 AnalysisDeclContext::AnalysisDeclContext(AnalysisDeclContextManager *Mgr,
 AnalysisDeclContext::AnalysisDeclContext(AnalysisDeclContextManager *Mgr,
                                  const Decl *d,
                                  const Decl *d,
-                                 idx::TranslationUnit *tu,
                                  const CFG::BuildOptions &buildOptions)
                                  const CFG::BuildOptions &buildOptions)
   : Manager(Mgr),
   : Manager(Mgr),
     D(d),
     D(d),
-    TU(tu),
     cfgBuildOptions(buildOptions),
     cfgBuildOptions(buildOptions),
     forcedBlkExprs(0),
     forcedBlkExprs(0),
     builtCFG(false),
     builtCFG(false),
@@ -50,11 +48,9 @@ AnalysisDeclContext::AnalysisDeclContext(AnalysisDeclContextManager *Mgr,
 }
 }
 
 
 AnalysisDeclContext::AnalysisDeclContext(AnalysisDeclContextManager *Mgr,
 AnalysisDeclContext::AnalysisDeclContext(AnalysisDeclContextManager *Mgr,
-                                 const Decl *d,
-                                 idx::TranslationUnit *tu)
+                                 const Decl *d)
 : Manager(Mgr),
 : Manager(Mgr),
   D(d),
   D(d),
-  TU(tu),
   forcedBlkExprs(0),
   forcedBlkExprs(0),
   builtCFG(false),
   builtCFG(false),
   builtCompleteCFG(false),
   builtCompleteCFG(false),
@@ -195,11 +191,10 @@ PseudoConstantAnalysis *AnalysisDeclContext::getPseudoConstantAnalysis() {
   return PCA.get();
   return PCA.get();
 }
 }
 
 
-AnalysisDeclContext *AnalysisDeclContextManager::getContext(const Decl *D,
-                                                    idx::TranslationUnit *TU) {
+AnalysisDeclContext *AnalysisDeclContextManager::getContext(const Decl *D) {
   AnalysisDeclContext *&AC = Contexts[D];
   AnalysisDeclContext *&AC = Contexts[D];
   if (!AC)
   if (!AC)
-    AC = new AnalysisDeclContext(this, D, TU, cfgBuildOptions);
+    AC = new AnalysisDeclContext(this, D, cfgBuildOptions);
   return AC;
   return AC;
 }
 }
 
 

+ 1 - 1
lib/Sema/AnalysisBasedWarnings.cpp

@@ -830,7 +830,7 @@ AnalysisBasedWarnings::IssueWarnings(sema::AnalysisBasedWarnings::Policy P,
   const Stmt *Body = D->getBody();
   const Stmt *Body = D->getBody();
   assert(Body);
   assert(Body);
 
 
-  AnalysisDeclContext AC(/* AnalysisDeclContextManager */ 0,  D, 0);
+  AnalysisDeclContext AC(/* AnalysisDeclContextManager */ 0, D);
 
 
   // Don't generate EH edges for CallExprs as we'd like to avoid the n^2
   // Don't generate EH edges for CallExprs as we'd like to avoid the n^2
   // explosion for destrutors that can result and the compile time hit.
   // explosion for destrutors that can result and the compile time hit.

+ 1 - 1
lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

@@ -526,7 +526,7 @@ void AnalysisConsumer::ActionExprEngine(Decl *D, bool ObjCGCEnabled,
   }
   }
 
 
   // Execute the worklist algorithm.
   // Execute the worklist algorithm.
-  Eng.ExecuteWorkList(Mgr->getAnalysisDeclContextManager().getStackFrame(D, 0),
+  Eng.ExecuteWorkList(Mgr->getAnalysisDeclContextManager().getStackFrame(D),
                       Mgr->getMaxNodes());
                       Mgr->getMaxNodes());
 
 
   // Release the auditor (if any) so that it doesn't monitor the graph
   // Release the auditor (if any) so that it doesn't monitor the graph