aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/CFGStmtMap.cpp
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2010-09-16 01:25:47 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2010-09-16 01:25:47 +0000
commitb36cd3e1757fb4fcd9509f35558c847b04bef35f (patch)
treebd1aa08c903a1b5007a6dfd2c892617d20c45b47 /lib/Analysis/CFGStmtMap.cpp
parent6dbcaf3849709e271ffad5974150a6adbbfbb064 (diff)
Introduce new CFGElement hierarchy to support C++ CFG, based on Marcin's patch
and discussions with Ted and Jordy. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114056 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CFGStmtMap.cpp')
-rw-r--r--lib/Analysis/CFGStmtMap.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/Analysis/CFGStmtMap.cpp b/lib/Analysis/CFGStmtMap.cpp
index 965eca1b3c..3a030f9bdd 100644
--- a/lib/Analysis/CFGStmtMap.cpp
+++ b/lib/Analysis/CFGStmtMap.cpp
@@ -50,15 +50,18 @@ static void Accumulate(SMap &SM, CFGBlock *B) {
// First walk the block-level expressions.
for (CFGBlock::iterator I = B->begin(), E = B->end(); I != E; ++I) {
const CFGElement &CE = *I;
- if (Stmt *S = CE.getStmt()) {
- CFGBlock *&Entry = SM[S];
- // If 'Entry' is already initialized (e.g., a terminator was already),
- // skip.
- if (Entry)
- continue;
+ CFGStmt CS = CE.getAs<CFGStmt>();
+ if (!CS.isValid())
+ continue;
+
+ CFGBlock *&Entry = SM[CS];
+ // If 'Entry' is already initialized (e.g., a terminator was already),
+ // skip.
+ if (Entry)
+ continue;
- Entry = B;
- }
+ Entry = B;
+
}
// Look at the label of the block.