Extend the notion of active template instantiations to include the
context of a template-id for which we need to instantiate default
template arguments.

In the TextDiagnosticPrinter, don't suppress the caret diagnostic if
we are producing a non-note diagnostic that follows a note diagnostic
with the same location, because notes are (conceptually) a part of the
warning or error that comes before them.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66572 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index 205ebef..1b7fc1b 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -1287,10 +1287,9 @@
     InnerString = Name->getName() + InnerString;
 }
 
-/// \brief Print a template argument list, including the '<' and '>'
-/// enclosing the template arguments.
-static std::string printTemplateArgumentList(const TemplateArgument *Args,
-                                             unsigned NumArgs) {
+std::string ClassTemplateSpecializationType::PrintTemplateArgumentList(
+                                              const TemplateArgument *Args,
+                                              unsigned NumArgs) {
   std::string SpecString;
   SpecString += '<';
   for (unsigned Arg = 0; Arg < NumArgs; ++Arg) {
@@ -1343,7 +1342,7 @@
 ClassTemplateSpecializationType::
 getAsStringInternal(std::string &InnerString) const {
   std::string SpecString = Template->getNameAsString();
-  SpecString += printTemplateArgumentList(getArgs(), getNumArgs());
+  SpecString += PrintTemplateArgumentList(getArgs(), getNumArgs());
   if (InnerString.empty())
     InnerString.swap(SpecString);
   else
@@ -1409,8 +1408,9 @@
   if (ClassTemplateSpecializationDecl *Spec 
         = dyn_cast<ClassTemplateSpecializationDecl>(getDecl())) {
     std::string TemplateArgs 
-      = printTemplateArgumentList(Spec->getTemplateArgs(),
-                                  Spec->getNumTemplateArgs());
+      = ClassTemplateSpecializationType::PrintTemplateArgumentList(
+                                                  Spec->getTemplateArgs(),
+                                                  Spec->getNumTemplateArgs());
     InnerString = TemplateArgs + InnerString;
   }