Improve the representation of template type parameters. We now
canonicalize by template parameter depth, index, and name, and the
unnamed version of a template parameter serves as the canonical.

TemplateTypeParmDecl no longer needs to inherit from
TemplateParmPosition, since depth and index information is present
within the type.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63899 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index f39a325..199ad29 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -1138,7 +1138,12 @@
 void TemplateTypeParmType::getAsStringInternal(std::string &InnerString) const {
   if (!InnerString.empty())    // Prefix the basic type, e.g. 'parmname X'.
     InnerString = ' ' + InnerString;
-  InnerString = getDecl()->getIdentifier()->getName() + InnerString;
+
+  if (!Name)
+    InnerString = "type-parameter-" + llvm::utostr_32(Depth) + '-' + 
+      llvm::utostr_32(Index) + InnerString;
+  else
+    InnerString = Name->getName() + InnerString;
 }
 
 void ObjCInterfaceType::getAsStringInternal(std::string &InnerString) const {