summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2012-03-28 17:05:46 +0000
committerAnna Zaks <ganna@apple.com>2012-03-28 17:05:46 +0000
commit8293bae850d06b35d61ec10039d3d0fdabae481b (patch)
tree8e08a2ea53c7463784b120d3043522fc49fe8a8e /clang/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp
parent148ebb8802ebc1b476d6df9e9b1e10fa558d4aca (diff)
downloadbcm5719-llvm-8293bae850d06b35d61ec10039d3d0fdabae481b.tar.gz
bcm5719-llvm-8293bae850d06b35d61ec10039d3d0fdabae481b.zip
[analyzer] Refactor: Use Decl when determining if the Block belongs to
the root function. (This is a bit cleaner then using the StackFrame.) llvm-svn: 153580
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp
index 219fc28595e..9dd8da57ec9 100644
--- a/clang/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp
@@ -42,22 +42,22 @@ void AnalyzerStatsChecker::checkEndAnalysis(ExplodedGraph &G,
BugReporter &B,
ExprEngine &Eng) const {
const CFG *C = 0;
- const Decl *D = 0;
const SourceManager &SM = B.getSourceManager();
llvm::SmallPtrSet<const CFGBlock*, 256> reachable;
// Root node should have the location context of the top most function.
const ExplodedNode *GraphRoot = *G.roots_begin();
- const LocationContext *LC =
- GraphRoot->getLocation().getLocationContext()->getCurrentStackFrame();
+ const LocationContext *LC = GraphRoot->getLocation().getLocationContext();
+
+ const Decl *D = LC->getDecl();
// Iterate over the exploded graph.
for (ExplodedGraph::node_iterator I = G.nodes_begin();
I != G.nodes_end(); ++I) {
const ProgramPoint &P = I->getLocation();
- // Only check the coverage in the top level function.
- if (LC != P.getLocationContext()->getCurrentStackFrame())
+ // Only check the coverage in the top level function (optimization).
+ if (D != P.getLocationContext()->getDecl())
continue;
if (const BlockEntrance *BE = dyn_cast<BlockEntrance>(&P)) {
@@ -66,9 +66,8 @@ void AnalyzerStatsChecker::checkEndAnalysis(ExplodedGraph &G,
}
}
- // Get the CFG and the Decl of this block
+ // Get the CFG and the Decl of this block.
C = LC->getCFG();
- D = LC->getAnalysisDeclContext()->getDecl();
unsigned total = 0, unreachable = 0;
OpenPOWER on IntegriCloud