[cfe-commits] r153580 - /cfe/trunk/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp
Anna Zaks
ganna at apple.com
Wed Mar 28 10:05:47 PDT 2012
Author: zaks
Date: Wed Mar 28 12:05:46 2012
New Revision: 153580
URL: http://llvm.org/viewvc/llvm-project?rev=153580&view=rev
Log:
[analyzer] Refactor: Use Decl when determining if the Block belongs to
the root function.
(This is a bit cleaner then using the StackFrame.)
Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp?rev=153580&r1=153579&r2=153580&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp Wed Mar 28 12:05:46 2012
@@ -42,22 +42,22 @@
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 @@
}
}
- // 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;
More information about the cfe-commits
mailing list