From 16e4dc8073449ebbeee098941c062ad8b2d3bcd5 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Thu, 30 Aug 2007 18:20:57 +0000 Subject: [PATCH] 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: ; } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41619 91177308-0d34-0410-b5e6-96231b3b80d8 --- AST/CFG.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/AST/CFG.cpp b/AST/CFG.cpp index 014dc861de..f6b74e7f7b 100644 --- a/AST/CFG.cpp +++ b/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; -- 2.50.1