diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-10-24 01:32:45 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-10-24 01:32:45 +0000 |
commit | 1d26f48dc2eea1c07431ca1519d7034a21b9bcff (patch) | |
tree | 41d69b4ac2473036f1dcccf82fe01922e94f6de2 /lib | |
parent | 0b64ba926752110cff1344a46b36e29396cc4d25 (diff) |
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
Diffstat (limited to 'lib')
24 files changed, 105 insertions, 105 deletions
diff --git a/lib/Analysis/AnalysisContext.cpp b/lib/Analysis/AnalysisContext.cpp index 424917eba9..680f2c4050 100644 --- a/lib/Analysis/AnalysisContext.cpp +++ b/lib/Analysis/AnalysisContext.cpp @@ -1,4 +1,4 @@ -//== AnalysisContext.cpp - Analysis context for Path Sens analysis -*- C++ -*-// +//== AnalysisDeclContext.cpp - Analysis context for Path Sens analysis -*- C++ -*-// // // The LLVM Compiler Infrastructure // @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// // -// This file defines AnalysisContext, a class that manages the analysis context +// This file defines AnalysisDeclContext, a class that manages the analysis context // data for path sensitive analysis. // //===----------------------------------------------------------------------===// @@ -32,7 +32,7 @@ using namespace clang; typedef llvm::DenseMap<const void *, ManagedAnalysis *> ManagedAnalysisMap; -AnalysisContext::AnalysisContext(AnalysisContextManager *Mgr, +AnalysisDeclContext::AnalysisDeclContext(AnalysisDeclContextManager *Mgr, const Decl *d, idx::TranslationUnit *tu, const CFG::BuildOptions &buildOptions) @@ -49,7 +49,7 @@ AnalysisContext::AnalysisContext(AnalysisContextManager *Mgr, cfgBuildOptions.forcedBlkExprs = &forcedBlkExprs; } -AnalysisContext::AnalysisContext(AnalysisContextManager *Mgr, +AnalysisDeclContext::AnalysisDeclContext(AnalysisDeclContextManager *Mgr, const Decl *d, idx::TranslationUnit *tu) : Manager(Mgr), @@ -64,7 +64,7 @@ AnalysisContext::AnalysisContext(AnalysisContextManager *Mgr, cfgBuildOptions.forcedBlkExprs = &forcedBlkExprs; } -AnalysisContextManager::AnalysisContextManager(bool useUnoptimizedCFG, +AnalysisDeclContextManager::AnalysisDeclContextManager(bool useUnoptimizedCFG, bool addImplicitDtors, bool addInitializers) { cfgBuildOptions.PruneTriviallyFalseEdges = !useUnoptimizedCFG; @@ -72,13 +72,13 @@ AnalysisContextManager::AnalysisContextManager(bool useUnoptimizedCFG, cfgBuildOptions.AddInitializers = addInitializers; } -void AnalysisContextManager::clear() { +void AnalysisDeclContextManager::clear() { for (ContextMap::iterator I = Contexts.begin(), E = Contexts.end(); I!=E; ++I) delete I->second; Contexts.clear(); } -Stmt *AnalysisContext::getBody() const { +Stmt *AnalysisDeclContext::getBody() const { if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) return FD->getBody(); else if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) @@ -92,14 +92,14 @@ Stmt *AnalysisContext::getBody() const { llvm_unreachable("unknown code decl"); } -const ImplicitParamDecl *AnalysisContext::getSelfDecl() const { +const ImplicitParamDecl *AnalysisDeclContext::getSelfDecl() const { if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) return MD->getSelfDecl(); return NULL; } -void AnalysisContext::registerForcedBlockExpression(const Stmt *stmt) { +void AnalysisDeclContext::registerForcedBlockExpression(const Stmt *stmt) { if (!forcedBlkExprs) forcedBlkExprs = new CFG::BuildOptions::ForcedBlkExprs(); // Default construct an entry for 'stmt'. @@ -109,7 +109,7 @@ void AnalysisContext::registerForcedBlockExpression(const Stmt *stmt) { } const CFGBlock * -AnalysisContext::getBlockForRegisteredExpression(const Stmt *stmt) { +AnalysisDeclContext::getBlockForRegisteredExpression(const Stmt *stmt) { assert(forcedBlkExprs); if (const Expr *e = dyn_cast<Expr>(stmt)) stmt = e->IgnoreParens(); @@ -119,7 +119,7 @@ AnalysisContext::getBlockForRegisteredExpression(const Stmt *stmt) { return itr->second; } -CFG *AnalysisContext::getCFG() { +CFG *AnalysisDeclContext::getCFG() { if (!cfgBuildOptions.PruneTriviallyFalseEdges) return getUnoptimizedCFG(); @@ -133,7 +133,7 @@ CFG *AnalysisContext::getCFG() { return cfg.get(); } -CFG *AnalysisContext::getUnoptimizedCFG() { +CFG *AnalysisDeclContext::getUnoptimizedCFG() { if (!builtCompleteCFG) { SaveAndRestore<bool> NotPrune(cfgBuildOptions.PruneTriviallyFalseEdges, false); @@ -146,7 +146,7 @@ CFG *AnalysisContext::getUnoptimizedCFG() { return completeCFG.get(); } -CFGStmtMap *AnalysisContext::getCFGStmtMap() { +CFGStmtMap *AnalysisDeclContext::getCFGStmtMap() { if (cfgStmtMap) return cfgStmtMap.get(); @@ -158,7 +158,7 @@ CFGStmtMap *AnalysisContext::getCFGStmtMap() { return 0; } -CFGReverseBlockReachabilityAnalysis *AnalysisContext::getCFGReachablityAnalysis() { +CFGReverseBlockReachabilityAnalysis *AnalysisDeclContext::getCFGReachablityAnalysis() { if (CFA) return CFA.get(); @@ -170,39 +170,39 @@ CFGReverseBlockReachabilityAnalysis *AnalysisContext::getCFGReachablityAnalysis( return 0; } -void AnalysisContext::dumpCFG() { +void AnalysisDeclContext::dumpCFG() { getCFG()->dump(getASTContext().getLangOptions()); } -ParentMap &AnalysisContext::getParentMap() { +ParentMap &AnalysisDeclContext::getParentMap() { if (!PM) PM.reset(new ParentMap(getBody())); return *PM; } -PseudoConstantAnalysis *AnalysisContext::getPseudoConstantAnalysis() { +PseudoConstantAnalysis *AnalysisDeclContext::getPseudoConstantAnalysis() { if (!PCA) PCA.reset(new PseudoConstantAnalysis(getBody())); return PCA.get(); } -AnalysisContext *AnalysisContextManager::getContext(const Decl *D, +AnalysisDeclContext *AnalysisDeclContextManager::getContext(const Decl *D, idx::TranslationUnit *TU) { - AnalysisContext *&AC = Contexts[D]; + AnalysisDeclContext *&AC = Contexts[D]; if (!AC) - AC = new AnalysisContext(this, D, TU, cfgBuildOptions); + AC = new AnalysisDeclContext(this, D, TU, cfgBuildOptions); return AC; } const StackFrameContext * -AnalysisContext::getStackFrame(LocationContext const *Parent, const Stmt *S, +AnalysisDeclContext::getStackFrame(LocationContext const *Parent, const Stmt *S, const CFGBlock *Blk, unsigned Idx) { return getLocationContextManager().getStackFrame(this, Parent, S, Blk, Idx); } -LocationContextManager & AnalysisContext::getLocationContextManager() { +LocationContextManager & AnalysisDeclContext::getLocationContextManager() { assert(Manager && - "Cannot create LocationContexts without an AnalysisContextManager!"); + "Cannot create LocationContexts without an AnalysisDeclContextManager!"); return Manager->getLocationContextManager(); } @@ -212,7 +212,7 @@ LocationContextManager & AnalysisContext::getLocationContextManager() { void LocationContext::ProfileCommon(llvm::FoldingSetNodeID &ID, ContextKind ck, - AnalysisContext *ctx, + AnalysisDeclContext *ctx, const LocationContext *parent, const void *data) { ID.AddInteger(ck); @@ -222,15 +222,15 @@ void LocationContext::ProfileCommon(llvm::FoldingSetNodeID &ID, } void StackFrameContext::Profile(llvm::FoldingSetNodeID &ID) { - Profile(ID, getAnalysisContext(), getParent(), CallSite, Block, Index); + Profile(ID, getAnalysisDeclContext(), getParent(), CallSite, Block, Index); } void ScopeContext::Profile(llvm::FoldingSetNodeID &ID) { - Profile(ID, getAnalysisContext(), getParent(), Enter); + Profile(ID, getAnalysisDeclContext(), getParent(), Enter); } void BlockInvocationContext::Profile(llvm::FoldingSetNodeID &ID) { - Profile(ID, getAnalysisContext(), getParent(), BD); + Profile(ID, getAnalysisDeclContext(), getParent(), BD); } //===----------------------------------------------------------------------===// @@ -239,7 +239,7 @@ void BlockInvocationContext::Profile(llvm::FoldingSetNodeID &ID) { template <typename LOC, typename DATA> const LOC* -LocationContextManager::getLocationContext(AnalysisContext *ctx, +LocationContextManager::getLocationContext(AnalysisDeclContext *ctx, const LocationContext *parent, const DATA *d) { llvm::FoldingSetNodeID ID; @@ -256,7 +256,7 @@ LocationContextManager::getLocationContext(AnalysisContext *ctx, } const StackFrameContext* -LocationContextManager::getStackFrame(AnalysisContext *ctx, +LocationContextManager::getStackFrame(AnalysisDeclContext *ctx, const LocationContext *parent, const Stmt *s, const CFGBlock *blk, unsigned idx) { @@ -273,7 +273,7 @@ LocationContextManager::getStackFrame(AnalysisContext *ctx, } const ScopeContext * -LocationContextManager::getScope(AnalysisContext *ctx, +LocationContextManager::getScope(AnalysisDeclContext *ctx, const LocationContext *parent, const Stmt *s) { return getLocationContext<ScopeContext, Stmt>(ctx, parent, s); @@ -395,9 +395,9 @@ static DeclVec* LazyInitializeReferencedDecls(const BlockDecl *BD, return BV; } -std::pair<AnalysisContext::referenced_decls_iterator, - AnalysisContext::referenced_decls_iterator> -AnalysisContext::getReferencedBlockVars(const BlockDecl *BD) { +std::pair<AnalysisDeclContext::referenced_decls_iterator, + AnalysisDeclContext::referenced_decls_iterator> +AnalysisDeclContext::getReferencedBlockVars(const BlockDecl *BD) { if (!ReferencedBlockVars) ReferencedBlockVars = new llvm::DenseMap<const BlockDecl*,void*>(); @@ -405,7 +405,7 @@ AnalysisContext::getReferencedBlockVars(const BlockDecl *BD) { return std::make_pair(V->begin(), V->end()); } -ManagedAnalysis *&AnalysisContext::getAnalysisImpl(const void *tag) { +ManagedAnalysis *&AnalysisDeclContext::getAnalysisImpl(const void *tag) { if (!ManagedAnalyses) ManagedAnalyses = new ManagedAnalysisMap(); ManagedAnalysisMap *M = (ManagedAnalysisMap*) ManagedAnalyses; @@ -418,7 +418,7 @@ ManagedAnalysis *&AnalysisContext::getAnalysisImpl(const void *tag) { ManagedAnalysis::~ManagedAnalysis() {} -AnalysisContext::~AnalysisContext() { +AnalysisDeclContext::~AnalysisDeclContext() { delete forcedBlkExprs; delete ReferencedBlockVars; // Release the managed analyses. @@ -430,7 +430,7 @@ AnalysisContext::~AnalysisContext() { } } -AnalysisContextManager::~AnalysisContextManager() { +AnalysisDeclContextManager::~AnalysisDeclContextManager() { for (ContextMap::iterator I = Contexts.begin(), E = Contexts.end(); I!=E; ++I) delete I->second; } diff --git a/lib/Analysis/CMakeLists.txt b/lib/Analysis/CMakeLists.txt index e4b7ab8c94..7ad14c41eb 100644 --- a/lib/Analysis/CMakeLists.txt +++ b/lib/Analysis/CMakeLists.txt @@ -1,7 +1,7 @@ set(LLVM_USED_LIBS clangBasic clangAST clangIndex) add_clang_library(clangAnalysis - AnalysisContext.cpp + AnalysisDeclContext.cpp CFG.cpp CFGReachabilityAnalysis.cpp CFGStmtMap.cpp diff --git a/lib/Analysis/LiveVariables.cpp b/lib/Analysis/LiveVariables.cpp index c0912b0227..194c03cd0a 100644 --- a/lib/Analysis/LiveVariables.cpp +++ b/lib/Analysis/LiveVariables.cpp @@ -22,7 +22,7 @@ class DataflowWorklist { llvm::BitVector enqueuedBlocks; PostOrderCFGView *POV; public: - DataflowWorklist(const CFG &cfg, AnalysisContext &Ctx) + DataflowWorklist(const CFG &cfg, AnalysisDeclContext &Ctx) : enqueuedBlocks(cfg.getNumBlockIDs()), POV(Ctx.getAnalysis<PostOrderCFGView>()) {} @@ -86,7 +86,7 @@ const CFGBlock *DataflowWorklist::dequeue() { namespace { class LiveVariablesImpl { public: - AnalysisContext &analysisContext; + AnalysisDeclContext &analysisContext; std::vector<LiveVariables::LivenessValues> cfgBlockValues; llvm::ImmutableSet<const Stmt *>::Factory SSetFact; llvm::ImmutableSet<const VarDecl *>::Factory DSetFact; @@ -106,7 +106,7 @@ public: void dumpBlockLiveness(const SourceManager& M); - LiveVariablesImpl(AnalysisContext &ac, bool KillAtAssign) + LiveVariablesImpl(AnalysisDeclContext &ac, bool KillAtAssign) : analysisContext(ac), SSetFact(false), // Do not canonicalize ImmutableSets by default. DSetFact(false), // This is a *major* performance win. @@ -323,7 +323,7 @@ void TransferFunctions::VisitBinaryOperator(BinaryOperator *B) { } void TransferFunctions::VisitBlockExpr(BlockExpr *BE) { - AnalysisContext::referenced_decls_iterator I, E; + AnalysisDeclContext::referenced_decls_iterator I, E; llvm::tie(I, E) = LV.analysisContext.getReferencedBlockVars(BE->getBlockDecl()); for ( ; I != E ; ++I) { @@ -447,7 +447,7 @@ LiveVariables::~LiveVariables() { } LiveVariables * -LiveVariables::computeLiveness(AnalysisContext &AC, +LiveVariables::computeLiveness(AnalysisDeclContext &AC, bool killAtAssign) { // No CFG? Bail out. diff --git a/lib/Analysis/PostOrderCFGView.cpp b/lib/Analysis/PostOrderCFGView.cpp index fed0e38bb5..311423f285 100644 --- a/lib/Analysis/PostOrderCFGView.cpp +++ b/lib/Analysis/PostOrderCFGView.cpp @@ -26,7 +26,7 @@ PostOrderCFGView::PostOrderCFGView(const CFG *cfg) { } } -PostOrderCFGView *PostOrderCFGView::create(AnalysisContext &ctx) { +PostOrderCFGView *PostOrderCFGView::create(AnalysisDeclContext &ctx) { const CFG *cfg = ctx.getCFG(); if (!cfg) return 0; diff --git a/lib/Analysis/ReachableCode.cpp b/lib/Analysis/ReachableCode.cpp index 49317718c3..62575f9f23 100644 --- a/lib/Analysis/ReachableCode.cpp +++ b/lib/Analysis/ReachableCode.cpp @@ -287,7 +287,7 @@ unsigned ScanReachableFromBlock(const CFGBlock *Start, return count; } -void FindUnreachableCode(AnalysisContext &AC, Callback &CB) { +void FindUnreachableCode(AnalysisDeclContext &AC, Callback &CB) { CFG *cfg = AC.getCFG(); if (!cfg) return; diff --git a/lib/Analysis/ThreadSafety.cpp b/lib/Analysis/ThreadSafety.cpp index 3153c164b9..9c62d00e81 100644 --- a/lib/Analysis/ThreadSafety.cpp +++ b/lib/Analysis/ThreadSafety.cpp @@ -648,7 +648,7 @@ public: Lockset addLock(Lockset &LSet, Expr *MutexExp, const NamedDecl *D, LockKind LK, SourceLocation Loc); - void runAnalysis(AnalysisContext &AC); + void runAnalysis(AnalysisDeclContext &AC); }; /// \brief Compute the intersection of two locksets and issue warnings for any @@ -710,7 +710,7 @@ Lockset ThreadSafetyAnalyzer::addLock(Lockset &LSet, Expr *MutexExp, /// We traverse the blocks in the CFG, compute the set of mutexes that are held /// at the end of each block, and issue warnings for thread safety violations. /// Each block in the CFG is traversed exactly once. -void ThreadSafetyAnalyzer::runAnalysis(AnalysisContext &AC) { +void ThreadSafetyAnalyzer::runAnalysis(AnalysisDeclContext &AC) { CFG *CFGraph = AC.getCFG(); if (!CFGraph) return; const NamedDecl *D = dyn_cast_or_null<NamedDecl>(AC.getDecl()); @@ -869,7 +869,7 @@ namespace thread_safety { /// We traverse the blocks in the CFG, compute the set of mutexes that are held /// at the end of each block, and issue warnings for thread safety violations. /// Each block in the CFG is traversed exactly once. -void runThreadSafetyAnalysis(AnalysisContext &AC, +void runThreadSafetyAnalysis(AnalysisDeclContext &AC, ThreadSafetyHandler &Handler) { ThreadSafetyAnalyzer Analyzer(Handler); Analyzer.runAnalysis(AC); diff --git a/lib/Analysis/UninitializedValues.cpp b/lib/Analysis/UninitializedValues.cpp index 9e98560b65..86b96ce623 100644 --- a/lib/Analysis/UninitializedValues.cpp +++ b/lib/Analysis/UninitializedValues.cpp @@ -337,7 +337,7 @@ public: class TransferFunctions : public StmtVisitor<TransferFunctions> { CFGBlockValues &vals; const CFG &cfg; - AnalysisContext ∾ + AnalysisDeclContext ∾ UninitVariablesHandler *handler; /// The last DeclRefExpr seen when analyzing a block. Used to @@ -356,7 +356,7 @@ class TransferFunctions : public StmtVisitor<TransferFunctions> { public: TransferFunctions(CFGBlockValues &vals, const CFG &cfg, - AnalysisContext &ac, + AnalysisDeclContext &ac, UninitVariablesHandler *handler) : vals(vals), cfg(cfg), ac(ac), handler(handler), lastDR(0), lastLoad(0), @@ -615,7 +615,7 @@ void TransferFunctions::ProcessUses(Stmt *s) { //====------------------------------------------------------------------------// static bool runOnBlock(const CFGBlock *block, const CFG &cfg, - AnalysisContext &ac, CFGBlockValues &vals, + AnalysisDeclContext &ac, CFGBlockValues &vals, llvm::BitVector &wasAnalyzed, UninitVariablesHandler *handler = 0) { @@ -672,7 +672,7 @@ static bool runOnBlock(const CFGBlock *block, const CFG &cfg, void clang::runUninitializedVariablesAnalysis( const DeclContext &dc, const CFG &cfg, - AnalysisContext &ac, + AnalysisDeclContext &ac, UninitVariablesHandler &handler, UninitVariablesAnalysisStats &stats) { CFGBlockValues vals(cfg); diff --git a/lib/Sema/AnalysisBasedWarnings.cpp b/lib/Sema/AnalysisBasedWarnings.cpp index 647d61fbfe..8b2e269708 100644 --- a/lib/Sema/AnalysisBasedWarnings.cpp +++ b/lib/Sema/AnalysisBasedWarnings.cpp @@ -63,7 +63,7 @@ namespace { } /// CheckUnreachable - Check for unreachable code. -static void CheckUnreachable(Sema &S, AnalysisContext &AC) { +static void CheckUnreachable(Sema &S, AnalysisDeclContext &AC) { UnreachableCodeHandler UC(S); reachable_code::FindUnreachableCode(AC, UC); } @@ -89,7 +89,7 @@ enum ControlFlowKind { /// return. We assume NeverFallThrough iff we never fall off the end of the /// statement but we may return. We assume that functions not marked noreturn /// will return. -static ControlFlowKind CheckFallThrough(AnalysisContext &AC) { +static ControlFlowKind CheckFallThrough(AnalysisDeclContext &AC) { CFG *cfg = AC.getCFG(); if (cfg == 0) return UnknownFallThrough; @@ -312,7 +312,7 @@ struct CheckFallThroughDiagnostics { static void CheckFallThroughForBody(Sema &S, const Decl *D, const Stmt *Body, const BlockExpr *blkExpr, const CheckFallThroughDiagnostics& CD, - AnalysisContext &AC) { + AnalysisDeclContext &AC) { bool ReturnsVoid = false; bool HasNoReturn = false; @@ -830,7 +830,7 @@ AnalysisBasedWarnings::IssueWarnings(sema::AnalysisBasedWarnings::Policy P, const Stmt *Body = D->getBody(); assert(Body); - AnalysisContext AC(/* AnalysisContextManager */ 0, D, 0); + AnalysisDeclContext AC(/* AnalysisDeclContextManager */ 0, D, 0); // 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/Checkers/AnalyzerStatsChecker.cpp b/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp index cd977bf54c..66b3290f4e 100644 --- a/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp @@ -54,7 +54,7 @@ void AnalyzerStatsChecker::checkEndAnalysis(ExplodedGraph &G, // 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 bf7ba185b5..06899fc578 100644 --- a/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp +++ b/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp @@ -36,14 +36,14 @@ static bool isArc4RandomAvailable(const ASTContext &Ctx) { 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 @@ class SecuritySyntaxChecker : public Checker<check::ASTCodeBody> { 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 469be05fb7..55945e6c07 100644 --- a/lib/StaticAnalyzer/Checkers/CheckSizeofPointer.cpp +++ b/lib/StaticAnalyzer/Checkers/CheckSizeofPointer.cpp @@ -24,10 +24,10 @@ using namespace ento; 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 @@ class SizeofPointerChecker : public Checker<check::ASTCodeBody> { 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 901af43c5f..79c889d78a 100644 --- a/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp @@ -72,7 +72,7 @@ class DeadStoreObs : public LiveVariables::Observer { 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 @@ class DeadStoreObs : public LiveVariables::Observer { 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 @@ public: 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 5c257e595b..a3ebf0b750 100644 --- a/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp @@ -82,16 +82,16 @@ private: // 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 @@ void IdempotentOperationChecker::checkPreStmt(const BinaryOperator *B, // 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 @@ void IdempotentOperationChecker::checkEndAnalysis(ExplodedGraph &G, // 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 @@ bool IdempotentOperationChecker::isSelfAssign(const Expr *LHS, const Expr *RHS) // 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 @@ bool IdempotentOperationChecker::isTruncationExtensionAssignment( // 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 @@ IdempotentOperationChecker::pathWasCompletelyAnalyzed(AnalysisContext *AC, // 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 @@ bool IdempotentOperationChecker::CanVary(const Expr *Ex, // 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 cf5501a4ac..c9d315a32e 100644 --- a/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp @@ -205,7 +205,7 @@ void MallocOverflowSecurityChecker::OutputPossibleOverflows( // 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 2fb9944afa..8b29a20dc6 100644 --- a/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp @@ -194,7 +194,7 @@ void ObjCSelfInitChecker::checkPostObjCMessage(ObjCMessage msg, // 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 @@ void ObjCSelfInitChecker::checkPostStmt(const ObjCIvarRefExpr *E, CheckerContext &C) const { // FIXME: A callback should disable checkers at the start of functions. if (!shouldRunOnFunctionOrMethod(dyn_cast<NamedDecl>( - |