Representation of template type parameters and non-type template
parameters, with some semantic analysis:
  - Template parameters are introduced into template parameter scope
  - Complain about template parameter shadowing (except in Microsoft mode)

Note that we leak template parameter declarations like crazy, a
problem we'll remedy once we actually create proper declarations for
templates. 

Next up: dependent types and value-dependent/type-dependent
expressions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60597 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index 6aa3c8e..303fc7e 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -443,6 +443,11 @@
   return dyn_cast<ObjCQualifiedIdType>(CanonicalType);
 }
 
+const TemplateTypeParmType *Type::getAsTemplateTypeParmType() const {
+  // There is no sugar for template type parameters, so just return
+  // the canonical type pointer if it is the right class.
+  return dyn_cast<TemplateTypeParmType>(CanonicalType);
+}
 
 bool Type::isIntegerType() const {
   if (const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
@@ -1002,6 +1007,12 @@
   InnerString = getDecl()->getIdentifier()->getName() + InnerString;
 }
 
+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;
+}
+
 void ObjCInterfaceType::getAsStringInternal(std::string &InnerString) const {
   if (!InnerString.empty())    // Prefix the basic type, e.g. 'typedefname X'.
     InnerString = ' ' + InnerString;