]> granicus.if.org Git - clang/commitdiff
Ignore weak_import on Objective-C property and method declarations on
authorDouglas Gregor <dgregor@apple.com>
Wed, 23 Mar 2011 13:27:51 +0000 (13:27 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 23 Mar 2011 13:27:51 +0000 (13:27 +0000)
all platforms, not just darwin. Fixes the regression in this test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128147 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclAttr.cpp
test/SemaObjC/ignore-weakimport-method.m

index 3f33f144e48734f9f614c43acdc604fd850780b7..31523229c59008d317cdab3c7be8c05e59438814 100644 (file)
@@ -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<ObjCInterfaceDecl>(D) &&
-              !isa<ObjCPropertyDecl>(D) &&
-              !isa<ObjCMethodDecl>(D)))
+    else if (isa<ObjCPropertyDecl>(D) || isa<ObjCMethodDecl>(D) ||
+             (S.Context.Target.getTriple().getOS() == llvm::Triple::Darwin &&
+              isa<ObjCInterfaceDecl>(D))) {
+      // Nothing to warn about here.
+    } else
       S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
         << Attr.getName() << ExpectedVariableOrFunction;
 
index f80312ac06f35ad5f74d25c69a7dc9ec13ba1c37..d71cebf2c79a6e2252c0a9d393d5f329aebbdcac 100644 (file)
@@ -1,5 +1,4 @@
 // RUN: %clang_cc1  -fsyntax-only -verify %s
-
 @interface foo 
 + (void) cx __attribute__((weak_import));
 - (void) x __attribute__((weak_import));