[cfe-commits] r96941 - in /cfe/trunk: lib/Parse/Parser.cpp test/Parser/knr_parameter_attributes.c
Richard Pennington
rich at pennware.com
Tue Feb 23 04:22:13 PST 2010
Author: rich
Date: Tue Feb 23 06:22:13 2010
New Revision: 96941
URL: http://llvm.org/viewvc/llvm-project?rev=96941&view=rev
Log:
Retain attributes for K&R style parameter declarations.
Added:
cfe/trunk/test/Parser/knr_parameter_attributes.c
Modified:
cfe/trunk/lib/Parse/Parser.cpp
Modified: cfe/trunk/lib/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=96941&r1=96940&r2=96941&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/Parser.cpp (original)
+++ cfe/trunk/lib/Parse/Parser.cpp Tue Feb 23 06:22:13 2010
@@ -743,10 +743,11 @@
// 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 =
Added: cfe/trunk/test/Parser/knr_parameter_attributes.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/knr_parameter_attributes.c?rev=96941&view=auto
==============================================================================
--- cfe/trunk/test/Parser/knr_parameter_attributes.c (added)
+++ cfe/trunk/test/Parser/knr_parameter_attributes.c Tue Feb 23 06:22:13 2010
@@ -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;
+}
More information about the cfe-commits
mailing list