From 6b77ce8824cf62c2cfb61cf2d801eb3fcfbecffe Mon Sep 17 00:00:00 2001 From: Anna Zaks Date: Thu, 5 Apr 2012 02:10:21 +0000 Subject: [PATCH] [analyzer] Move stats calculation out of AnalysisConsumer destructor. The ASTConsumer does not get deleted with clang --analyze (for performance reasons), we still want the diagnostics to work. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154078 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp index df2d265cad..756ef32615 100644 --- a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp +++ b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp @@ -125,13 +125,6 @@ public: } ~AnalysisConsumer() { - // Count how many basic blocks we have not covered. - NumBlocksInAnalyzedFunctions = FunctionSummaries.getTotalNumBasicBlocks(); - if (NumBlocksInAnalyzedFunctions > 0) - PercentReachableBlocks = - (FunctionSummaries.getTotalNumVisitedBasicBlocks() * 100) / - NumBlocksInAnalyzedFunctions; - if (Opts.PrintStats) delete TUTotalTimer; } @@ -383,6 +376,14 @@ void AnalysisConsumer::HandleTranslationUnit(ASTContext &C) { Mgr.reset(NULL); if (TUTotalTimer) TUTotalTimer->stopTimer(); + + // Count how many basic blocks we have not covered. + NumBlocksInAnalyzedFunctions = FunctionSummaries.getTotalNumBasicBlocks(); + if (NumBlocksInAnalyzedFunctions > 0) + PercentReachableBlocks = + (FunctionSummaries.getTotalNumVisitedBasicBlocks() * 100) / + NumBlocksInAnalyzedFunctions; + } static void FindBlocks(DeclContext *D, SmallVectorImpl &WL) { -- 2.40.0