diff options
author | Chris Lattner <sabre@nondot.org> | 2010-09-05 00:43:21 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-09-05 00:43:21 +0000 |
commit | 938cebc076fe944f0ab9eaf95a273d18455de7c5 (patch) | |
tree | c46a07c884796e01daa4a46e6f1974967bb1973f | |
parent | edead1266e20f0e45a41a52fca80cc2df87c05aa (diff) | |
download | bcm5719-llvm-938cebc076fe944f0ab9eaf95a273d18455de7c5.tar.gz bcm5719-llvm-938cebc076fe944f0ab9eaf95a273d18455de7c5.zip |
"const id<NSFoo> *" instead of "id<NSFoo> const *".
I think this wraps up all the legal cases.
llvm-svn: 113096
-rw-r--r-- | clang/lib/AST/TypePrinter.cpp | 16 | ||||
-rw-r--r-- | clang/test/SemaObjC/method-arg-qualifier-warning.m | 4 | ||||
-rw-r--r-- | clang/test/SemaObjCXX/objc-pointer-conv.mm | 4 |
3 files changed, 13 insertions, 11 deletions
diff --git a/clang/lib/AST/TypePrinter.cpp b/clang/lib/AST/TypePrinter.cpp index 21f855b8e88..b8ce77b7f8f 100644 --- a/clang/lib/AST/TypePrinter.cpp +++ b/clang/lib/AST/TypePrinter.cpp @@ -680,14 +680,19 @@ void TypePrinter::PrintObjCObjectPointer(const ObjCObjectPointerType *T, 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 @@ void TypePrinter::PrintObjCObjectPointer(const ObjCObjectPointerType *T, 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'. diff --git a/clang/test/SemaObjC/method-arg-qualifier-warning.m b/clang/test/SemaObjC/method-arg-qualifier-warning.m index 463fb7fd777..690509e795e 100644 --- a/clang/test/SemaObjC/method-arg-qualifier-warning.m +++ b/clang/test/SemaObjC/method-arg-qualifier-warning.m @@ -12,8 +12,8 @@ static NSString * const Identifier3 = @"Identifier3"; 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; } diff --git a/clang/test/SemaObjCXX/objc-pointer-conv.mm b/clang/test/SemaObjCXX/objc-pointer-conv.mm index af239a8c5b8..335c240c171 100644 --- a/clang/test/SemaObjCXX/objc-pointer-conv.mm +++ b/clang/test/SemaObjCXX/objc-pointer-conv.mm @@ -29,10 +29,10 @@ void RandomFunc(CFMDRef theDict, const void *key, const void *value); - (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'}} } |