Issue warning when 'weak_import' attribute is applied on a class only

when it is not supported in versions of MacOs.

llvm-svn: 101044
This commit is contained in:
Fariborz Jahanian 2010-04-12 16:57:31 +00:00
parent e4148978b8
commit 5ea6bdd0ea
1 changed files with 8 additions and 3 deletions

View File

@ -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<ObjCInterfaceDecl>(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<ObjCInterfaceDecl>(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.