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
This commit is contained in:
Ted Kremenek 2009-01-23 20:52:26 +00:00
Родитель cabe66811f
Коммит 491918ee2f
4 изменённых файлов: 27 добавлений и 12 удалений

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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

Просмотреть файл

@ -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);
}
}

Просмотреть файл

@ -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;
}