summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2012-05-31 23:18:32 +0000
committerFariborz Jahanian <fjahanian@apple.com>2012-05-31 23:18:32 +0000
commitbebd0ba549d9d8b268e124bd98ff3a3fdaea421e (patch)
tree9ec4c5b5a42d3fe9e930a7e93f23681eec535511 /clang/lib
parent4c0de496a07bff47c174841d422b20b28631b668 (diff)
downloadbcm5719-llvm-bebd0ba549d9d8b268e124bd98ff3a3fdaea421e.tar.gz
bcm5719-llvm-bebd0ba549d9d8b268e124bd98ff3a3fdaea421e.zip
objc: properties of NSObject attribute must
have correct pointer type or issue error, instead of crashing in IRGen. // rdar:// 11569860 llvm-svn: 157780
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaDeclAttr.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 4175ec1a26e..c98d2bb9f4d 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -2085,7 +2085,15 @@ static void handleObjCNSObject(Sema &S, Decl *D, const AttributeList &Attr) {
return;
}
}
- else if (!isa<ObjCPropertyDecl>(D)) {
+ else if (ObjCPropertyDecl *PD = dyn_cast<ObjCPropertyDecl>(D)) {
+ QualType T = PD->getType();
+ if (!T->isPointerType() ||
+ !T->getAs<PointerType>()->getPointeeType()->isRecordType()) {
+ S.Diag(PD->getLocation(), diag::err_nsobject_attribute);
+ return;
+ }
+ }
+ else {
// It is okay to include this attribute on properties, e.g.:
//
// @property (retain, nonatomic) struct Bork *Q __attribute__((NSObject));
OpenPOWER on IntegriCloud