[cfe-commits] r89894 - in /cfe/trunk: lib/Parse/ParseDeclCXX.cpp test/Parser/attributes.c test/Parser/cxx-attributes.cpp
John Thompson
John.Thompson.JTSoftware at gmail.com
Wed Nov 25 14:58:06 PST 2009
Author: jtsoftware
Date: Wed Nov 25 16:58:06 2009
New Revision: 89894
URL: http://llvm.org/viewvc/llvm-project?rev=89894&view=rev
Log:
Fix attribute between function decl ')' and '{' or '=0'
Added:
cfe/trunk/test/Parser/cxx-attributes.cpp
Modified:
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
cfe/trunk/test/Parser/attributes.c
Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=89894&r1=89893&r2=89894&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Wed Nov 25 16:58:06 2009
@@ -1144,6 +1144,13 @@
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() &&
Modified: cfe/trunk/test/Parser/attributes.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/attributes.c?rev=89894&r1=89893&r2=89894&view=diff
==============================================================================
--- cfe/trunk/test/Parser/attributes.c (original)
+++ cfe/trunk/test/Parser/attributes.c Wed Nov 25 16:58:06 2009
@@ -51,3 +51,4 @@
// rdar://6096491
void __attribute__((noreturn)) d0(void), __attribute__((noreturn)) d1(void);
+void d2(void) __attribute__((noreturn)), d3(void) __attribute__((noreturn));
Added: cfe/trunk/test/Parser/cxx-attributes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-attributes.cpp?rev=89894&view=auto
==============================================================================
--- cfe/trunk/test/Parser/cxx-attributes.cpp (added)
+++ cfe/trunk/test/Parser/cxx-attributes.cpp Wed Nov 25 16:58:06 2009
@@ -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) )) {}
+};
+
More information about the cfe-commits
mailing list