[cfe-commits] r109087 - in /cfe/trunk: lib/Parse/ParseStmt.cpp test/Parser/asm.c
Chandler Carruth
chandlerc at gmail.com
Thu Jul 22 00:11:21 PDT 2010
Author: chandlerc
Date: Thu Jul 22 02:11:21 2010
New Revision: 109087
URL: http://llvm.org/viewvc/llvm-project?rev=109087&view=rev
Log:
Fix PR7673 by allowing an empty clobbers section in an ASM statement.
Modified:
cfe/trunk/lib/Parse/ParseStmt.cpp
cfe/trunk/test/Parser/asm.c
Modified: cfe/trunk/lib/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmt.cpp?rev=109087&r1=109086&r2=109087&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseStmt.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmt.cpp Thu Jul 22 02:11:21 2010
@@ -1367,17 +1367,19 @@
if (!AteExtraColon)
ConsumeToken();
- // Parse the asm-string list for clobbers.
- while (1) {
- OwningExprResult Clobber(ParseAsmStringLiteral());
+ // Parse the asm-string list for clobbers if present.
+ if (Tok.isNot(tok::r_paren)) {
+ while (1) {
+ OwningExprResult Clobber(ParseAsmStringLiteral());
- if (Clobber.isInvalid())
- break;
+ if (Clobber.isInvalid())
+ break;
- Clobbers.push_back(Clobber.release());
+ Clobbers.push_back(Clobber.release());
- if (Tok.isNot(tok::comma)) break;
- ConsumeToken();
+ if (Tok.isNot(tok::comma)) break;
+ ConsumeToken();
+ }
}
}
Modified: cfe/trunk/test/Parser/asm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/asm.c?rev=109087&r1=109086&r2=109087&view=diff
==============================================================================
--- cfe/trunk/test/Parser/asm.c (original)
+++ cfe/trunk/test/Parser/asm.c Thu Jul 22 02:11:21 2010
@@ -1,7 +1,8 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
void f1() {
- asm ("ret" : : :); // expected-error {{expected string literal}}
+ // PR7673: Some versions of GCC support an empty clobbers section.
+ asm ("ret" : : :);
}
void f2() {
More information about the cfe-commits
mailing list