]> granicus.if.org Git - clang/commitdiff
Elide __label__ declarations from the CFG. This resolves a crash in CFGRecStmtDeclVi...
authorTed Kremenek <kremenek@apple.com>
Tue, 10 May 2011 18:42:15 +0000 (18:42 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 10 May 2011 18:42:15 +0000 (18:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131141 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/CFG.cpp
test/Analysis/misc-ps.m

index de16334ce137f6d4f5badaaaf5bfbd3334b1db8c..a247a9d194ebc8af55dceebe464a0b52db193409 100644 (file)
@@ -1314,6 +1314,11 @@ CFGBlock *CFGBuilder::VisitConditionalOperator(AbstractConditionalOperator *C,
 }
 
 CFGBlock *CFGBuilder::VisitDeclStmt(DeclStmt *DS) {
+  // Check if the Decl is for an __label__.  If so, elide it from the
+  // CFG entirely.
+  if (isa<LabelDecl>(*DS->decl_begin()))
+    return Block;
+  
   if (DS->isSingleDecl())
     return VisitDeclSubExpr(DS);
 
index 9de4afb0ae9844b8b03f658104badad6e5ece111..30532a82259def81752e4b18b4f79576cefad7e9 100644 (file)
@@ -1301,3 +1301,14 @@ static void test(unsigned int bit_mask)
     }
   }
 }
+
+// Don't crash on code containing __label__.
+int radar9414427_aux();
+void radar9414427() {
+  __label__ mylabel;
+  if (radar9414427_aux()) {
+  mylabel: do {}
+  while (0);
+  }
+}
+