summaryrefslogtreecommitdiffstats
path: root/clang/AST/CFG.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2007-08-30 18:20:57 +0000
committerTed Kremenek <kremenek@apple.com>2007-08-30 18:20:57 +0000
commitf9b1756029596b8a52b3d5ed8fc62ae915375e3c (patch)
tree74d638844f366f39e193fe6859112f99c628f43d /clang/AST/CFG.cpp
parentcadebd086f77b171533f02932f95ba17d3dec480 (diff)
downloadbcm5719-llvm-f9b1756029596b8a52b3d5ed8fc62ae915375e3c.tar.gz
bcm5719-llvm-f9b1756029596b8a52b3d5ed8fc62ae915375e3c.zip
Fixed bug in CFG construction involving use of labels and "empty"
blocks involving only ';' statements. We now correctly handle the following: void empty_label() { l1: ; } llvm-svn: 41619
Diffstat (limited to 'clang/AST/CFG.cpp')
-rw-r--r--clang/AST/CFG.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/AST/CFG.cpp b/clang/AST/CFG.cpp
index 014dc861de7..f6b74e7f7b7 100644
--- a/clang/AST/CFG.cpp
+++ b/clang/AST/CFG.cpp
@@ -463,8 +463,10 @@ CFGBlock* CFGBuilder::VisitReturnStmt(ReturnStmt* R) {
CFGBlock* CFGBuilder::VisitLabelStmt(LabelStmt* L) {
// Get the block of the labeled statement. Add it to our map.
CFGBlock* LabelBlock = Visit(L->getSubStmt());
- assert (LabelBlock);
-
+
+ if (!LabelBlock) // This can happen when the body is empty, i.e.
+ LabelBlock=createBlock(); // scopes that only contains NullStmts.
+
assert (LabelMap.find(L) == LabelMap.end() && "label already in map");
LabelMap[ L ] = LabelBlock;
OpenPOWER on IntegriCloud