[cfe-commits] r105909 - in /cfe/trunk: lib/Parse/ParseDeclCXX.cpp test/Parser/cxx-decl.cpp
Chris Lattner
sabre at nondot.org
Sat Jun 12 22:34:19 PDT 2010
Author: lattner
Date: Sun Jun 13 00:34:18 2010
New Revision: 105909
URL: http://llvm.org/viewvc/llvm-project?rev=105909&view=rev
Log:
Allow an asm label specifier on C++ methods, like GCC does.
Patch by David Majnemer!
Modified:
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
cfe/trunk/test/Parser/cxx-decl.cpp
Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=105909&r1=105908&r2=105909&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Sun Jun 13 00:34:18 2010
@@ -1373,7 +1373,6 @@
// declarator pure-specifier[opt]
// declarator constant-initializer[opt]
// identifier[opt] ':' constant-expression
-
if (Tok.is(tok::colon)) {
ConsumeToken();
BitfieldSize = ParseConstantExpression();
@@ -1390,7 +1389,6 @@
// defaulted/deleted function-definition:
// '=' 'default' [TODO]
// '=' 'delete'
-
if (Tok.is(tok::equal)) {
ConsumeToken();
if (getLang().CPlusPlus0x && Tok.is(tok::kw_delete)) {
@@ -1403,6 +1401,17 @@
}
}
+ // If a simple-asm-expr is present, parse it.
+ if (Tok.is(tok::kw_asm)) {
+ SourceLocation Loc;
+ OwningExprResult AsmLabel(ParseSimpleAsm(&Loc));
+ if (AsmLabel.isInvalid())
+ SkipUntil(tok::comma, true, true);
+
+ DeclaratorInfo.setAsmLabel(AsmLabel.release());
+ DeclaratorInfo.SetRangeEnd(Loc);
+ }
+
// If attributes exist after the declarator, parse them.
if (Tok.is(tok::kw___attribute)) {
SourceLocation Loc;
Modified: cfe/trunk/test/Parser/cxx-decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-decl.cpp?rev=105909&r1=105908&r2=105909&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx-decl.cpp (original)
+++ cfe/trunk/test/Parser/cxx-decl.cpp Sun Jun 13 00:34:18 2010
@@ -37,6 +37,10 @@
}
};
+class asm_class_test {
+ void foo() __asm__("baz");
+};
+
enum { fooenum = 1 };
struct a {
More information about the cfe-commits
mailing list