From eecf847d1e46f4e1f7386ba3e624e2c8f31fa953 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Wed, 21 Nov 2007 23:27:34 +0000 Subject: [PATCH] GCC fails if there is a trailing colon but no clobbers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44265 91177308-0d34-0410-b5e6-96231b3b80d8 --- Parse/ParseStmt.cpp | 12 +++++------- test/Parser/asm.c | 5 +++++ 2 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 test/Parser/asm.c diff --git a/Parse/ParseStmt.cpp b/Parse/ParseStmt.cpp index 8d5be6868c..6f871da118 100644 --- a/Parse/ParseStmt.cpp +++ b/Parse/ParseStmt.cpp @@ -957,14 +957,12 @@ Parser::StmtResult Parser::ParseAsmStatement() { if (Tok.is(tok::colon)) { ConsumeToken(); - if (isTokenStringLiteral()) { - // Parse the asm-string list for clobbers. - while (1) { - ParseAsmStringLiteral(); + // Parse the asm-string list for clobbers. + while (1) { + ParseAsmStringLiteral(); - if (Tok.isNot(tok::comma)) break; - ConsumeToken(); - } + if (Tok.isNot(tok::comma)) break; + ConsumeToken(); } } diff --git a/test/Parser/asm.c b/test/Parser/asm.c new file mode 100644 index 0000000000..a09b545a8e --- /dev/null +++ b/test/Parser/asm.c @@ -0,0 +1,5 @@ +// RUN: clang -fsyntax-only -verify %s + +void f1() { + asm ("ret" : : :); // expected-error {{expected string literal}} +} -- 2.50.1