]> granicus.if.org Git - clang/commitdiff
objc: more changes in use of IBOutletCollection attribute.
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 18 Oct 2011 19:54:31 +0000 (19:54 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 18 Oct 2011 19:54:31 +0000 (19:54 +0000)
'Class' is disallowed as argument.  If the argument is missing,
NSObject is assumed. // rdar://10296078

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142409 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclAttr.cpp
test/SemaObjC/iboutletcollection-attr.m

index 69baf79ad0fe01e3b3e5769eb9b04211552090d5..b83b716fdf01f38b1a55de3aeb2e9d6eb4fcc2cf 100644 (file)
@@ -805,7 +805,7 @@ static void handleIBOutletCollection(Sema &S, Decl *D,
 
   IdentifierInfo *II = Attr.getParameterName();
   if (!II)
-    II = &S.Context.Idents.get("id");
+    II = &S.Context.Idents.get("NSObject");
   
   ParsedType TypeRep = S.getTypeName(*II, Attr.getLoc(), 
                         S.getScopeForContext(D->getDeclContext()->getParent()));
@@ -818,8 +818,7 @@ static void handleIBOutletCollection(Sema &S, Decl *D,
   // FIXME. Gnu attribute extension ignores use of builtin types in
   // attributes. So, __attribute__((iboutletcollection(char))) will be
   // treated as __attribute__((iboutletcollection())).
-  if (!QT->isObjCIdType() && !QT->isObjCClassType() &&
-      !QT->isObjCObjectType()) {
+  if (!QT->isObjCIdType() && !QT->isObjCObjectType()) {
     S.Diag(Attr.getLoc(), diag::err_iboutletcollection_type) << II;
     return;
   }
index 052fe9fb00b56e874648342ea86570ea7e07ec95..1491b3292d40d8545692fc554554f652a8b1fe41 100644 (file)
@@ -2,6 +2,8 @@
 // RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify %s
 // rdar://8308053
 
+@class NSObject;
+
 @interface I {
     __attribute__((iboutletcollection(I))) id ivar1;
     __attribute__((iboutletcollection(id))) id ivar2;