aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2007-11-21 23:27:34 +0000
committerAnders Carlsson <andersca@mac.com>2007-11-21 23:27:34 +0000
commiteecf847d1e46f4e1f7386ba3e624e2c8f31fa953 (patch)
tree2695fe70dd62c786cb3e8af9be4058dc07801e39
parent6a0ef4b83c91a6d6d5acb4ed5577c4659fe022a3 (diff)
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
-rw-r--r--Parse/ParseStmt.cpp12
-rw-r--r--test/Parser/asm.c5
2 files changed, 10 insertions, 7 deletions
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}}
+}