[llvm-branch-commits] [cfe-branch] r195141 - Merging r195135:

Bill Wendling isanbard at gmail.com
Tue Nov 19 10:43:09 PST 2013


Author: void
Date: Tue Nov 19 12:43:09 2013
New Revision: 195141

URL: http://llvm.org/viewvc/llvm-project?rev=195141&view=rev
Log:
Merging r195135:
------------------------------------------------------------------------
r195135 | fjahanian | 2013-11-19 09:42:25 -0800 (Tue, 19 Nov 2013) | 3 lines

bjectiveC. Use a uniform diagnostic for
'objc_bridge' attribute. // rdar://15454846.

------------------------------------------------------------------------

Modified:
    cfe/branches/release_34/   (props changed)
    cfe/branches/release_34/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/branches/release_34/lib/Sema/SemaDeclAttr.cpp
    cfe/branches/release_34/test/SemaObjC/objcbridge-attribute.m

Propchange: cfe/branches/release_34/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov 19 12:43:09 2013
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:195126,195128
+/cfe/trunk:195126,195128,195135
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_34/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_34/include/clang/Basic/DiagnosticSemaKinds.td?rev=195141&r1=195140&r2=195141&view=diff
==============================================================================
--- cfe/branches/release_34/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/branches/release_34/include/clang/Basic/DiagnosticSemaKinds.td Tue Nov 19 12:43:09 2013
@@ -2051,7 +2051,7 @@ def err_attribute_wrong_decl_type : Erro
   "variables, functions and tag types|thread-local variables|"
   "variables and fields|variables, data members and tag types|"
   "types and namespaces|Objective-C interfaces|"
-  "methods and properties}1">;
+  "methods and properties|struct or union|struct, union or class}1">;
 def warn_type_attribute_wrong_type : Warning<
   "'%0' only applies to %select{function|pointer|"
   "Objective-C object or block pointer}1 types; type here is %2">,
@@ -2441,8 +2441,6 @@ def err_ns_bridged_not_interface : Error
 // objc_bridge attribute diagnostics.
 def err_objc_bridge_not_id : Error<
   "parameter of 'objc_bridge' attribute must be a single name of an Objective-C class">;
-def err_objc_bridge_attribute : Error<
-  "'objc_bridge' attribute must be applied to a struct%select{|, C++ class}0 or union">;
 def err_objc_cf_bridged_not_interface : Error<
   "CF object of type %0 is bridged to '%1', which is not an Objective-C class">;
 def err_objc_ns_bridged_invalid_cfobject : Error<

Modified: cfe/branches/release_34/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_34/lib/Sema/SemaDeclAttr.cpp?rev=195141&r1=195140&r2=195141&view=diff
==============================================================================
--- cfe/branches/release_34/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/branches/release_34/lib/Sema/SemaDeclAttr.cpp Tue Nov 19 12:43:09 2013
@@ -55,7 +55,9 @@ enum AttributeDeclKind {
   ExpectedVariableFieldOrTag,
   ExpectedTypeOrNamespace,
   ExpectedObjectiveCInterface,
-  ExpectedMethodOrProperty
+  ExpectedMethodOrProperty,
+  ExpectedStructOrUnion,
+  ExpectedStructOrUnionOrClass
 };
 
 //===----------------------------------------------------------------------===//
@@ -4392,8 +4394,10 @@ static void handleNSBridgedAttr(Sema &S,
 static void handleObjCBridgeAttr(Sema &S, Scope *Sc, Decl *D,
                                 const AttributeList &Attr) {
   if (!isa<RecordDecl>(D)) {
-    S.Diag(D->getLocStart(), diag::err_objc_bridge_attribute)
-      << S.getLangOpts().CPlusPlus;
+    S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type)
+    << Attr.getName()
+    << (S.getLangOpts().CPlusPlus ? ExpectedStructOrUnionOrClass
+                                  : ExpectedStructOrUnion);
     return;
   }
   

Modified: cfe/branches/release_34/test/SemaObjC/objcbridge-attribute.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_34/test/SemaObjC/objcbridge-attribute.m?rev=195141&r1=195140&r2=195141&view=diff
==============================================================================
--- cfe/branches/release_34/test/SemaObjC/objcbridge-attribute.m (original)
+++ cfe/branches/release_34/test/SemaObjC/objcbridge-attribute.m Tue Nov 19 12:43:09 2013
@@ -7,28 +7,28 @@ typedef struct __attribute__((objc_bridg
 
 typedef struct __attribute__ ((objc_bridge)) __CFArray *CFArrayRef; // expected-error {{parameter of 'objc_bridge' attribute must be a single name of an Objective-C class}}
 
-typedef void *  __attribute__ ((objc_bridge(NSURL))) CFURLRef;  // expected-error {{'objc_bridge' attribute must be applied to a struct or union}}
+typedef void *  __attribute__ ((objc_bridge(NSURL))) CFURLRef;  // expected-error {{'objc_bridge' attribute only applies to struct or union}}
 
-typedef void * CFStringRef __attribute__ ((objc_bridge(NSString))); // expected-error {{'objc_bridge' attribute must be applied to a struct or union}}
+typedef void * CFStringRef __attribute__ ((objc_bridge(NSString))); // expected-error {{'objc_bridge' attribute only applies to struct or union}}
 
 typedef struct __attribute__((objc_bridge(NSLocale, NSError))) __CFLocale *CFLocaleRef;// expected-error {{use of undeclared identifier 'NSError'}}
 
-typedef struct __CFData __attribute__((objc_bridge(NSData))) CFDataRef; // expected-error {{'objc_bridge' attribute must be applied to a struct or union}}
+typedef struct __CFData __attribute__((objc_bridge(NSData))) CFDataRef; // expected-error {{'objc_bridge' attribute only applies to struct or union}}
 
 typedef struct __attribute__((objc_bridge(NSDictionary))) __CFDictionary * CFDictionaryRef;
 
-typedef struct __CFSetRef * CFSetRef __attribute__((objc_bridge(NSSet))); // expected-error {{'objc_bridge' attribute must be applied to a struct or union}};
+typedef struct __CFSetRef * CFSetRef __attribute__((objc_bridge(NSSet))); // expected-error {{'objc_bridge' attribute only applies to struct or union}};
 
-typedef union __CFUColor __attribute__((objc_bridge(NSUColor))) * CFUColorRef; // expected-error {{'objc_bridge' attribute must be applied to a struct or union}};
+typedef union __CFUColor __attribute__((objc_bridge(NSUColor))) * CFUColorRef; // expected-error {{'objc_bridge' attribute only applies to struct or union}};
 
-typedef union __CFUColor __attribute__((objc_bridge(NSUColor))) *CFUColor1Ref; // expected-error {{'objc_bridge' attribute must be applied to a struct or union}};
+typedef union __CFUColor __attribute__((objc_bridge(NSUColor))) *CFUColor1Ref; // expected-error {{'objc_bridge' attribute only applies to struct or union}};
 
 typedef union __attribute__((objc_bridge(NSUColor))) __CFUPrimeColor XXX;
 typedef XXX *CFUColor2Ref;
 
 @interface I
 {
-   __attribute__((objc_bridge(NSError))) void * color; // expected-error {{'objc_bridge' attribute must be applied to a struct or union}};
+   __attribute__((objc_bridge(NSError))) void * color; // expected-error {{'objc_bridge' attribute only applies to struct or union}};
 }
 @end
 





More information about the llvm-branch-commits mailing list