aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclAttr.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-08-17 21:39:27 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-08-17 21:39:27 +0000
commit3a3400b4fdf73887e9d8b4372334bc24a858702f (patch)
treec9b722a656a4cfe492043aa44dda0ef9b7cf70a2 /lib/Sema/SemaDeclAttr.cpp
parentec8045d3f0375302eadaa63deb373bacaf25a569 (diff)
Diagnose use of iboutletcollection on ivar/property
of non-object types. Radar 8308053. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111296 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclAttr.cpp')
-rw-r--r--lib/Sema/SemaDeclAttr.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index 1e3405768a..7125c36a13 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -274,9 +274,23 @@ static void HandleIBOutletCollection(Decl *d, const AttributeList &Attr,
S.Diag(Attr.getLoc(), diag::err_attribute_iboutlet) << Attr.getName();
return;
}
+ if (const ValueDecl *VD = dyn_cast<ValueDecl>(d))
+ if (!VD->getType()->getAs<ObjCObjectPointerType>()) {
+ S.Diag(Attr.getLoc(), diag::err_iboutletcollection_object_type)
+ << VD->getType() << 0;
+ return;
+ }
+ if (const ObjCPropertyDecl *PD = dyn_cast<ObjCPropertyDecl>(d))
+ if (!PD->getType()->getAs<ObjCObjectPointerType>()) {
+ S.Diag(Attr.getLoc(), diag::err_iboutletcollection_object_type)
+ << PD->getType() << 1;
+ return;
+ }
+
IdentifierInfo *II = Attr.getParameterName();
if (!II)
II = &S.Context.Idents.get("id");
+
Sema::TypeTy *TypeRep = S.getTypeName(*II, Attr.getLoc(),
S.getScopeForContext(d->getDeclContext()->getParent()));
if (!TypeRep) {