Fix attribute between function decl ')' and '{' or '=0'

llvm-svn: 89894
This commit is contained in:
John Thompson 2009-11-25 22:58:06 +00:00
parent 8981b3abe5
commit 5bc5cbe2a2
3 changed files with 17 additions and 0 deletions

View File

@ -1144,6 +1144,13 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS,
return;
}
// If attributes exist after the declarator, but before an '{', parse them.
if (Tok.is(tok::kw___attribute)) {
SourceLocation Loc;
AttributeList *AttrList = ParseGNUAttributes(&Loc);
DeclaratorInfo.AddAttributes(AttrList, Loc);
}
// function-definition:
if (Tok.is(tok::l_brace)
|| (DeclaratorInfo.isFunctionDeclarator() &&

View File

@ -51,3 +51,4 @@ int foo42(void) {
// rdar://6096491
void __attribute__((noreturn)) d0(void), __attribute__((noreturn)) d1(void);
void d2(void) __attribute__((noreturn)), d3(void) __attribute__((noreturn));

View File

@ -0,0 +1,9 @@
// RUN: clang-cc -fsyntax-only -verify %s
class c {
virtual void f1(const char* a, ...)
__attribute__ (( __format__(__printf__,2,3) )) = 0;
virtual void f2(const char* a, ...)
__attribute__ (( __format__(__printf__,2,3) )) {}
};