[cfe-commits] r96568 - 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:39:20 PST 2010
Author: cdavis
Date: Wed Feb 17 22:39:19 2010
New Revision: 96568
URL: http://llvm.org/viewvc/llvm-project?rev=96568&view=rev
Log:
Two fixes related to force_align_arg_pointer:
- Also recognize __force_align_arg_pointer__.
- Don't warn if it's used on a function pointer typedef.
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=96568&r1=96567&r2=96568&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TargetAttributesSema.cpp (original)
+++ cfe/trunk/lib/Sema/TargetAttributesSema.cpp Wed Feb 17 22:39:19 2010
@@ -82,9 +82,13 @@
// If we try to apply it to a function pointer, don't warn, but don't
// do anything, either. It doesn't matter anyway, because there's nothing
// special about calling a force_align_arg_pointer function.
- ValueDecl* VD = dyn_cast<ValueDecl>(D);
+ ValueDecl *VD = dyn_cast<ValueDecl>(D);
if (VD && VD->getType()->isFunctionPointerType())
return;
+ // Also don't warn on function pointer typedefs.
+ TypedefDecl *TD = dyn_cast<TypedefDecl>(D);
+ if (TD && TD->getUnderlyingType()->isFunctionPointerType())
+ return;
// Attribute can only be applied to function types.
if (!isa<FunctionDecl>(D)) {
S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
@@ -189,7 +193,8 @@
default: break;
}
}
- if (Attr.getName()->getName() == "force_align_arg_pointer") {
+ if (Attr.getName()->getName() == "force_align_arg_pointer" ||
+ Attr.getName()->getName() == "__force_align_arg_pointer__") {
HandleX86ForceAlignArgPointerAttr(D, Attr, S);
return true;
}
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=96568&r1=96567&r2=96568&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:39:19 2010
@@ -15,4 +15,5 @@
// Attribute is ignored on function pointer types.
void (__attribute__((force_align_arg_pointer)) *p)();
+typedef void (__attribute__((__force_align_arg_pointer__)) *p2)();
More information about the cfe-commits
mailing list