From 38cae30095e5356e7d5aeb16a646faf5e96ff471 Mon Sep 17 00:00:00 2001 From: Mike Stump Date: Wed, 18 Mar 2009 15:05:17 +0000 Subject: [PATCH] Ignore weak import on properties. llvm-svn: 67205 --- clang/lib/Sema/SemaDeclAttr.cpp | 2 ++ clang/test/SemaObjC/property-weak.m | 5 +++++ 2 files changed, 7 insertions(+) create mode 100644 clang/test/SemaObjC/property-weak.m diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 96812018a193..174bfc62649e 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -761,6 +761,8 @@ static void HandleWeakImportAttr(Decl *D, const AttributeList &Attr, Sema &S) { isDef = (!VD->hasExternalStorage() || VD->getInit()); } else if (FunctionDecl *FD = dyn_cast(D)) { isDef = FD->getBody(); + } else if (isa(D)) { + // We ignore weak import on properties } else { S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) << "weak_import" << 2 /*variable and function*/; diff --git a/clang/test/SemaObjC/property-weak.m b/clang/test/SemaObjC/property-weak.m new file mode 100644 index 000000000000..2e5edbd5c506 --- /dev/null +++ b/clang/test/SemaObjC/property-weak.m @@ -0,0 +1,5 @@ +// RUN: clang -triple i386-apple-darwin9 -fsyntax-only -verify %s + +@interface foo +@property(nonatomic) int foo __attribute__((weak_import)); +@end