]> granicus.if.org Git - clang/commitdiff
Catch goto's with a missing identifier, patch by Neil Booth.
authorChris Lattner <sabre@nondot.org>
Sun, 22 Jul 2007 04:13:33 +0000 (04:13 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 22 Jul 2007 04:13:33 +0000 (04:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40381 91177308-0d34-0410-b5e6-96231b3b80d8

Parse/ParseStmt.cpp
test/Parser/goto-ident.c [new file with mode: 0644]

index 27c1fa88a13cc1f98306fc06be0acaa4bbcf6af4..564b09722f20633d91713078536763a20225c801 100644 (file)
@@ -680,7 +680,11 @@ Parser::StmtResult Parser::ParseGotoStatement() {
       return true;
     }
     Res = Actions.ParseIndirectGotoStmt(GotoLoc, StarLoc, R.Val);
+  } else {
+    Diag(Tok, diag::err_expected_ident);
+    return true;
   }
+    
   return Res;
 }
 
diff --git a/test/Parser/goto-ident.c b/test/Parser/goto-ident.c
new file mode 100644 (file)
index 0000000..0dc7f4e
--- /dev/null
@@ -0,0 +1,6 @@
+/* RUN: clang -parse-ast-check %s
+*/
+
+void foo() { 
+  goto ; /* expected-error {{expected identifier}} */
+}