diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-05-04 19:35:12 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-05-04 19:35:12 +0000 |
commit | d4edddde6d3966ad4a4f60d9af0f9dd36995495c (patch) | |
tree | d8ca5708fcec1297ac4fbcd2a9ede4f11c4944dc | |
parent | 75494ffb4ed3964fa22fb9ab15fddecedbc9fe10 (diff) |
ignore weak_import attribute on objc method decls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70901 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaDeclAttr.cpp | 4 | ||||
-rw-r--r-- | test/SemaObjC/ignore-weakimport-method.m | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 8aec8c8e07..b29bcec1aa 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -775,8 +775,8 @@ static void HandleWeakImportAttr(Decl *D, const AttributeList &Attr, Sema &S) { isDef = (!VD->hasExternalStorage() || VD->getInit()); } else if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) { isDef = FD->getBody(S.Context); - } else if (isa<ObjCPropertyDecl>(D)) { - // We ignore weak import on properties + } else if (isa<ObjCPropertyDecl>(D) || isa<ObjCMethodDecl>(D)) { + // We ignore weak import on properties and methods return; } else { S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) diff --git a/test/SemaObjC/ignore-weakimport-method.m b/test/SemaObjC/ignore-weakimport-method.m new file mode 100644 index 0000000000..369d9023ac --- /dev/null +++ b/test/SemaObjC/ignore-weakimport-method.m @@ -0,0 +1,7 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +@interface foo ++ (void) cx __attribute__((weak_import)); +- (void) x __attribute__((weak_import)); +@end + |