From: Fariborz Jahanian Date: Mon, 12 Apr 2010 16:57:31 +0000 (+0000) Subject: Issue warning when 'weak_import' attribute is applied on a class only X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3be17941f1edff4843692066f9d33d438a517612;p=clang Issue warning when 'weak_import' attribute is applied on a class only when it is not supported in versions of MacOs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101044 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index cc24735c4a..aceaafcf3a 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -900,9 +900,14 @@ static void HandleWeakImportAttr(Decl *D, const AttributeList &Attr, Sema &S) { // We ignore weak import on properties and methods return; } else if (!(S.LangOpts.ObjCNonFragileABI && isa(D))) { - S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) - << Attr.getName() << 2 /*variable and function*/; - return; + if (S.Context.Target.getTriple().getOS() != llvm::Triple::Darwin || + !isa(D) || + S.Context.Target.getTriple().getDarwinMajorNumber() <= 10) { + + S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) + << Attr.getName() << 2 /*variable and function*/; + return; + } } // Merge should handle any subsequent violations.