aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2012-04-05 02:10:21 +0000
committerAnna Zaks <ganna@apple.com>2012-04-05 02:10:21 +0000
commit6b77ce8824cf62c2cfb61cf2d801eb3fcfbecffe (patch)
treec5c07dc102b2751db6a19306c4ccb8e6a604c984 /lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
parent907344e4977ac704f248d82ef235b88be08584d5 (diff)
[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
Diffstat (limited to 'lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp')
-rw-r--r--lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp15
1 files 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<Decl*> &WL) {