Rename NamedDecl::getIdentifierName() to ::getNameAsCString() and make it
assert if the name is not an identifier.  Update callers to do the right
thing and avoid this method in unsafe cases.  This also fixes an objc
warning that was missing a space, and migrates a couple more to taking
IdentifierInfo and QualTypes instead of std::strings.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59936 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index f9a4d77..975e386 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -664,7 +664,7 @@
   // over.
   LazySymbols.insert(&CGM.getContext().Idents.get("Protocol"));
 
-  const char *ProtocolName = PD->getIdentifierName();
+  const char *ProtocolName = PD->getNameAsCString();
 
   // Construct method lists.
   std::vector<llvm::Constant*> InstanceMethods, ClassMethods;
@@ -1076,7 +1076,7 @@
 void CGObjCMac::GenerateClass(const ObjCImplementationDecl *ID) {
   DefinedSymbols.insert(ID->getIdentifier());
 
-  const char *ClassName = ID->getIdentifierName();
+  std::string ClassName = ID->getNameAsString();
   // FIXME: Gross
   ObjCInterfaceDecl *Interface = 
     const_cast<ObjCInterfaceDecl*>(ID->getClassInterface());
@@ -1169,7 +1169,6 @@
                                          llvm::Constant *Protocols,
                                          const llvm::Type *InterfaceTy,
                                          const ConstantVector &Methods) {
-  const char *ClassName = ID->getIdentifierName();
   unsigned Flags = eClassFlags_Meta;
   unsigned Size = CGM.getTargetData().getABITypeSize(ObjCTypes.ClassTy);
 
@@ -1215,7 +1214,7 @@
                                                    Values);
 
   std::string Name("\01L_OBJC_METACLASS_");
-  Name += ClassName;
+  Name += ID->getNameAsCString();
 
   // Check for a forward reference.
   llvm::GlobalVariable *GV = CGM.getModule().getGlobalVariable(Name);