From d71149a45316daef5f86cf63f8435793aeef83bf Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Wed, 23 Mar 2011 13:27:51 +0000 Subject: [PATCH] Ignore weak_import on Objective-C property and method declarations on all platforms, not just darwin. Fixes the regression in this test case. llvm-svn: 128147 --- clang/lib/Sema/SemaDeclAttr.cpp | 9 +++++---- clang/test/SemaObjC/ignore-weakimport-method.m | 1 - 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 3f33f144e487..31523229c590 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -1436,10 +1436,11 @@ static void HandleWeakImportAttr(Decl *D, const AttributeList &Attr, Sema &S) { S.Diag(Attr.getLoc(), diag::warn_attribute_weak_import_invalid_on_definition) << "weak_import" << 2 /*variable and function*/; - else if (S.Context.Target.getTriple().getOS() != llvm::Triple::Darwin || - (!isa(D) && - !isa(D) && - !isa(D))) + else if (isa(D) || isa(D) || + (S.Context.Target.getTriple().getOS() == llvm::Triple::Darwin && + isa(D))) { + // Nothing to warn about here. + } else S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) << Attr.getName() << ExpectedVariableOrFunction; diff --git a/clang/test/SemaObjC/ignore-weakimport-method.m b/clang/test/SemaObjC/ignore-weakimport-method.m index f80312ac06f3..d71cebf2c79a 100644 --- a/clang/test/SemaObjC/ignore-weakimport-method.m +++ b/clang/test/SemaObjC/ignore-weakimport-method.m @@ -1,5 +1,4 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s - @interface foo + (void) cx __attribute__((weak_import)); - (void) x __attribute__((weak_import));