diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-11-05 19:05:06 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-11-05 19:05:06 +0000 |
commit | f304ddcf6bfbcb63b9d0b1f49569daa8c75fa9c5 (patch) | |
tree | f12f13cf9b03f4743a2033bf63acaafe0d1c78cc /Driver/AnalysisConsumer.cpp | |
parent | 4e84935b299f2572601419692f1f2e84def685e7 (diff) |
AnalysisManager can now be used to for analyses over TranslationUnits.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58766 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/AnalysisConsumer.cpp')
-rw-r--r-- | Driver/AnalysisConsumer.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/Driver/AnalysisConsumer.cpp b/Driver/AnalysisConsumer.cpp index 5f338c8af5..f01a755988 100644 --- a/Driver/AnalysisConsumer.cpp +++ b/Driver/AnalysisConsumer.cpp @@ -112,8 +112,11 @@ namespace { class VISIBILITY_HIDDEN AnalysisManager : public BugReporterData { - Decl* D; - Stmt* Body; + Decl* D; Stmt* Body; + TranslationUnit* TU; + + enum AnalysisScope { ScopeTU, ScopeDecl } AScope; + AnalysisConsumer& C; bool DisplayedFunction; @@ -123,11 +126,25 @@ namespace { public: AnalysisManager(AnalysisConsumer& c, Decl* d, Stmt* b) - : D(d), Body(b), C(c), DisplayedFunction(false) {} + : D(d), Body(b), TU(0), AScope(ScopeDecl), C(c), DisplayedFunction(false) {} + + AnalysisManager(AnalysisConsumer& c, TranslationUnit* tu) + : D(0), Body(0), TU(tu), AScope(ScopeTU), C(c), DisplayedFunction(false) {} + Decl* getCodeDecl() const { + assert (AScope == ScopeDecl); + return D; + } + + Stmt* getBody() const { + assert (AScope == ScopeDecl); + return Body; + } - Decl* getCodeDecl() const { return D; } - Stmt* getBody() const { return Body; } + TranslationUnit* getTranslationUnit() const { + assert (AScope == ScopeTU); + return TU; + } GRStateManager::StoreManagerCreator getStoreManagerCreator() { switch (C.SM) { |