From 90eed219f4215adf300800ab7478f568c7a4b2a3 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Wed, 26 Oct 2011 23:59:12 +0000 Subject: [PATCH] Do not warn when weak-import attribute is applied to enum 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 | 2 +- test/Sema/weak-import-on-enum.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 test/Sema/weak-import-on-enum.c diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index d43e1f1a9b..9f025a2b76 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -1949,7 +1949,7 @@ static void handleWeakImportAttr(Sema &S, Decl *D, const AttributeList &Attr) { << "weak_import" << 2 /*variable and function*/; else if (isa(D) || isa(D) || (S.Context.getTargetInfo().getTriple().isOSDarwin() && - isa(D))) { + (isa(D) || isa(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 index 0000000000..3a2c0e5b3a --- /dev/null +++ b/test/Sema/weak-import-on-enum.c @@ -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 +}; +