From: Fariborz Jahanian Date: Mon, 28 Nov 2011 18:38:27 +0000 (+0000) Subject: objc: turn warning for property type mismatch in X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d3c147f4b225a8372c90e07ae3eed0dca9ffb33f;p=clang objc: turn warning for property type mismatch in primary and its continuation class into error. // rdar://10142679 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145255 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index e6dd6e86b9..38a7c19a35 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -123,7 +123,6 @@ def OverloadedVirtual : DiagGroup<"overloaded-virtual">; def ObjCMissingSuperCalls : DiagGroup<"objc-missing-super-calls">; def ObjCRetainBlockProperty : DiagGroup<"objc-noncopy-retain-block-property">; def ObjCReadonlyPropertyHasSetter : DiagGroup<"objc-readonly-with-setter-property">; -def ObjCContinuationPropertyType :DiagGroup<"objc-continuation-property-type">; def Packed : DiagGroup<"packed">; def Padded : DiagGroup<"padded">; def PointerArith : DiagGroup<"pointer-arith">; diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 6a5cd22930..f566e10894 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -539,9 +539,9 @@ def warn_default_atomic_custom_getter_setter : Warning< def err_use_continuation_class : Error< "illegal redeclaration of property in continuation class %0" " (attribute must be 'readwrite', while its primary must be 'readonly')">; -def warn_type_mismatch_continuation_class : Warning< +def err_type_mismatch_continuation_class : Error< "type of property %0 in continuation class does not match " - "property type in primary class">, InGroup; + "property type in primary class">; def err_use_continuation_class_redeclaration_readwrite : Error< "illegal redeclaration of 'readwrite' property in continuation class %0" " (perhaps you intended this to be a 'readwrite' redeclaration of a " diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp index 90d2d93431..c47a305b96 100644 --- a/lib/Sema/SemaObjCProperty.cpp +++ b/lib/Sema/SemaObjCProperty.cpp @@ -279,7 +279,7 @@ Sema::HandlePropertyInClassExtension(Scope *S, if (PIDecl->getType().getCanonicalType() != PDecl->getType().getCanonicalType()) { Diag(AtLoc, - diag::warn_type_mismatch_continuation_class) << PDecl->getType(); + diag::err_type_mismatch_continuation_class) << PDecl->getType(); Diag(PIDecl->getLocation(), diag::note_property_declare); } diff --git a/test/SemaObjC/continuation-class-property.m b/test/SemaObjC/continuation-class-property.m index a579184060..d017ac23dc 100644 --- a/test/SemaObjC/continuation-class-property.m +++ b/test/SemaObjC/continuation-class-property.m @@ -38,6 +38,6 @@ typedef struct { @end @interface MyClass () -@property (readwrite) NSString *foo; // expected-warning {{type of property 'NSString *' in continuation class does not match property type in primary class}} -@property (readwrite, strong) NSRect bar; // expected-warning {{type of property 'NSRect' in continuation class does not match property type in primary class}} +@property (readwrite) NSString *foo; // expected-error {{type of property 'NSString *' in continuation class does not match property type in primary class}} +@property (readwrite, strong) NSRect bar; // expected-error {{type of property 'NSRect' in continuation class does not match property type in primary class}} @end