diff options
author | Ted Kremenek <kremenek@apple.com> | 2012-08-29 22:54:47 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2012-08-29 22:54:47 +0000 |
commit | 7712eef0d753b11993f2905a3d9b656294ee0f71 (patch) | |
tree | 3a512cdb29d3ea3b379206adfba73607367b0d46 | |
parent | e635db4923b7985befb4b1e63f874ecc39a75a02 (diff) | |
download | bcm5719-llvm-7712eef0d753b11993f2905a3d9b656294ee0f71.tar.gz bcm5719-llvm-7712eef0d753b11993f2905a3d9b656294ee0f71.zip |
Fix serious regression introduced in r157780 where __attribute__((NSObject))
could not be attached to a CFTypeRef.
Fixes <rdar://problem/12197822>
llvm-svn: 162872
-rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 6 | ||||
-rw-r--r-- | clang/test/SemaObjC/nsobject-attribute.m | 10 |
2 files changed, 8 insertions, 8 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index fcfa574d599..24268453125 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -2268,16 +2268,14 @@ static void handleObjCNSObject(Sema &S, Decl *D, const AttributeList &Attr) { } if (TypedefNameDecl *TD = dyn_cast<TypedefNameDecl>(D)) { QualType T = TD->getUnderlyingType(); - if (!T->isPointerType() || - !T->getAs<PointerType>()->getPointeeType()->isRecordType()) { + if (!T->isCARCBridgableType()) { S.Diag(TD->getLocation(), diag::err_nsobject_attribute); return; } } else if (ObjCPropertyDecl *PD = dyn_cast<ObjCPropertyDecl>(D)) { QualType T = PD->getType(); - if (!T->isPointerType() || - !T->getAs<PointerType>()->getPointeeType()->isRecordType()) { + if (!T->isCARCBridgableType()) { S.Diag(PD->getLocation(), diag::err_nsobject_attribute); return; } diff --git a/clang/test/SemaObjC/nsobject-attribute.m b/clang/test/SemaObjC/nsobject-attribute.m index e3f28740dc8..133ca16204c 100644 --- a/clang/test/SemaObjC/nsobject-attribute.m +++ b/clang/test/SemaObjC/nsobject-attribute.m @@ -5,8 +5,8 @@ static int count; static CGColorRef tmp = 0; typedef struct S1 __attribute__ ((NSObject)) CGColorRef1; // expected-error {{__attribute ((NSObject)) is for pointer types only}} -typedef void * __attribute__ ((NSObject)) CGColorRef2; // expected-error {{__attribute ((NSObject)) is for pointer types only}} - +typedef void * __attribute__ ((NSObject)) CGColorRef2; // no-warning +typedef void * CFTypeRef; @interface HandTested { @public @@ -14,9 +14,11 @@ typedef void * __attribute__ ((NSObject)) CGColorRef2; // expected-error {{__at } @property(copy) CGColorRef x; -// rdar: // 7809460 -typedef struct CGColor * __attribute__((NSObject)) CGColorRefNoNSObject; +// rdar://problem/7809460 +typedef struct CGColor * __attribute__((NSObject)) CGColorRefNoNSObject; // no-warning @property (nonatomic, retain) CGColorRefNoNSObject color; +// rdar://problem/12197822 +@property (strong) __attribute__((NSObject)) CFTypeRef myObj; // no-warning @end void setProperty(id self, id value) { |