diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-08-17 21:39:27 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-08-17 21:39:27 +0000 |
commit | 798f83239caa0573b46b60a0527580e2941875f2 (patch) | |
tree | 0510a2ad8d68fcf624576337c2e0f45a43b346b8 /clang/lib/Sema/SemaDeclAttr.cpp | |
parent | 8a05de4d29d2981673c0cf9e3efdccc1908dacce (diff) | |
download | bcm5719-llvm-798f83239caa0573b46b60a0527580e2941875f2.tar.gz bcm5719-llvm-798f83239caa0573b46b60a0527580e2941875f2.zip |
Diagnose use of iboutletcollection on ivar/property
of non-object types. Radar 8308053.
llvm-svn: 111296
Diffstat (limited to 'clang/lib/Sema/SemaDeclAttr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 1e3405768ae..7125c36a130 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/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) { |