From: Ted Kremenek Date: Tue, 1 Nov 2011 18:08:35 +0000 (+0000) Subject: Downgrade err_iboutlet_object_type to a warning. It was breaking a bunch of code... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0bfaf067c294bc4064c2f1aee0bc1c51e861ac65;p=clang Downgrade err_iboutlet_object_type to a warning. It was breaking a bunch of code. We will reconsider promoting it back to an error later. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143470 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 1b1d0b151d..9041a768a7 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -1695,9 +1695,10 @@ def warn_attribute_ibaction: Warning< "ibaction attribute can only be applied to Objective-C instance methods">; def err_iboutletcollection_type : Error< "invalid type %0 as argument of iboutletcollection attribute">; -def err_iboutlet_object_type : Error< +def warn_iboutlet_object_type : Warning< "%select{ivar|property}2 with %0 attribute must " - "be an object type (invalid %1)">; + "be an object type (invalid %1)">, + InGroup>; def err_attribute_overloadable_not_function : Error< "'overloadable' attribute can only be applied to a function">; def err_attribute_overloadable_missing : Error< diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 9f025a2b76..74d22e7efe 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -760,14 +760,14 @@ static bool checkIBOutletCommon(Sema &S, Decl *D, const AttributeList &Attr) { // have an object reference type. if (const ObjCIvarDecl *VD = dyn_cast(D)) { if (!VD->getType()->getAs()) { - S.Diag(Attr.getLoc(), diag::err_iboutlet_object_type) + S.Diag(Attr.getLoc(), diag::warn_iboutlet_object_type) << Attr.getName() << VD->getType() << 0; return false; } } else if (const ObjCPropertyDecl *PD = dyn_cast(D)) { if (!PD->getType()->getAs()) { - S.Diag(Attr.getLoc(), diag::err_iboutlet_object_type) + S.Diag(Attr.getLoc(), diag::warn_iboutlet_object_type) << Attr.getName() << PD->getType() << 1; return false; } diff --git a/test/SemaObjC/iboutletcollection-attr.m b/test/SemaObjC/iboutletcollection-attr.m index 7caebb059e..22c21a764b 100644 --- a/test/SemaObjC/iboutletcollection-attr.m +++ b/test/SemaObjC/iboutletcollection-attr.m @@ -21,14 +21,14 @@ typedef void *PV; __attribute__((iboutletcollection(I, 1))) id ivar1; // expected-error {{attribute takes one argument}} __attribute__((iboutletcollection(B))) id ivar2; // expected-error {{invalid type 'B' as argument of iboutletcollection attribute}} __attribute__((iboutletcollection(PV))) id ivar3; // expected-error {{invalid type 'PV' as argument of iboutletcollection attribute}} - __attribute__((iboutletcollection(PV))) void *ivar4; // expected-error {{ivar with 'iboutletcollection' attribute must be an object type (invalid 'void *')}} + __attribute__((iboutletcollection(PV))) void *ivar4; // expected-warning {{ivar with 'iboutletcollection' attribute must be an object type (invalid 'void *')}} __attribute__((iboutletcollection(int))) id ivar5; // expected-error {{type argument of iboutletcollection attribute cannot be a builtin type}} - __attribute__((iboutlet)) int ivar6; // expected-error {{ivar with 'iboutlet' attribute must be an object type}} + __attribute__((iboutlet)) int ivar6; // expected-warning {{ivar with 'iboutlet' attribute must be an object type}} } @property (nonatomic, retain) __attribute__((iboutletcollection(I,2,3))) id prop1; // expected-error {{attribute takes one argument}} @property (nonatomic, retain) __attribute__((iboutletcollection(B))) id prop2; // expected-error {{invalid type 'B' as argument of iboutletcollection attribute}} -@property __attribute__((iboutletcollection(BAD))) int prop3; // expected-error {{property with 'iboutletcollection' attribute must be an object type (invalid 'int')}} +@property __attribute__((iboutletcollection(BAD))) int prop3; // expected-warning {{property with 'iboutletcollection' attribute must be an object type (invalid 'int')}} @end // rdar://10296078