From 6b65d4a9cc5aed96a7f1a36e75dd9c4adb164e0b Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Fri, 16 Dec 2011 15:54:29 +0000 Subject: [PATCH] objc: after issuing the warning on direct use of __attribute__((NSObject)) on properties, prevent consequential error diagnostics. // rdar://10591336 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146737 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaDeclAttr.cpp | 4 +--- test/SemaObjC/nsobject-attribute.m | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 63714fdfa7..1626bf14b6 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -1753,10 +1753,8 @@ static void handleObjCNSObject(Sema &S, Decl *D, const AttributeList &Attr) { return; } } - else { + else S.Diag(D->getLocation(), diag::warn_nsobject_attribute); - return; - } D->addAttr(::new (S.Context) ObjCNSObjectAttr(Attr.getRange(), S.Context)); } diff --git a/test/SemaObjC/nsobject-attribute.m b/test/SemaObjC/nsobject-attribute.m index 99f332de0a..46e84d207c 100644 --- a/test/SemaObjC/nsobject-attribute.m +++ b/test/SemaObjC/nsobject-attribute.m @@ -45,8 +45,7 @@ int main(int argc, char *argv[]) { { __attribute__((NSObject)) void * color; // expected-warning {{__attribute ((NSObject)) may be put on a typedef only, attribute is ignored}} } -@property (nonatomic, retain) __attribute__((NSObject)) void * color; // expected-warning {{__attribute ((NSObject)) may be put on a typedef only, attribute is ignored}} \ - // expected-error {{property with 'retain (or strong)' attribute must be of object type}} +@property (nonatomic, retain) __attribute__((NSObject)) void * color; // expected-warning {{__attribute ((NSObject)) may be put on a typedef only, attribute is ignored}} @end void test_10453342() { char* __attribute__((NSObject)) string2 = 0; // expected-warning {{__attribute ((NSObject)) may be put on a typedef only, attribute is ignored}} -- 2.40.0