From d200187bd27f9ad68699693a6e57f9ee3ff260fa Mon Sep 17 00:00:00 2001 From: Jordy Rose Date: Sat, 28 Apr 2012 01:58:08 +0000 Subject: [PATCH] [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 --- include/clang/Analysis/AnalysisContext.h | 20 ++++--------------- .../Core/PathSensitive/AnalysisManager.h | 4 ---- lib/Analysis/AnalysisDeclContext.cpp | 11 +++------- lib/Sema/AnalysisBasedWarnings.cpp | 2 +- .../Frontend/AnalysisConsumer.cpp | 2 +- 5 files changed, 9 insertions(+), 30 deletions(-) diff --git a/include/clang/Analysis/AnalysisContext.h b/include/clang/Analysis/AnalysisContext.h index 6b6f8ef2cc..4e2a544330 100644 --- a/include/clang/Analysis/AnalysisContext.h +++ b/include/clang/Analysis/AnalysisContext.h @@ -73,9 +73,6 @@ class AnalysisDeclContext { const Decl *D; - // TranslationUnit is NULL if we don't have multiple translation units. - idx::TranslationUnit *TU; - OwningPtr cfg, completeCFG; OwningPtr cfgStmtMap; @@ -98,12 +95,10 @@ class AnalysisDeclContext { public: AnalysisDeclContext(AnalysisDeclContextManager *Mgr, - const Decl *D, - idx::TranslationUnit *TU); + const Decl *D); AnalysisDeclContext(AnalysisDeclContextManager *Mgr, const Decl *D, - idx::TranslationUnit *TU, const CFG::BuildOptions &BuildOptions); ~AnalysisDeclContext(); @@ -111,8 +106,6 @@ public: ASTContext &getASTContext() { return D->getASTContext(); } const Decl *getDecl() const { return D; } - idx::TranslationUnit *getTranslationUnit() const { return TU; } - /// Return the build options used to construct the CFG. CFG::BuildOptions &getCFGBuildOptions() { return cfgBuildOptions; @@ -212,10 +205,6 @@ public: AnalysisDeclContext *getAnalysisDeclContext() const { return Ctx; } - idx::TranslationUnit *getTranslationUnit() const { - return Ctx->getTranslationUnit(); - } - const LocationContext *getParent() const { return Parent; } bool isParentOf(const LocationContext *LC) const; @@ -383,7 +372,7 @@ public: ~AnalysisDeclContextManager(); - AnalysisDeclContext *getContext(const Decl *D, idx::TranslationUnit *TU = 0); + AnalysisDeclContext *getContext(const Decl *D); bool getUseUnoptimizedCFG() const { return !cfgBuildOptions.PruneTriviallyFalseEdges; @@ -402,9 +391,8 @@ public: } // 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. diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h b/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h index d01644ba0e..c2f56fc92f 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h @@ -190,10 +190,6 @@ public: return AnaCtxMgr.getContext(D); } - AnalysisDeclContext *getAnalysisDeclContext(const Decl *D, idx::TranslationUnit *TU) { - return AnaCtxMgr.getContext(D, TU); - } - }; } // enAnaCtxMgrspace diff --git a/lib/Analysis/AnalysisDeclContext.cpp b/lib/Analysis/AnalysisDeclContext.cpp index 659cc6d3f1..624373330f 100644 --- a/lib/Analysis/AnalysisDeclContext.cpp +++ b/lib/Analysis/AnalysisDeclContext.cpp @@ -34,11 +34,9 @@ typedef llvm::DenseMap ManagedAnalysisMap; AnalysisDeclContext::AnalysisDeclContext(AnalysisDeclContextManager *Mgr, const Decl *d, - idx::TranslationUnit *tu, const CFG::BuildOptions &buildOptions) : Manager(Mgr), D(d), - TU(tu), cfgBuildOptions(buildOptions), forcedBlkExprs(0), builtCFG(false), @@ -50,11 +48,9 @@ AnalysisDeclContext::AnalysisDeclContext(AnalysisDeclContextManager *Mgr, } AnalysisDeclContext::AnalysisDeclContext(AnalysisDeclContextManager *Mgr, - const Decl *d, - idx::TranslationUnit *tu) + const Decl *d) : Manager(Mgr), D(d), - TU(tu), forcedBlkExprs(0), builtCFG(false), builtCompleteCFG(false), @@ -195,11 +191,10 @@ PseudoConstantAnalysis *AnalysisDeclContext::getPseudoConstantAnalysis() { return PCA.get(); } -AnalysisDeclContext *AnalysisDeclContextManager::getContext(const Decl *D, - idx::TranslationUnit *TU) { +AnalysisDeclContext *AnalysisDeclContextManager::getContext(const Decl *D) { AnalysisDeclContext *&AC = Contexts[D]; if (!AC) - AC = new AnalysisDeclContext(this, D, TU, cfgBuildOptions); + AC = new AnalysisDeclContext(this, D, cfgBuildOptions); return AC; } diff --git a/lib/Sema/AnalysisBasedWarnings.cpp b/lib/Sema/AnalysisBasedWarnings.cpp index a8e679132c..9e577d9885 100644 --- a/lib/Sema/AnalysisBasedWarnings.cpp +++ b/lib/Sema/AnalysisBasedWarnings.cpp @@ -830,7 +830,7 @@ AnalysisBasedWarnings::IssueWarnings(sema::AnalysisBasedWarnings::Policy P, const Stmt *Body = D->getBody(); 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 // explosion for destrutors that can result and the compile time hit. diff --git a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp index ae783230f6..d79ac04a23 100644 --- a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp +++ b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp @@ -526,7 +526,7 @@ void AnalysisConsumer::ActionExprEngine(Decl *D, bool ObjCGCEnabled, } // Execute the worklist algorithm. - Eng.ExecuteWorkList(Mgr->getAnalysisDeclContextManager().getStackFrame(D, 0), + Eng.ExecuteWorkList(Mgr->getAnalysisDeclContextManager().getStackFrame(D), Mgr->getMaxNodes()); // Release the auditor (if any) so that it doesn't monitor the graph -- 2.40.0