]> granicus.if.org Git - clang/commitdiff
Added clang option '--analyzer-display-progress' to indicate that the analyzer should...
authorTed Kremenek <kremenek@apple.com>
Fri, 23 Jan 2009 20:52:26 +0000 (20:52 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 23 Jan 2009 20:52:26 +0000 (20:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62875 91177308-0d34-0410-b5e6-96231b3b80d8

Driver/AnalysisConsumer.cpp
Driver/AnalysisConsumer.h
Driver/clang.cpp
utils/ccc-analyzer

index 236cc1d865dcfe3087e1907cf7797b69424c449f..4dab9c7b4bc10741ea8a9415dc5076e716a6a846 100644 (file)
@@ -86,6 +86,7 @@ namespace {
     bool AnalyzeAll;  
     AnalysisStores SM;
     AnalysisDiagClients DC;
+    const bool DisplayProgress;
 
     AnalysisConsumer(Diagnostic &diags, Preprocessor* pp,
                      PreprocessorFactory* ppf,
@@ -93,13 +94,15 @@ namespace {
                      const std::string& fname,
                      const std::string& htmldir,
                      AnalysisStores sm, AnalysisDiagClients dc,
-                     bool visgraphviz, bool visubi, bool trim, bool analyzeAll)
+                     bool visgraphviz, bool visubi, bool trim, bool analyzeAll,
+                     bool displayProgress)
       : VisGraphviz(visgraphviz), VisUbigraph(visubi), TrimGraph(trim),
         LOpts(lopts), Diags(diags),
         Ctx(0), PP(pp), PPF(ppf),
         HTMLDir(htmldir),
         FName(fname),
-        AnalyzeAll(analyzeAll), SM(sm), DC(dc) {}
+        AnalyzeAll(analyzeAll), SM(sm), DC(dc),
+        DisplayProgress(displayProgress) {}
     
     void addCodeAction(CodeAction action) {
       FunctionActions.push_back(action);
@@ -143,13 +146,16 @@ namespace {
     ConstraintManagerCreator CreateConstraintMgr;
 
   public:
-    AnalysisManager(AnalysisConsumer& c, Decl* d, Stmt* b) 
-      : D(d), Body(b), TU(0), AScope(ScopeDecl), C(c), DisplayedFunction(false){
+    AnalysisManager(AnalysisConsumer& c, Decl* d, Stmt* b, bool displayProgress) 
+      : D(d), Body(b), TU(0), AScope(ScopeDecl), C(c), 
+        DisplayedFunction(!displayProgress) {
       setManagerCreators();
     }
     
-    AnalysisManager(AnalysisConsumer& c, TranslationUnit* tu) 
-      : D(0), Body(0), TU(tu), AScope(ScopeTU), C(c), DisplayedFunction(false) {
+    AnalysisManager(AnalysisConsumer& c, TranslationUnit* tu,
+                    bool displayProgress) 
+      : D(0), Body(0), TU(tu), AScope(ScopeTU), C(c),
+        DisplayedFunction(!displayProgress) {
       setManagerCreators();
     }
     
@@ -347,7 +353,7 @@ void AnalysisConsumer::HandleTopLevelDecl(Decl *D) {
 void AnalysisConsumer::HandleTranslationUnit(TranslationUnit& TU) {
 
   if(!TranslationUnitActions.empty()) {
-    AnalysisManager mgr(*this, &TU);
+    AnalysisManager mgr(*this, &TU, DisplayProgress);
     for (Actions::iterator I = TranslationUnitActions.begin(), 
          E = TranslationUnitActions.end(); I != E; ++I)
       (*I)(mgr);  
@@ -382,7 +388,7 @@ void AnalysisConsumer::HandleCode(Decl* D, Stmt* Body, Actions actions) {
 
   // Create an AnalysisManager that will manage the state for analyzing
   // this method/function.
-  AnalysisManager mgr(*this, D, Body);
+  AnalysisManager mgr(*this, D, Body, DisplayProgress);
   
   // Dispatch on the actions.  
   for (Actions::iterator I = actions.begin(), E = actions.end(); I != E; ++I)
@@ -544,11 +550,13 @@ ASTConsumer* clang::CreateAnalysisConsumer(Analyses* Beg, Analyses* End,
                                            const std::string& htmldir,
                                            bool VisGraphviz, bool VisUbi,
                                            bool trim,
-                                           bool analyzeAll) {
+                                           bool analyzeAll,
+                                           bool displayProgress) {
   
   llvm::OwningPtr<AnalysisConsumer>
   C(new AnalysisConsumer(diags, pp, ppf, lopts, fname, htmldir, SM, DC,
-                         VisGraphviz, VisUbi, trim, analyzeAll));
+                         VisGraphviz, VisUbi, trim, analyzeAll,
+                         displayProgress));
   
   for ( ; Beg != End ; ++Beg)
     switch (*Beg) {
index 1e0824022062906951932da807ba38f6ee3b60a5..eb349be24053e21f5682f110e1ccbce9ea37ab2b 100644 (file)
@@ -44,7 +44,8 @@ ASTConsumer* CreateAnalysisConsumer(Analyses* Beg, Analyses* End,
                                     bool VisualizeGraphViz,
                                     bool VisualizeUbi,
                                     bool VizTrimGraph,                                    
-                                    bool AnalyzeAll);
+                                    bool AnalyzeAll,
+                                    bool DisplayProgress);
 } // end clang namespace
 
 #endif
index cc3788b5f3f71260546b5856579153ef35dca9b1..d7c8beb1d39ffcc810d19499c5f7cacd656155af 100644 (file)
@@ -218,6 +218,10 @@ AnalyzeAll("analyzer-opt-analyze-headers",
     llvm::cl::desc("Force the static analyzer to analyze "
                    "functions defined in header files"));
 
+static llvm::cl::opt<bool>
+AnalyzerDisplayProgress("analyzer-display-progress",
+          llvm::cl::desc("Emit verbose output about the analyzer's progress."));
+
 static llvm::cl::list<Analyses>
 AnalysisList(llvm::cl::desc("SCA Checks/Analyses:"),
 llvm::cl::values(
@@ -1313,7 +1317,8 @@ static ASTConsumer* CreateASTConsumer(const std::string& InFile,
                                     Diag, PP, PPF, LangOpts,
                                     AnalyzeSpecificFunction,
                                     OutputFile, VisualizeEGDot, VisualizeEGUbi,
-                                    TrimGraph, AnalyzeAll);
+                                    TrimGraph, AnalyzeAll,
+                                    AnalyzerDisplayProgress);
   }
 }
 
index 68df56a38eae79da77708071e098f8c8d4d4949b..6c5e700ae4f6dded061a4d2e5e311e09b183def4 100755 (executable)
@@ -100,6 +100,7 @@ sub Analyze {
     push @CmdArgs,@$Args;
     @CmdArgsSansAnalyses = @CmdArgs;
     push @CmdArgs,'--analyze';
+    push @CmdArgs,"--analyzer-display-progress";
     push @CmdArgs,(split /\s/,$Analyses);
     $RunAnalyzer = 1;
   }