diff options
author | dim <dim@FreeBSD.org> | 2011-05-02 19:39:53 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2011-05-02 19:39:53 +0000 |
commit | 110eaaceddcec790f7e6a5e3bf1261c9aa1e73ab (patch) | |
tree | 64a10f4c4154739d4a8191d7e1b52ce497f4ebd6 /include/clang/Analysis/AnalysisContext.h | |
parent | a0fb00f9837bd0d2e5948f16f6a6b82a7a628f51 (diff) | |
download | FreeBSD-src-110eaaceddcec790f7e6a5e3bf1261c9aa1e73ab.zip FreeBSD-src-110eaaceddcec790f7e6a5e3bf1261c9aa1e73ab.tar.gz |
Vendor import of clang trunk r130700:
http://llvm.org/svn/llvm-project/cfe/trunk@130700
Diffstat (limited to 'include/clang/Analysis/AnalysisContext.h')
-rw-r--r-- | include/clang/Analysis/AnalysisContext.h | 60 |
1 files changed, 31 insertions, 29 deletions
diff --git a/include/clang/Analysis/AnalysisContext.h b/include/clang/Analysis/AnalysisContext.h index 8514514..66c12a5 100644 --- a/include/clang/Analysis/AnalysisContext.h +++ b/include/clang/Analysis/AnalysisContext.h @@ -17,6 +17,7 @@ #include "clang/AST/Decl.h" #include "clang/AST/Expr.h" +#include "clang/Analysis/CFG.h" #include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/PointerUnion.h" @@ -27,9 +28,7 @@ namespace clang { class Decl; class Stmt; -class CFG; -class CFGBlock; -class CFGReachabilityAnalysis; +class CFGReverseBlockReachabilityAnalysis; class CFGStmtMap; class LiveVariables; class ParentMap; @@ -48,33 +47,32 @@ class AnalysisContext { // TranslationUnit is NULL if we don't have multiple translation units. idx::TranslationUnit *TU; - // AnalysisContext owns the following data. - CFG *cfg, *completeCFG; - CFGStmtMap *cfgStmtMap; + llvm::OwningPtr<CFG> cfg, completeCFG; + llvm::OwningPtr<CFGStmtMap> cfgStmtMap; + + CFG::BuildOptions cfgBuildOptions; + CFG::BuildOptions::ForcedBlkExprs *forcedBlkExprs; + bool builtCFG, builtCompleteCFG; - LiveVariables *liveness; - LiveVariables *relaxedLiveness; - ParentMap *PM; - PseudoConstantAnalysis *PCA; - CFGReachabilityAnalysis *CFA; - llvm::DenseMap<const BlockDecl*,void*> *ReferencedBlockVars; + const bool useUnoptimizedCFG; + + llvm::OwningPtr<LiveVariables> liveness; + llvm::OwningPtr<LiveVariables> relaxedLiveness; + llvm::OwningPtr<ParentMap> PM; + llvm::OwningPtr<PseudoConstantAnalysis> PCA; + llvm::OwningPtr<CFGReverseBlockReachabilityAnalysis> CFA; + llvm::BumpPtrAllocator A; - bool UseUnoptimizedCFG; - bool AddEHEdges; - bool AddImplicitDtors; - bool AddInitializers; + + // FIXME: remove. + llvm::DenseMap<const BlockDecl*,void*> *ReferencedBlockVars; + public: AnalysisContext(const Decl *d, idx::TranslationUnit *tu, bool useUnoptimizedCFG = false, bool addehedges = false, bool addImplicitDtors = false, - bool addInitializers = false) - : D(d), TU(tu), cfg(0), completeCFG(0), cfgStmtMap(0), - builtCFG(false), builtCompleteCFG(false), - liveness(0), relaxedLiveness(0), PM(0), PCA(0), CFA(0), - ReferencedBlockVars(0), UseUnoptimizedCFG(useUnoptimizedCFG), - AddEHEdges(addehedges), AddImplicitDtors(addImplicitDtors), - AddInitializers(addInitializers) {} + bool addInitializers = false); ~AnalysisContext(); @@ -87,18 +85,22 @@ public: /// callExprs. If this is false, then try/catch statements and blocks /// reachable from them can appear to be dead in the CFG, analysis passes must /// cope with that. - bool getAddEHEdges() const { return AddEHEdges; } - - bool getUseUnoptimizedCFG() const { return UseUnoptimizedCFG; } - bool getAddImplicitDtors() const { return AddImplicitDtors; } - bool getAddInitializers() const { return AddInitializers; } + bool getAddEHEdges() const { return cfgBuildOptions.AddEHEdges; } + bool getUseUnoptimizedCFG() const { + return cfgBuildOptions.PruneTriviallyFalseEdges; + } + bool getAddImplicitDtors() const { return cfgBuildOptions.AddImplicitDtors; } + bool getAddInitializers() const { return cfgBuildOptions.AddInitializers; } + void registerForcedBlockExpression(const Stmt *stmt); + const CFGBlock *getBlockForRegisteredExpression(const Stmt *stmt); + Stmt *getBody(); CFG *getCFG(); CFGStmtMap *getCFGStmtMap(); - CFGReachabilityAnalysis *getCFGReachablityAnalysis(); + CFGReverseBlockReachabilityAnalysis *getCFGReachablityAnalysis(); /// Return a version of the CFG without any edges pruned. CFG *getUnoptimizedCFG(); |