[cfe-commits] r42031 - /cfe/trunk/AST/CFG.cpp

Ted Kremenek kremenek at apple.com
Mon Sep 17 09:18:03 PDT 2007


Author: kremenek
Date: Mon Sep 17 11:18:02 2007
New Revision: 42031

URL: http://llvm.org/viewvc/llvm-project?rev=42031&view=rev
Log:
When building CFGs we now (unconditionally) add an empty CFGBlock to the CFG
to serve as the entry block.  An empty entry block (just as with an
empty exit block, which we already have) simplifies building analyses on top
of CFGs with very little extra overhead.

Modified:
    cfe/trunk/AST/CFG.cpp

Modified: cfe/trunk/AST/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/CFG.cpp?rev=42031&r1=42030&r2=42031&view=diff

==============================================================================
--- cfe/trunk/AST/CFG.cpp (original)
+++ cfe/trunk/AST/CFG.cpp Mon Sep 17 11:18:02 2007
@@ -175,11 +175,8 @@
       }
                                                         
     // Create an empty entry block that has no predecessors.    
-    if (B->pred_size() > 0) {
-      Succ = B;
-      cfg->setEntry(createBlock());
-    }
-    else cfg->setEntry(B);
+    Succ = B;
+    cfg->setEntry(createBlock());
     
     // NULL out cfg so that repeated calls to the builder will fail and that
     // the ownership of the constructed CFG is passed to the caller.
@@ -187,7 +184,10 @@
     cfg = NULL;
     return t;
   }
-  else return NULL;
+  else {
+    assert (false && "CFG construction failed.");
+    return NULL;
+  }
 }
   
 /// createBlock - Used to lazily create blocks that are connected





More information about the cfe-commits mailing list