[cfe-commits] r41293 - /cfe/trunk/include/clang/AST/CFG.h
Ted Kremenek
kremenek at apple.com
Wed Aug 22 14:03:53 PDT 2007
Author: kremenek
Date: Wed Aug 22 16:03:50 2007
New Revision: 41293
URL: http://llvm.org/viewvc/llvm-project?rev=41293&view=rev
Log:
Added explicit pointer within class CFG to the Entry block.
Before we assumed that the first block in the list of blocks was the entry
block, but this has posed hurdles during CFG construction.
Modified:
cfe/trunk/include/clang/AST/CFG.h
Modified: cfe/trunk/include/clang/AST/CFG.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CFG.h?rev=41293&r1=41292&r2=41293&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/CFG.h (original)
+++ cfe/trunk/include/clang/AST/CFG.h Wed Aug 22 16:03:50 2007
@@ -153,11 +153,11 @@
/// was constructed from.
class CFG {
typedef std::list<CFGBlock> CFGBlockListTy;
+ CFGBlock* Entry;
CFGBlockListTy Blocks;
-
+
public:
-
- CFG() {};
+ CFG() : Entry(NULL) {};
~CFG() {};
CFGBlock* createBlock(unsigned blockID) {
@@ -171,28 +171,28 @@
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
- CFGBlock& front() { return Blocks.front(); }
- CFGBlock& back() { return Blocks.back(); }
+ CFGBlock& front() { return Blocks.front(); }
+ CFGBlock& back() { return Blocks.back(); }
- iterator begin() { return Blocks.begin(); }
- iterator end() { return Blocks.end(); }
- const_iterator begin() const { return Blocks.begin(); }
- const_iterator end() const { return Blocks.end(); }
-
- reverse_iterator rbegin() { return Blocks.rbegin(); }
- reverse_iterator rend() { return Blocks.rend(); }
- const_reverse_iterator rbegin() const { return Blocks.rbegin(); }
- const_reverse_iterator rend() const { return Blocks.rend(); }
+ iterator begin() { return Blocks.begin(); }
+ iterator end() { return Blocks.end(); }
+ const_iterator begin() const { return Blocks.begin(); }
+ const_iterator end() const { return Blocks.end(); }
+
+ reverse_iterator rbegin() { return Blocks.rbegin(); }
+ reverse_iterator rend() { return Blocks.rend(); }
+ const_reverse_iterator rbegin() const { return Blocks.rbegin(); }
+ const_reverse_iterator rend() const { return Blocks.rend(); }
- CFGBlock& getEntry() { return front(); }
- CFGBlock& getExit() { return back(); }
+ CFGBlock& getEntry() { return Entry ? *Entry : front(); }
+ CFGBlock& getExit() { return back(); }
// Utility
static CFG* BuildCFG(Stmt* AST);
void print(std::ostream& OS);
void dump();
-
+ void setEntry(CFGBlock *B) { Entry = B; }
};
-} // end namespace clang
\ No newline at end of file
+} // end namespace clang
More information about the cfe-commits
mailing list