diff options
| author | Chris Lattner <sabre@nondot.org> | 2007-07-22 04:13:33 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2007-07-22 04:13:33 +0000 |
| commit | e34b2c298ae2fa7cb559364f70c78f0e6cc840c4 (patch) | |
| tree | c1c225954df897a1475ec33a41b68e15b4162cfa | |
| parent | 9c724c48ea2479bac0965e53ac4c710ed9c71aea (diff) | |
| download | bcm5719-llvm-e34b2c298ae2fa7cb559364f70c78f0e6cc840c4.tar.gz bcm5719-llvm-e34b2c298ae2fa7cb559364f70c78f0e6cc840c4.zip | |
Catch goto's with a missing identifier, patch by Neil Booth.
llvm-svn: 40381
| -rw-r--r-- | clang/Parse/ParseStmt.cpp | 4 | ||||
| -rw-r--r-- | clang/test/Parser/goto-ident.c | 6 |
2 files changed, 10 insertions, 0 deletions
diff --git a/clang/Parse/ParseStmt.cpp b/clang/Parse/ParseStmt.cpp index 27c1fa88a13..564b09722f2 100644 --- a/clang/Parse/ParseStmt.cpp +++ b/clang/Parse/ParseStmt.cpp @@ -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/clang/test/Parser/goto-ident.c b/clang/test/Parser/goto-ident.c new file mode 100644 index 00000000000..0dc7f4ec40d --- /dev/null +++ b/clang/test/Parser/goto-ident.c @@ -0,0 +1,6 @@ +/* RUN: clang -parse-ast-check %s +*/ + +void foo() { + goto ; /* expected-error {{expected identifier}} */ +} |

