diff options
author | Chris Lattner <sabre@nondot.org> | 2010-06-13 05:34:18 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-06-13 05:34:18 +0000 |
commit | e6563256a4b3b9fee70ce3335d28406607c1faaf (patch) | |
tree | c5f2b898021288353eed255be2b99ff636b9f524 | |
parent | 0d15c5321a11a5fee53b17ca8e9e0d72d6192b23 (diff) |
Allow an asm label specifier on C++ methods, like GCC does.
Patch by David Majnemer!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105909 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Parse/ParseDeclCXX.cpp | 13 | ||||
-rw-r--r-- | test/Parser/cxx-decl.cpp | 4 |
2 files changed, 15 insertions, 2 deletions
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index eda490d918..9cf025df5e 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -1373,7 +1373,6 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS, // declarator pure-specifier[opt] // declarator constant-initializer[opt] // identifier[opt] ':' constant-expression - if (Tok.is(tok::colon)) { ConsumeToken(); BitfieldSize = ParseConstantExpression(); @@ -1390,7 +1389,6 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS, // 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 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS, } } + // 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; diff --git a/test/Parser/cxx-decl.cpp b/test/Parser/cxx-decl.cpp index ae004ce81c..e4c703c334 100644 --- a/test/Parser/cxx-decl.cpp +++ b/test/Parser/cxx-decl.cpp @@ -37,6 +37,10 @@ class someclass { } }; +class asm_class_test { + void foo() __asm__("baz"); +}; + enum { fooenum = 1 }; struct a { |