[cfe-commits] r141381 - in /cfe/trunk: lib/Sema/SemaType.cpp test/Sema/types.c

Chandler Carruth chandlerc at gmail.com
Fri Oct 7 11:40:28 PDT 2011


Author: chandlerc
Date: Fri Oct  7 13:40:27 2011
New Revision: 141381

URL: http://llvm.org/viewvc/llvm-project?rev=141381&view=rev
Log:
Hack in a workaround for PR11082 until we have a proper fix. This
un-breaks every glib-dependent compile with Clang.

I'm not sure this is even the best workaround, so suggestions welcome.

Modified:
    cfe/trunk/lib/Sema/SemaType.cpp
    cfe/trunk/test/Sema/types.c

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=141381&r1=141380&r2=141381&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Fri Oct  7 13:40:27 2011
@@ -3779,6 +3779,11 @@
     switch (attr.getKind()) {
     default: break;
 
+    case AttributeList::AT_may_alias:
+      // FIXME: This attribute needs to actually be handled, but if we ignore
+      // it it breaks large amounts of Linux software.
+      attr.setUsedAsTypeAttr();
+      break;
     case AttributeList::AT_address_space:
       HandleAddressSpaceTypeAttribute(type, attr, state.getSema());
       attr.setUsedAsTypeAttr();

Modified: cfe/trunk/test/Sema/types.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/types.c?rev=141381&r1=141380&r2=141381&view=diff
==============================================================================
--- cfe/trunk/test/Sema/types.c (original)
+++ cfe/trunk/test/Sema/types.c Fri Oct  7 13:40:27 2011
@@ -41,3 +41,12 @@
 void test(int i) {
   char c = (char __attribute__((align(8)))) i; // expected-error {{'align' attribute ignored when parsing type}}
 }
+
+// http://llvm.org/PR11082
+//
+// FIXME: This may or may not be the correct approach (no warning or error),
+// but large amounts of Linux and FreeBSD code need this attribute to not be
+// a hard error in order to work correctly.
+void test2(int i) {
+  char c = (char __attribute__((may_alias))) i;
+}





More information about the cfe-commits mailing list