From: Anna Zaks Date: Thu, 5 Apr 2012 02:10:21 +0000 (+0000) Subject: [analyzer] Move stats calculation out of AnalysisConsumer destructor. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6b77ce8824cf62c2cfb61cf2d801eb3fcfbecffe;p=clang [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 --- 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) {