diff options
| -rw-r--r-- | clang/lib/AST/Type.cpp | 14 | ||||
| -rw-r--r-- | clang/test/SemaObjC/nsobject-attribute.m | 2 |
2 files changed, 13 insertions, 3 deletions
diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index 68e1fc09b8f..4c1d4ec540f 100644 --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -3686,10 +3686,18 @@ bool Type::isObjCARCImplicitlyUnretainedType() const { } bool Type::isObjCNSObjectType() const { - if (const TypedefType *typedefType = dyn_cast<TypedefType>(this)) - return typedefType->getDecl()->hasAttr<ObjCNSObjectAttr>(); - return false; + const Type *cur = this; + while (true) { + if (const TypedefType *typedefType = dyn_cast<TypedefType>(cur)) + return typedefType->getDecl()->hasAttr<ObjCNSObjectAttr>(); + + // Single-step desugar until we run out of sugar. + QualType next = cur->getLocallyUnqualifiedSingleStepDesugaredType(); + if (next.getTypePtr() == cur) return false; + cur = next.getTypePtr(); + } } + bool Type::isObjCIndependentClassType() const { if (const TypedefType *typedefType = dyn_cast<TypedefType>(this)) return typedefType->getDecl()->hasAttr<ObjCIndependentClassAttr>(); diff --git a/clang/test/SemaObjC/nsobject-attribute.m b/clang/test/SemaObjC/nsobject-attribute.m index 6bd2d5dabc4..7c8d75d531e 100644 --- a/clang/test/SemaObjC/nsobject-attribute.m +++ b/clang/test/SemaObjC/nsobject-attribute.m @@ -21,6 +21,8 @@ typedef struct CGColor * __attribute__((NSObject)) CGColorRefNoNSObject; // no-w @property (nonatomic, retain) CGColorRefNoNSObject color; // rdar://problem/12197822 @property (strong) __attribute__((NSObject)) CFTypeRef myObj; // no-warning +//rdar://problem/27747154 +@property (strong, nullable) CGColorRefNoNSObject color2; // no-warning @end void setProperty(id self, id value) { |

