[cfe-commits] r58766 - /cfe/trunk/Driver/AnalysisConsumer.cpp
Ted Kremenek
kremenek at apple.com
Wed Nov 5 11:05:07 PST 2008
Author: kremenek
Date: Wed Nov 5 13:05:06 2008
New Revision: 58766
URL: http://llvm.org/viewvc/llvm-project?rev=58766&view=rev
Log:
AnalysisManager can now be used to for analyses over TranslationUnits.
Modified:
cfe/trunk/Driver/AnalysisConsumer.cpp
Modified: cfe/trunk/Driver/AnalysisConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/AnalysisConsumer.cpp?rev=58766&r1=58765&r2=58766&view=diff
==============================================================================
--- cfe/trunk/Driver/AnalysisConsumer.cpp (original)
+++ cfe/trunk/Driver/AnalysisConsumer.cpp Wed Nov 5 13:05:06 2008
@@ -112,8 +112,11 @@
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 @@
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) {
More information about the cfe-commits
mailing list