[cfe-commits] r96570 - in /cfe/trunk: lib/Sema/TargetAttributesSema.cpp test/Sema/x86-attr-force-align-arg-pointer.c

Charles Davis cdavis at mines.edu
Wed Feb 17 20:57:00 PST 2010


Author: cdavis
Date: Wed Feb 17 22:56:59 2010
New Revision: 96570

URL: http://llvm.org/viewvc/llvm-project?rev=96570&view=rev
Log:
Also don't warn about force_align_arg_pointer on function typedefs. (This will
break if you declare an actual function using that typedef. Come to think of it,
maybe I should make this part of the type.)

Modified:
    cfe/trunk/lib/Sema/TargetAttributesSema.cpp
    cfe/trunk/test/Sema/x86-attr-force-align-arg-pointer.c

Modified: cfe/trunk/lib/Sema/TargetAttributesSema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TargetAttributesSema.cpp?rev=96570&r1=96569&r2=96570&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/TargetAttributesSema.cpp (original)
+++ cfe/trunk/lib/Sema/TargetAttributesSema.cpp Wed Feb 17 22:56:59 2010
@@ -87,7 +87,8 @@
     return;
   // Also don't warn on function pointer typedefs.
   TypedefDecl *TD = dyn_cast<TypedefDecl>(D);
-  if (TD && TD->getUnderlyingType()->isFunctionPointerType())
+  if (TD && (TD->getUnderlyingType()->isFunctionPointerType() ||
+             TD->getUnderlyingType()->isFunctionType()))
     return;
   // Attribute can only be applied to function types.
   if (!isa<FunctionDecl>(D)) {

Modified: cfe/trunk/test/Sema/x86-attr-force-align-arg-pointer.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/x86-attr-force-align-arg-pointer.c?rev=96570&r1=96569&r2=96570&view=diff

==============================================================================
--- cfe/trunk/test/Sema/x86-attr-force-align-arg-pointer.c (original)
+++ cfe/trunk/test/Sema/x86-attr-force-align-arg-pointer.c Wed Feb 17 22:56:59 2010
@@ -16,4 +16,6 @@
 // Attribute is ignored on function pointer types.
 void (__attribute__((force_align_arg_pointer)) *p)();
 typedef void (__attribute__((__force_align_arg_pointer__)) *p2)();
+// Attribute is also ignored on function typedefs.
+typedef void __attribute__((force_align_arg_pointer)) e(void);
 





More information about the cfe-commits mailing list