@@ -128,7 +128,6 @@ class AnalysisConsumer : public AnalysisASTConsumer,
128128 std::unique_ptr<llvm::Timer> SyntaxCheckTimer;
129129 std::unique_ptr<llvm::Timer> ExprEngineTimer;
130130 std::unique_ptr<llvm::Timer> BugReporterTimer;
131- bool ShouldClearTimersToPreventDisplayingThem;
132131
133132 // / The information about analyzed functions shared throughout the
134133 // / translation unit.
@@ -149,7 +148,10 @@ class AnalysisConsumer : public AnalysisASTConsumer,
149148 if (Opts.AnalyzerDisplayProgress || Opts.PrintStats ||
150149 Opts.ShouldSerializeStats || !Opts.DumpEntryPointStatsToCSV .empty ()) {
151150 AnalyzerTimers = std::make_unique<llvm::TimerGroup>(
152- " analyzer" , " Analyzer timers" );
151+ " analyzer" , " Analyzer timers" ,
152+ /* PrintOnExit=*/
153+ (Opts.AnalyzerDisplayProgress || Opts.PrintStats ||
154+ Opts.ShouldSerializeStats ));
153155 SyntaxCheckTimer = std::make_unique<llvm::Timer>(
154156 " syntaxchecks" , " Syntax-based analysis time" , *AnalyzerTimers);
155157 ExprEngineTimer = std::make_unique<llvm::Timer>(
@@ -159,12 +161,6 @@ class AnalysisConsumer : public AnalysisASTConsumer,
159161 *AnalyzerTimers);
160162 }
161163
162- // Avoid displaying the timers created above in case we only want to record
163- // per-entry-point stats.
164- ShouldClearTimersToPreventDisplayingThem = !Opts.AnalyzerDisplayProgress &&
165- !Opts.PrintStats &&
166- !Opts.ShouldSerializeStats ;
167-
168164 if (Opts.PrintStats || Opts.ShouldSerializeStats ) {
169165 llvm::EnableStatistics (/* DoPrintOnExit= */ false );
170166 }
@@ -287,9 +283,6 @@ class AnalysisConsumer : public AnalysisASTConsumer,
287283 checkerMgr->runCheckersOnASTDecl (D, *Mgr, *RecVisitorBR);
288284 if (SyntaxCheckTimer)
289285 SyntaxCheckTimer->stopTimer ();
290- if (AnalyzerTimers && ShouldClearTimersToPreventDisplayingThem) {
291- AnalyzerTimers->clear ();
292- }
293286 }
294287 return true ;
295288 }
@@ -583,9 +576,6 @@ void AnalysisConsumer::runAnalysisOnTranslationUnit(ASTContext &C) {
583576 checkerMgr->runCheckersOnASTDecl (TU, *Mgr, BR);
584577 if (SyntaxCheckTimer)
585578 SyntaxCheckTimer->stopTimer ();
586- if (AnalyzerTimers && ShouldClearTimersToPreventDisplayingThem) {
587- AnalyzerTimers->clear ();
588- }
589579
590580 // Run the AST-only checks using the order in which functions are defined.
591581 // If inlining is not turned on, use the simplest function order for path
@@ -765,9 +755,6 @@ void AnalysisConsumer::HandleCode(Decl *D, AnalysisMode Mode,
765755 FunctionSummaries.findOrInsertSummary (D)->second .SyntaxRunningTime =
766756 std::lround (CheckerDuration.getWallTime () * 1000 );
767757 DisplayTime (CheckerDuration);
768- if (AnalyzerTimers && ShouldClearTimersToPreventDisplayingThem) {
769- AnalyzerTimers->clear ();
770- }
771758 }
772759 }
773760
@@ -830,9 +817,6 @@ void AnalysisConsumer::RunPathSensitiveChecks(Decl *D,
830817 PathRunningTime.set (static_cast <unsigned >(
831818 std::lround (ExprEngineDuration.getWallTime () * 1000 )));
832819 DisplayTime (ExprEngineDuration);
833- if (AnalyzerTimers && ShouldClearTimersToPreventDisplayingThem) {
834- AnalyzerTimers->clear ();
835- }
836820 }
837821
838822 if (!Mgr->options .DumpExplodedGraphTo .empty ())
@@ -843,9 +827,6 @@ void AnalysisConsumer::RunPathSensitiveChecks(Decl *D,
843827 Eng.ViewGraph (Mgr->options .TrimGraph );
844828
845829 flushReports (BugReporterTimer.get (), Eng.getBugReporter ());
846- if (AnalyzerTimers && ShouldClearTimersToPreventDisplayingThem) {
847- AnalyzerTimers->clear ();
848- }
849830}
850831
851832// ===----------------------------------------------------------------------===//
0 commit comments