Rename Selector::getName() to Selector::getAsString(), and add
a new NamedDecl::getAsString() method.

Change uses of Selector::getName() to just pass in a Selector 
where possible (e.g. to diagnostics) instead of going through
an std::string.

This also adds new formatters for objcinstance and objcclass
as described in the dox.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59933 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index 8eb81a4..f9a4d77 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -2065,7 +2065,8 @@
   llvm::GlobalVariable *&Entry = MethodVarNames[Sel];
 
   if (!Entry) {
-    llvm::Constant *C = llvm::ConstantArray::get(Sel.getName());
+    // FIXME: Avoid std::string copying.
+    llvm::Constant *C = llvm::ConstantArray::get(Sel.getAsString());
     Entry = 
       new llvm::GlobalVariable(C->getType(), false, 
                                llvm::GlobalValue::InternalLinkage,
@@ -2143,14 +2144,12 @@
 void CGObjCMac::GetNameForMethod(const ObjCMethodDecl *D, 
                                  std::string &NameOut) {
   // FIXME: Find the mangling GCC uses.
-  std::stringstream s;
-  s << (D->isInstance() ? "-" : "+");
-  s << "[";
-  s << D->getClassInterface()->getName();
-  s << " ";
-  s << D->getSelector().getName();
-  s << "]";
-  NameOut = s.str();
+  NameOut = (D->isInstance() ? "-" : "+");
+  NameOut += '[';
+  NameOut += D->getClassInterface()->getName();
+  NameOut += ' ';
+  NameOut += D->getSelector().getAsString();
+  NameOut += ']';
 }
 
 void CGObjCMac::FinishModule() {