]> granicus.if.org Git - clang/commitdiff
Modified CFG to have explicit "Exit" pointer for exit block. This should
authorTed Kremenek <kremenek@apple.com>
Thu, 23 Aug 2007 16:51:52 +0000 (16:51 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 23 Aug 2007 16:51:52 +0000 (16:51 +0000)
have been committed with my previous patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41324 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/CFG.h

index 8cfe54552968ce4d77cb1f42bc65426ab47a7bfd..4d222b890e2c2a9772133e1703c3f937d9b17f5d 100644 (file)
@@ -154,17 +154,13 @@ public:
 class CFG {
   typedef std::list<CFGBlock> CFGBlockListTy;
   CFGBlock* Entry;
+  CFGBlock* Exit;
   CFGBlockListTy Blocks;
   
 public:
-  CFG() : Entry(NULL) {};
+  CFG() : Entry(NULL), Exit(NULL) {};
   ~CFG() {};
   
-  CFGBlock* createBlock(unsigned blockID) { 
-    Blocks.push_front(CFGBlock(blockID));
-    return &front();
-  }
-  
   // Block iterators
   typedef CFGBlockListTy::iterator                                    iterator;
   typedef CFGBlockListTy::const_iterator                        const_iterator;
@@ -184,12 +180,13 @@ public:
   const_reverse_iterator       rbegin()      const { return Blocks.rbegin();   }
   const_reverse_iterator       rend()        const { return Blocks.rend();     }
   
-  CFGBlock&                    getEntry()   { return Entry ? *Entry : front(); }
-  CFGBlock&                    getExit()           { return back();            }
+  CFGBlock&                    getEntry()          { return *Entry;            }
+  CFGBlock&                    getExit()           { return *Exit;             }
   
   // Utility
   
-  static CFG* BuildCFG(Stmt* AST);
+  CFGBlock* createBlock(unsigned blockID);
+  static CFG* buildCFG(Stmt* AST);
   void print(std::ostream& OS);
   void dump();
   void setEntry(CFGBlock *B) { Entry = B; }