[cfe-commits] r115110 - /cfe/trunk/lib/Checker/AnalyzerStatsChecker.cpp

Tom Care tcare at apple.com
Wed Sep 29 16:48:34 PDT 2010


Author: tcare
Date: Wed Sep 29 18:48:34 2010
New Revision: 115110

URL: http://llvm.org/viewvc/llvm-project?rev=115110&view=rev
Log:
AnalyzerStatsChecker improvements:
- Use BlockEntrance rather than BlockEdge to bring in line with UnreachableCodeChecker. Fixes an issue where unreached blocks would still be counted as reachable.
- Added warnings for all BlockAborted locations. This allows us to see where the analyzer stopped analyzing.

Modified:
    cfe/trunk/lib/Checker/AnalyzerStatsChecker.cpp

Modified: cfe/trunk/lib/Checker/AnalyzerStatsChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/AnalyzerStatsChecker.cpp?rev=115110&r1=115109&r2=115110&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/AnalyzerStatsChecker.cpp (original)
+++ cfe/trunk/lib/Checker/AnalyzerStatsChecker.cpp Wed Sep 29 18:48:34 2010
@@ -54,8 +54,8 @@
     if (!LC)
       LC = P.getLocationContext();
 
-    if (const BlockEdge *BE = dyn_cast<BlockEdge>(&P)) {
-      const CFGBlock *CB = BE->getDst();
+    if (const BlockEntrance *BE = dyn_cast<BlockEntrance>(&P)) {
+      const CFGBlock *CB = BE->getBlock();
       reachable.insert(CB);
     }
   }
@@ -101,4 +101,17 @@
 
   B.EmitBasicReport("Analyzer Statistics", "Internal Statistics", output.str(),
       D->getLocation());
+
+  // Emit warning for each block we bailed out on
+  typedef GRCoreEngine::BlocksAborted::const_iterator AbortedIterator;
+  const GRCoreEngine &CE = Eng.getCoreEngine();
+  for (AbortedIterator I = CE.blocks_aborted_begin(),
+      E = CE.blocks_aborted_end(); I != E; ++I) {
+    const BlockEdge &BE =  I->first;
+    const CFGBlock *Exit = BE.getDst();
+    const CFGElement &CE = Exit->front();
+    if (const CFGStmt *CS = dyn_cast<CFGStmt>(&CE))
+      B.EmitBasicReport("Bailout Point", "Internal Statistics", "The analyzer "
+          "stopped analyzing at this point", CS->getStmt()->getLocStart());
+  }
 }





More information about the cfe-commits mailing list