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/Analysis/BasicObjCFoundationChecks.cpp b/lib/Analysis/BasicObjCFoundationChecks.cpp
index 033dc02..d81b334 100644
--- a/lib/Analysis/BasicObjCFoundationChecks.cpp
+++ b/lib/Analysis/BasicObjCFoundationChecks.cpp
@@ -91,7 +91,7 @@
       std::ostringstream os;
       
       os << "Argument to '" << GetReceiverNameType(ME) << "' method '"
-      << ME->getSelector().getName() << "' cannot be nil.";
+      << ME->getSelector().getAsString() << "' cannot be nil.";
       
       Msg = os.str();
       s = Msg.c_str();      
@@ -243,7 +243,7 @@
   // FIXME: This is going to be really slow doing these checks with
   //  lexical comparisons.
   
-  std::string name = S.getName();
+  std::string name = S.getAsString();
   assert (!name.empty());
   const char* cstr = &name[0];
   unsigned len = name.size();
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index 8c16c9f..56f5ab6 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -1887,7 +1887,7 @@
 
   if (V.isReturnedOwned() && V.getCount() == 0)
     if (const ObjCMethodDecl* MD = dyn_cast<ObjCMethodDecl>(CD)) {
-      std::string s = MD->getSelector().getName();
+      std::string s = MD->getSelector().getAsString();
       if (!followsReturnRule(s.c_str())) {
         hasLeak = true;
         state = state.set<RefBindings>(sid, V ^ RefVal::ErrorLeakReturned);
@@ -2635,7 +2635,7 @@
   if (RV->getKind() == RefVal::ErrorLeakReturned) {
     ObjCMethodDecl& MD = cast<ObjCMethodDecl>(BR.getGraph().getCodeDecl());
     os << " is returned from a method whose name ('"
-       << MD.getSelector().getName()
+       << MD.getSelector().getAsString()
        << "') does not contain 'create' or 'copy' or otherwise starts with"
           " 'new' or 'alloc'.  This violates the naming convention rules given"
           " in the Memory Management Guide for Cocoa (object leaked).";
diff --git a/lib/Analysis/CheckObjCInstMethSignature.cpp b/lib/Analysis/CheckObjCInstMethSignature.cpp
index ffaef42..00dbe9f 100644
--- a/lib/Analysis/CheckObjCInstMethSignature.cpp
+++ b/lib/Analysis/CheckObjCInstMethSignature.cpp
@@ -53,7 +53,7 @@
        << "', which is derived from class '"
        << MethAncestor->getClassInterface()->getName()
        << "', defines the instance method '"
-       << MethDerived->getSelector().getName()
+       << MethDerived->getSelector().getAsString()
        << "' whose return type is '"
        << ResDerived.getAsString()
        << "'.  A method with the same name (same selector) is also defined in "