[cfe-commits] r113096 - in /cfe/trunk: lib/AST/TypePrinter.cpp test/SemaObjC/method-arg-qualifier-warning.m test/SemaObjCXX/objc-pointer-conv.mm

Chris Lattner sabre at nondot.org
Sat Sep 4 17:43:21 PDT 2010


Author: lattner
Date: Sat Sep  4 19:43:21 2010
New Revision: 113096

URL: http://llvm.org/viewvc/llvm-project?rev=113096&view=rev
Log:
"const id<NSFoo> *" instead of "id<NSFoo> const *".

I think this wraps up all the legal cases.

Modified:
    cfe/trunk/lib/AST/TypePrinter.cpp
    cfe/trunk/test/SemaObjC/method-arg-qualifier-warning.m
    cfe/trunk/test/SemaObjCXX/objc-pointer-conv.mm

Modified: cfe/trunk/lib/AST/TypePrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TypePrinter.cpp?rev=113096&r1=113095&r2=113096&view=diff
==============================================================================
--- cfe/trunk/lib/AST/TypePrinter.cpp (original)
+++ cfe/trunk/lib/AST/TypePrinter.cpp Sat Sep  4 19:43:21 2010
@@ -680,14 +680,19 @@
                                          std::string &S) { 
   std::string ObjCQIString;
   
+  T->getPointeeType().getLocalQualifiers().getAsStringInternal(ObjCQIString, 
+                                                               Policy);
+  if (!ObjCQIString.empty())
+    ObjCQIString += ' ';
+    
   if (T->isObjCIdType() || T->isObjCQualifiedIdType())
-    ObjCQIString = "id";
+    ObjCQIString += "id";
   else if (T->isObjCClassType() || T->isObjCQualifiedClassType())
-    ObjCQIString = "Class";
+    ObjCQIString += "Class";
   else if (T->isObjCSelType())
-    ObjCQIString = "SEL";
+    ObjCQIString += "SEL";
   else
-    ObjCQIString = T->getInterfaceDecl()->getNameAsString();
+    ObjCQIString += T->getInterfaceDecl()->getNameAsString();
   
   if (!T->qual_empty()) {
     ObjCQIString += '<';
@@ -701,9 +706,6 @@
     ObjCQIString += '>';
   }
   
-  T->getPointeeType().getLocalQualifiers().getAsStringInternal(ObjCQIString, 
-                                                               Policy);
-  
   if (!T->isObjCIdType() && !T->isObjCQualifiedIdType())
     ObjCQIString += " *"; // Don't forget the implicit pointer.
   else if (!S.empty()) // Prefix the basic type, e.g. 'typedefname X'.

Modified: cfe/trunk/test/SemaObjC/method-arg-qualifier-warning.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/method-arg-qualifier-warning.m?rev=113096&r1=113095&r2=113096&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/method-arg-qualifier-warning.m (original)
+++ cfe/trunk/test/SemaObjC/method-arg-qualifier-warning.m Sat Sep  4 19:43:21 2010
@@ -12,8 +12,8 @@
 
 int main () {
         
-    [@"Identifier1" isEqualToString:Identifier1]; // expected-warning {{sending 'NSString const *' to parameter of type 'NSString *' discards qualifiers}}
-    [@"Identifier2" isEqualToString:Identifier2]; // expected-warning {{sending 'NSString const *' to parameter of type 'NSString *' discards qualifiers}}
+    [@"Identifier1" isEqualToString:Identifier1]; // expected-warning {{sending 'const NSString *' to parameter of type 'NSString *' discards qualifiers}}
+    [@"Identifier2" isEqualToString:Identifier2]; // expected-warning {{sending 'const NSString *' to parameter of type 'NSString *' discards qualifiers}}
     [@"Identifier3" isEqualToString:Identifier3];
     return 0;
 }

Modified: cfe/trunk/test/SemaObjCXX/objc-pointer-conv.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/objc-pointer-conv.mm?rev=113096&r1=113095&r2=113096&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjCXX/objc-pointer-conv.mm (original)
+++ cfe/trunk/test/SemaObjCXX/objc-pointer-conv.mm Sat Sep  4 19:43:21 2010
@@ -29,10 +29,10 @@
 - (void) Meth : (I*) Arg; // expected-note{{passing argument to parameter 'Arg' here}}
 @end
 
-void Func (I* arg);  // expected-note {{candidate function not viable: no known conversion from 'I const *' to 'I *' for 1st argument}}
+void Func (I* arg);  // expected-note {{candidate function not viable: no known conversion from 'const I *' to 'I *' for 1st argument}}
 
 void foo(const I *p, I* sel) {
-  [sel Meth : p];	// expected-error {{cannot initialize a parameter of type 'I *' with an lvalue of type 'I const *'}}
+  [sel Meth : p];	// expected-error {{cannot initialize a parameter of type 'I *' with an lvalue of type 'const I *'}}
   Func(p);		// expected-error {{no matching function for call to 'Func'}}
 }
 





More information about the cfe-commits mailing list