Retain attributes for K&R style parameter declarations.

llvm-svn: 96941
This commit is contained in:
Richard Pennington 2010-02-23 12:22:13 +00:00
parent 7e4acbdf53
commit 14cc983d86
2 changed files with 16 additions and 4 deletions

View File

@ -743,10 +743,11 @@ void Parser::ParseKNRParamDeclarations(Declarator &D) {
// Handle the full declarator list.
while (1) {
// If attributes are present, parse them.
llvm::OwningPtr<AttributeList> AttrList;
if (Tok.is(tok::kw___attribute))
// FIXME: attach attributes too.
AttrList.reset(ParseGNUAttributes());
if (Tok.is(tok::kw___attribute)) {
SourceLocation Loc;
AttributeList *AttrList = ParseGNUAttributes(&Loc);
ParmDeclarator.AddAttributes(AttrList, Loc);
}
// Ask the actions module to compute the type for this declarator.
Action::DeclPtrTy Param =

View File

@ -0,0 +1,11 @@
// RUN: %clang_cc1 -fsyntax-only -W -Wall -Werror -verify %s
int f(int i __attribute__((__unused__)))
{
return 0;
}
int g(i)
int i __attribute__((__unused__));
{
return 0;
}