From: Fariborz Jahanian Date: Tue, 4 Oct 2011 18:44:26 +0000 (+0000) Subject: objc: Turn diagnostic on property type mismatch in X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=68af536046461b514b59aedac016b52784ece3f7;p=clang objc: Turn diagnostic on property type mismatch in continuation class into warning. // rdar://10231514 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141100 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index 242c242d7d..e704b61bfd 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -99,6 +99,7 @@ def OverlengthStrings : DiagGroup<"overlength-strings">; def OverloadedVirtual : DiagGroup<"overloaded-virtual">; def ObjCMissingSuperCalls : DiagGroup<"objc-missing-super-calls">; def ObjCRetainBlockProperty : DiagGroup<"objc-noncopy-retain-block-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 19fe1c5ad0..5f36f18656 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -518,9 +518,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 error_type_mismatch_continuation_class : Error< +def warn_type_mismatch_continuation_class : Warning< "type of property %0 in continuation class does not match " - "property type in primary class">; + "property type in primary class">, InGroup; 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 80c4409074..880e9bfb2b 100644 --- a/lib/Sema/SemaObjCProperty.cpp +++ b/lib/Sema/SemaObjCProperty.cpp @@ -238,7 +238,7 @@ Sema::HandlePropertyInClassExtension(Scope *S, if (PIDecl->getType().getCanonicalType() != PDecl->getType().getCanonicalType()) { Diag(AtLoc, - diag::error_type_mismatch_continuation_class) << PDecl->getType(); + diag::warn_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 d017ac23dc..a579184060 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-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}} +@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}} @end