]> granicus.if.org Git - clang/commitdiff
Do not warn when weak-import attribute is applied to enum
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 26 Oct 2011 23:59:12 +0000 (23:59 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 26 Oct 2011 23:59:12 +0000 (23:59 +0000)
decl. in Darwin due to certain projects requirement.
// rdar://10277579

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143082 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclAttr.cpp
test/Sema/weak-import-on-enum.c [new file with mode: 0644]

index d43e1f1a9baf551a286625d984f204a01ed9c0b9..9f025a2b76a228dda6446cc7687a136640767900 100644 (file)
@@ -1949,7 +1949,7 @@ static void handleWeakImportAttr(Sema &S, Decl *D, const AttributeList &Attr) {
         << "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)
diff --git a/test/Sema/weak-import-on-enum.c b/test/Sema/weak-import-on-enum.c
new file mode 100644 (file)
index 0000000..3a2c0e5
--- /dev/null
@@ -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
+};
+