aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-04-12 16:57:31 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-04-12 16:57:31 +0000
commit3be17941f1edff4843692066f9d33d438a517612 (patch)
tree3762b2523157da42b5b11a70f8442a3932f863d0
parent15f2e72f75932a66c4d7b27f5fa3d3be804cf5e2 (diff)
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
-rw-r--r--lib/Sema/SemaDeclAttr.cpp11
1 files changed, 8 insertions, 3 deletions
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<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.