mirror of
https://github.com/intel/llvm.git
synced 2026-02-04 11:38:04 +08:00
Allow an asm label specifier on C++ methods, like GCC does.
Patch by David Majnemer! llvm-svn: 105909
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -37,6 +37,10 @@ class someclass {
|
||||
}
|
||||
};
|
||||
|
||||
class asm_class_test {
|
||||
void foo() __asm__("baz");
|
||||
};
|
||||
|
||||
enum { fooenum = 1 };
|
||||
|
||||
struct a {
|
||||
|
||||
Reference in New Issue
Block a user