[cfe-commits] r143082 - in /cfe/trunk: lib/Sema/SemaDeclAttr.cpp test/Sema/weak-import-on-enum.c

Fariborz Jahanian fjahanian at apple.com
Wed Oct 26 16:59:12 PDT 2011


Author: fjahanian
Date: Wed Oct 26 18:59:12 2011
New Revision: 143082

URL: http://llvm.org/viewvc/llvm-project?rev=143082&view=rev
Log:
Do not warn when weak-import attribute is applied to enum
decl. in Darwin due to certain projects requirement. 
// rdar://10277579

Added:
    cfe/trunk/test/Sema/weak-import-on-enum.c
Modified:
    cfe/trunk/lib/Sema/SemaDeclAttr.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=143082&r1=143081&r2=143082&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Wed Oct 26 18:59:12 2011
@@ -1949,7 +1949,7 @@
         << "weak_import" << 2 /*variable and function*/;
     else if (isa<ObjCPropertyDecl>(D) || isa<ObjCMethodDecl>(D) ||
              (S.Context.getTargetInfo().getTriple().isOSDarwin() &&
-              isa<ObjCInterfaceDecl>(D))) {
+              (isa<ObjCInterfaceDecl>(D) || isa<EnumDecl>(D)))) {
       // Nothing to warn about here.
     } else
       S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)

Added: cfe/trunk/test/Sema/weak-import-on-enum.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/weak-import-on-enum.c?rev=143082&view=auto
==============================================================================
--- cfe/trunk/test/Sema/weak-import-on-enum.c (added)
+++ cfe/trunk/test/Sema/weak-import-on-enum.c Wed Oct 26 18:59:12 2011
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1  -fsyntax-only -verify -triple x86_64-apple-darwin %s
+// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s
+// rdar://10277579
+
+enum __attribute__((deprecated)) __attribute__((weak_import)) A {
+    a0
+};
+





More information about the cfe-commits mailing list