[cfe-commits] r134552 - /cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp

Chandler Carruth chandlerc at gmail.com
Wed Jul 6 15:21:45 PDT 2011


Author: chandlerc
Date: Wed Jul  6 17:21:45 2011
New Revision: 134552

URL: http://llvm.org/viewvc/llvm-project?rev=134552&view=rev
Log:
Based on comments from Chris, switch to using CFG::getNumBlockIDs()
rather than a computed std::distance(). At some point I had convinced
myself that these two were different; but as far as I can tell on
re-exampination they aren't, and the number of block IDs is actually
just a count of the blocks in the CFG.

While this removes the primary motivation for guarding all of this with
CollectStats, I have a patch coming up that will almost certainly make
it important again.

Modified:
    cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp

Modified: cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp?rev=134552&r1=134551&r2=134552&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp (original)
+++ cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp Wed Jul  6 17:21:45 2011
@@ -741,10 +741,9 @@
     if (CFG *cfg = AC.getCFG()) {
       // If we successfully built a CFG for this context, record some more
       // detail information about it.
-      unsigned NumBlocks = std::distance(cfg->begin(), cfg->end());
-      NumCFGBlocks += NumBlocks;
+      NumCFGBlocks += cfg->getNumBlockIDs();
       MaxCFGBlocksPerFunction = std::max(MaxCFGBlocksPerFunction,
-                                         NumBlocks);
+                                         cfg->getNumBlockIDs());
     } else {
       ++NumFunctionsWithBadCFGs;
     }





More information about the cfe-commits mailing list