Convert IdentifierInfo's to be printed the same as DeclarationNames 
with implicit quotes around them.  This has a bunch of follow-on 
effects and requires tweaking to a whole lot of code.  This causes
a regression in two tests (xfailed) by causing it to emit things like:

  Line 10: duplicate interface declaration for category 'MyClass1' ('Category1')

instead of:

  Line 10: duplicate interface declaration for category 'MyClass1(Category1)'

I will fix this in a follow-up commit.

As part of this, I had to start switching stuff to use ->getDeclName() instead
of Decl::getName() for consistency.  This is good, but I was planning to do this
as an independent patch.  There will be several follow-on patches
to clean up some of the mess, but this patch is already too big.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59917 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index fba9f33..c3b1302 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -325,7 +325,7 @@
   TypedefDecl *Old = dyn_cast<TypedefDecl>(OldD);
   if (!Old) {
     Diag(New->getLocation(), diag::err_redefinition_different_kind)
-      << New->getName();
+      << New->getDeclName();
     Diag(OldD->getLocation(), diag::err_previous_definition);
     return New;
   }
@@ -364,7 +364,7 @@
       return New;
   }
 
-  Diag(New->getLocation(), diag::err_redefinition) << New->getName();
+  Diag(New->getLocation(), diag::err_redefinition) << New->getDeclName();
   Diag(Old->getLocation(), diag::err_previous_definition);
   return New;
 }
@@ -418,7 +418,7 @@
   FunctionDecl *Old = dyn_cast<FunctionDecl>(OldD);
   if (!Old) {
     Diag(New->getLocation(), diag::err_redefinition_different_kind)
-      << New->getName();
+      << New->getDeclName();
     Diag(OldD->getLocation(), diag::err_previous_definition);
     return New;
   }
@@ -537,7 +537,7 @@
           OldDecl->getStorageClass() != VarDecl::PrivateExtern &&
           VD->getStorageClass() != VarDecl::Extern &&
           VD->getStorageClass() != VarDecl::PrivateExtern) {
-        Diag(VD->getLocation(), diag::err_redefinition) << VD->getName();
+        Diag(VD->getLocation(), diag::err_redefinition) << VD->getDeclName();
         Diag(OldDecl->getLocation(), diag::err_previous_definition);
       }
     }
@@ -557,7 +557,7 @@
   VarDecl *Old = dyn_cast<VarDecl>(OldD);
   if (!Old) {
     Diag(New->getLocation(), diag::err_redefinition_different_kind)
-      << New->getName();
+      << New->getDeclName();
     Diag(OldD->getLocation(), diag::err_previous_definition);
     return New;
   }
@@ -568,7 +568,7 @@
   QualType OldCType = Context.getCanonicalType(Old->getType());
   QualType NewCType = Context.getCanonicalType(New->getType());
   if (OldCType != NewCType && !Context.typesAreCompatible(OldCType, NewCType)) {
-    Diag(New->getLocation(), diag::err_redefinition) << New->getName();
+    Diag(New->getLocation(), diag::err_redefinition) << New->getDeclName();
     Diag(Old->getLocation(), diag::err_previous_definition);
     return New;
   }
@@ -589,7 +589,7 @@
   }
   // Variables with external linkage are analyzed in FinalizeDeclaratorGroup.
   if (New->getStorageClass() != VarDecl::Extern && !New->isFileVarDecl()) {
-    Diag(New->getLocation(), diag::err_redefinition) << New->getName();
+    Diag(New->getLocation(), diag::err_redefinition) << New->getDeclName();
     Diag(Old->getLocation(), diag::err_previous_definition);
   }
   return New;
@@ -849,7 +849,7 @@
     if (PrevDecl == 0) {
       // No previous declaration in the qualifying scope.
       Diag(D.getIdentifierLoc(), diag::err_typecheck_no_member)
-        << Name.getAsString() << D.getCXXScopeSpec().getRange();
+        << Name << D.getCXXScopeSpec().getRange();
     } else if (!CurContext->Encloses(DC)) {
       // The qualifying scope doesn't enclose the original declaration.
       // Emit diagnostic based on current scope.
@@ -1987,8 +1987,7 @@
   IdentifierInfo *II = D.getIdentifier();
   if (Decl *PrevDecl = LookupDecl(II, Decl::IDNS_Ordinary, S)) {
     if (S->isDeclScope(PrevDecl)) {
-      Diag(D.getIdentifierLoc(), diag::err_param_redefinition)
-        << cast<NamedDecl>(PrevDecl)->getName();
+      Diag(D.getIdentifierLoc(), diag::err_param_redefinition) << II;
 
       // Recover by removing the name
       II = 0;
@@ -2076,7 +2075,7 @@
   // See if this is a redefinition.
   const FunctionDecl *Definition;
   if (FD->getBody(Definition)) {
-    Diag(FD->getLocation(), diag::err_redefinition) << FD->getName();
+    Diag(FD->getLocation(), diag::err_redefinition) << FD->getDeclName();
     Diag(Definition->getLocation(), diag::err_previous_definition);
   }
 
@@ -2804,7 +2803,7 @@
     /// A field cannot be an Objective-c object
     if (FDTy->isObjCInterfaceType()) {
       Diag(FD->getLocation(), diag::err_statically_allocated_object)
-        << FD->getName();
+        << FD->getDeclName();
       FD->setInvalidDecl();
       EnclosingDecl->setInvalidDecl();
       continue;