diff options
| author | Ted Kremenek <kremenek@apple.com> | 2007-09-05 20:02:05 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2007-09-05 20:02:05 +0000 |
| commit | 813dd67a34235fb9fa0bbfcb6143ca47365b45d4 (patch) | |
| tree | f72b2d5925959f41997a329813aa3f82cc9242cc /clang/AST/CFG.cpp | |
| parent | 7db004df7857d52fcff5816c0e37081ce4899784 (diff) | |
| download | bcm5719-llvm-813dd67a34235fb9fa0bbfcb6143ca47365b45d4.tar.gz bcm5719-llvm-813dd67a34235fb9fa0bbfcb6143ca47365b45d4.zip | |
Moved tracking of CFG block IDs into the CFG class.
Added CFG::getNumBlockIDs() to query the number of distinct block ids created.
llvm-svn: 41724
Diffstat (limited to 'clang/AST/CFG.cpp')
| -rw-r--r-- | clang/AST/CFG.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/clang/AST/CFG.cpp b/clang/AST/CFG.cpp index 463b44f387a..93ee6f449dc 100644 --- a/clang/AST/CFG.cpp +++ b/clang/AST/CFG.cpp @@ -63,7 +63,6 @@ class CFGBuilder : public StmtVisitor<CFGBuilder,CFGBlock*> { CFGBlock* ContinueTargetBlock; CFGBlock* BreakTargetBlock; CFGBlock* SwitchTerminatedBlock; - unsigned NumBlocks; // LabelMap records the mapping from Label expressions to their blocks. typedef llvm::DenseMap<LabelStmt*,CFGBlock*> LabelMapTy; @@ -81,8 +80,7 @@ class CFGBuilder : public StmtVisitor<CFGBuilder,CFGBlock*> { public: explicit CFGBuilder() : cfg(NULL), Block(NULL), Succ(NULL), ContinueTargetBlock(NULL), BreakTargetBlock(NULL), - SwitchTerminatedBlock(NULL), - NumBlocks(0) { + SwitchTerminatedBlock(NULL) { // Create an empty CFG. cfg = new CFG(); } @@ -194,7 +192,7 @@ CFG* CFGBuilder::buildCFG(Stmt* Statement) { /// createBlock - Used to lazily create blocks that are connected /// to the current (global) succcessor. CFGBlock* CFGBuilder::createBlock(bool add_successor) { - CFGBlock* B = cfg->createBlock(NumBlocks++); + CFGBlock* B = cfg->createBlock(); if (add_successor && Succ) B->addSuccessor(Succ); return B; } @@ -894,11 +892,11 @@ CFGBlock* CFGBuilder::VisitIndirectGotoStmt(IndirectGotoStmt* I) { /// block has no successors or predecessors. If this is the first block /// created in the CFG, it is automatically set to be the Entry and Exit /// of the CFG. -CFGBlock* CFG::createBlock(unsigned blockID) { +CFGBlock* CFG::createBlock() { bool first_block = begin() == end(); // Create the block. - Blocks.push_front(CFGBlock(blockID)); + Blocks.push_front(CFGBlock(NumBlockIDs++)); // If this is the first block, set it as the Entry and Exit. if (first_block) Entry = Exit = &front(); |

