From: Ted Kremenek Date: Fri, 23 Jan 2009 20:52:26 +0000 (+0000) Subject: Added clang option '--analyzer-display-progress' to indicate that the analyzer should... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=491918ee2fdd7193fad36b0a539151e5eb3fc332;p=clang Added clang option '--analyzer-display-progress' to indicate that the analyzer should output 'ANALYZE:' messages to display its progress on a source file. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62875 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Driver/AnalysisConsumer.cpp b/Driver/AnalysisConsumer.cpp index 236cc1d865..4dab9c7b4b 100644 --- a/Driver/AnalysisConsumer.cpp +++ b/Driver/AnalysisConsumer.cpp @@ -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 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) { diff --git a/Driver/AnalysisConsumer.h b/Driver/AnalysisConsumer.h index 1e08240220..eb349be240 100644 --- a/Driver/AnalysisConsumer.h +++ b/Driver/AnalysisConsumer.h @@ -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 diff --git a/Driver/clang.cpp b/Driver/clang.cpp index cc3788b5f3..d7c8beb1d3 100644 --- a/Driver/clang.cpp +++ b/Driver/clang.cpp @@ -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 +AnalyzerDisplayProgress("analyzer-display-progress", + llvm::cl::desc("Emit verbose output about the analyzer's progress.")); + static llvm::cl::list 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); } } diff --git a/utils/ccc-analyzer b/utils/ccc-analyzer index 68df56a38e..6c5e700ae4 100755 --- a/utils/ccc-analyzer +++ b/utils/ccc-analyzer @@ -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; }