Extend the use of QualifiedNameType to the creation of class template
specialization names. This way, we keep track of sugared types like

  std::vector<Real>

I believe we are now using QualifiedNameTypes everywhere we can. Next
step: QualifiedDeclRefExprs.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67268 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index f531778..b4e505e 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -765,6 +765,9 @@
                                          &TemplateArgs[0],
                                          TemplateArgs.size(),
                                          RAngleLoc);
+  
+  if (SS)
+    Result = getQualifiedNameType(*SS, Result);
 
   TemplateArgsIn.release();
   return Result.getAsOpaquePtr();
@@ -1910,11 +1913,12 @@
   // actually wrote the specialization, rather than formatting the
   // name based on the "canonical" representation used to store the
   // template arguments in the specialization.
-  Specialization->setTypeAsWritten(
-    Context.getClassTemplateSpecializationType(ClassTemplate, 
-                                               &TemplateArgs[0],
-                                               TemplateArgs.size(),
-                                  Context.getTypeDeclType(Specialization)));
+  QualType WrittenTy 
+    = Context.getClassTemplateSpecializationType(ClassTemplate, 
+                                                 &TemplateArgs[0],
+                                                 TemplateArgs.size(),
+                                  Context.getTypeDeclType(Specialization));
+  Specialization->setTypeAsWritten(getQualifiedNameType(SS, WrittenTy));
   TemplateArgsIn.release();
 
   // C++ [temp.expl.spec]p9: