From: Aaron Ballman Date: Thu, 2 Jan 2014 22:45:33 +0000 (+0000) Subject: Reworded the NSObject attribute diagnostics to be more consistent with other attribut... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=60aca0e32e15111225b79b0581760c5bea03e56f;p=clang Reworded the NSObject attribute diagnostics to be more consistent with other attribute diagnostics. Also updated the associated test case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198368 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index c689e0d6ac..1f0a240fe0 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -1795,7 +1795,7 @@ def warn_auto_var_is_id : Warning< // Attributes def err_nsobject_attribute : Error< - "__attribute ((NSObject)) is for pointer types only">; + "'NSObject' attribute is for pointer types only">; def err_attribute_can_be_applied_only_to_symbol_declaration : Error< "%0 attribute can be applied only to symbol declaration">; def err_attributes_are_not_compatible : Error< @@ -2001,8 +2001,8 @@ def warn_gc_attribute_weak_on_local : Warning< "Objective-C GC does not allow weak variables on the stack">, InGroup; def warn_nsobject_attribute : Warning< - "__attribute ((NSObject)) may be put on a typedef only, " - "attribute is ignored">, InGroup; + "'NSObject' attribute may be put on a typedef only; attribute is ignored">, + InGroup; def warn_attribute_weak_on_local : Warning< "__weak attribute cannot be specified on an automatic variable when ARC " "is not enabled">, diff --git a/test/SemaObjC/nsobject-attribute.m b/test/SemaObjC/nsobject-attribute.m index ead222c331..6bd2d5dabc 100644 --- a/test/SemaObjC/nsobject-attribute.m +++ b/test/SemaObjC/nsobject-attribute.m @@ -6,7 +6,7 @@ typedef struct CGColor * __attribute__((NSObject(12))) Illegal; // expected-err static int count; static CGColorRef tmp = 0; -typedef struct S1 __attribute__ ((NSObject)) CGColorRef1; // expected-error {{__attribute ((NSObject)) is for pointer types only}} +typedef struct S1 __attribute__ ((NSObject)) CGColorRef1; // expected-error {{'NSObject' attribute is for pointer types only}} typedef void * __attribute__ ((NSObject)) CGColorRef2; // no-warning typedef void * CFTypeRef; @@ -48,18 +48,18 @@ int main(int argc, char *argv[]) { // rdar://10453342 @interface I { - __attribute__((NSObject)) void * color; // expected-warning {{__attribute ((NSObject)) may be put on a typedef only, attribute is ignored}} + __attribute__((NSObject)) void * color; // expected-warning {{'NSObject' attribute may be put on a typedef only; attribute is ignored}} } // @property (nonatomic, retain) __attribute__((NSObject)) CGColorRefNoNSObject color; // // no-warning @end void test_10453342() { - char* __attribute__((NSObject)) string2 = 0; // expected-warning {{__attribute ((NSObject)) may be put on a typedef only, attribute is ignored}} + char* __attribute__((NSObject)) string2 = 0; // expected-warning {{'NSObject' attribute may be put on a typedef only; attribute is ignored}} } // rdar://11569860 @interface A { int i; } -@property(retain) __attribute__((NSObject)) int i; // expected-error {{__attribute ((NSObject)) is for pointer types only}} \ +@property(retain) __attribute__((NSObject)) int i; // expected-error {{'NSObject' attribute is for pointer types only}} \ // expected-error {{property with 'retain (or strong)' attribute must be of object type}} @end