From: Ted Kremenek Date: Thu, 23 Aug 2007 16:51:52 +0000 (+0000) Subject: Modified CFG to have explicit "Exit" pointer for exit block. This should X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=504927ac167053f3b5c2ae38c7ee3fa55bbf3a6c;p=clang Modified CFG to have explicit "Exit" pointer for exit block. This should have been committed with my previous patch. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41324 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/CFG.h b/include/clang/AST/CFG.h index 8cfe545529..4d222b890e 100644 --- a/include/clang/AST/CFG.h +++ b/include/clang/AST/CFG.h @@ -154,17 +154,13 @@ public: class CFG { typedef std::list 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; }