Some cleanup and renaming. No functionality change

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68140 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/AST/NestedNameSpecifier.h b/include/clang/AST/NestedNameSpecifier.h
index 0eb6826..864459b 100644
--- a/include/clang/AST/NestedNameSpecifier.h
+++ b/include/clang/AST/NestedNameSpecifier.h
@@ -159,7 +159,7 @@
 
   /// \brief Print this nested name specifier to the given output
   /// stream.
-  void Print(llvm::raw_ostream &OS) const;
+  void print(llvm::raw_ostream &OS) const;
 
   void Profile(llvm::FoldingSetNodeID &ID) const {
     ID.AddPointer(Prefix);
@@ -171,7 +171,7 @@
 
   /// \brief Dump the nested name specifier to standard output to aid
   /// in debugging.
-  void Dump();
+  void dump();
 };
 
 }
diff --git a/include/clang/AST/TemplateName.h b/include/clang/AST/TemplateName.h
index 09e81be..86c4439 100644
--- a/include/clang/AST/TemplateName.h
+++ b/include/clang/AST/TemplateName.h
@@ -97,11 +97,11 @@
   bool isDependent() const;
 
   /// \brief Print the template name.
-  void Print(llvm::raw_ostream &OS) const;
+  void print(llvm::raw_ostream &OS) const;
 
   /// \brief Debugging aid that dumps the template name to standard
   /// error.
-  void Dump() const;
+  void dump() const;
 
   void Profile(llvm::FoldingSetNodeID &ID) {
     ID.AddPointer(Storage.getOpaqueValue());
diff --git a/lib/AST/NestedNameSpecifier.cpp b/lib/AST/NestedNameSpecifier.cpp
index 40efe2a..2db8c76 100644
--- a/lib/AST/NestedNameSpecifier.cpp
+++ b/lib/AST/NestedNameSpecifier.cpp
@@ -17,7 +17,6 @@
 #include "clang/AST/Type.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cassert>
-#include <stdio.h>
 
 using namespace clang;
 
@@ -105,9 +104,9 @@
 
 /// \brief Print this nested name specifier to the given output
 /// stream.
-void NestedNameSpecifier::Print(llvm::raw_ostream &OS) const {
+void NestedNameSpecifier::print(llvm::raw_ostream &OS) const {
   if (Prefix)
-    Prefix->Print(OS);
+    Prefix->print(OS);
 
   switch (getKind()) {
   case Identifier:
@@ -152,11 +151,6 @@
   Context.Deallocate((void *)this);
 }
 
-void NestedNameSpecifier::Dump() {
-  std::string Result;
-  {
-    llvm::raw_string_ostream OS(Result);
-    Print(OS);
-  }
-  fprintf(stderr, "%s", Result.c_str());
+void NestedNameSpecifier::dump() {
+  print(llvm::errs());
 }
diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp
index bd5e224..cd0e882 100644
--- a/lib/AST/StmtPrinter.cpp
+++ b/lib/AST/StmtPrinter.cpp
@@ -533,12 +533,12 @@
 void StmtPrinter::VisitQualifiedDeclRefExpr(QualifiedDeclRefExpr *Node) {  
   NamedDecl *D = Node->getDecl();
 
-  Node->getQualifier()->Print(OS);
+  Node->getQualifier()->print(OS);
   OS << D->getNameAsString();
 }
 
 void StmtPrinter::VisitUnresolvedDeclRefExpr(UnresolvedDeclRefExpr *Node) {  
-  Node->getQualifier()->Print(OS);
+  Node->getQualifier()->print(OS);
   OS << Node->getDeclName().getAsString();
 }
 
diff --git a/lib/AST/TemplateName.cpp b/lib/AST/TemplateName.cpp
index 3659e23..659796d 100644
--- a/lib/AST/TemplateName.cpp
+++ b/lib/AST/TemplateName.cpp
@@ -14,7 +14,6 @@
 #include "clang/AST/DeclTemplate.h"
 #include "clang/AST/NestedNameSpecifier.h"
 #include "llvm/Support/raw_ostream.h"
-#include <stdio.h>
 
 using namespace clang;
 
@@ -39,26 +38,21 @@
   return true;
 }
 
-void TemplateName::Print(llvm::raw_ostream &OS) const {
+void TemplateName::print(llvm::raw_ostream &OS) const {
   if (TemplateDecl *Template = Storage.dyn_cast<TemplateDecl *>())
     OS << Template->getIdentifier()->getName();
   else if (QualifiedTemplateName *QTN = getAsQualifiedTemplateName()) {
-    QTN->getQualifier()->Print(OS);
+    QTN->getQualifier()->print(OS);
     if (QTN->hasTemplateKeyword())
       OS << "template ";
     OS << QTN->getTemplateDecl()->getIdentifier()->getName();
   } else if (DependentTemplateName *DTN = getAsDependentTemplateName()) {
-    DTN->getQualifier()->Print(OS);
+    DTN->getQualifier()->print(OS);
     OS << "template ";
     OS << DTN->getName()->getName();
   }
 }
 
-void TemplateName::Dump() const {
-  std::string Result;
-  {
-    llvm::raw_string_ostream OS(Result);
-    Print(OS);
-  }
-  fprintf(stderr, "%s", Result.c_str());
+void TemplateName::dump() const {
+  print(llvm::errs());
 }
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index a4117b2..669eb7c 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -1411,7 +1411,7 @@
 
   {
     llvm::raw_string_ostream OS(SpecString);
-    Template.Print(OS);
+    Template.print(OS);
   }
 
   SpecString += PrintTemplateArgumentList(getArgs(), getNumArgs());
@@ -1426,7 +1426,7 @@
 
   {
     llvm::raw_string_ostream OS(MyString);
-    NNS->Print(OS);
+    NNS->print(OS);
   }
   
   std::string TypeStr;
@@ -1449,7 +1449,7 @@
   {
     llvm::raw_string_ostream OS(MyString);
     OS << "typename ";
-    NNS->Print(OS);
+    NNS->print(OS);
     OS << Name->getName();
   }
   
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp
index c9f0d4f..2f12716 100644
--- a/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/lib/Sema/SemaTemplateInstantiate.cpp
@@ -853,13 +853,12 @@
     assert(TTP->getDepth() == 0 && 
            "Cannot reduce depth of a template template parameter");
     assert(TTP->getPosition() < NumTemplateArgs && "Wrong # of template args");
-    assert(dyn_cast_or_null<ClassTemplateDecl>(
-                          TemplateArgs[TTP->getPosition()].getAsDecl()) &&
+    assert(TemplateArgs[TTP->getPosition()].getAsDecl() &&
            "Wrong kind of template template argument");
     ClassTemplateDecl *ClassTemplate 
       = dyn_cast<ClassTemplateDecl>(
                                TemplateArgs[TTP->getPosition()].getAsDecl());
-
+    assert(ClassTemplate && "Expected a class template");
     if (QualifiedTemplateName *QTN = Name.getAsQualifiedTemplateName()) {
       NestedNameSpecifier *NNS 
         = InstantiateNestedNameSpecifier(QTN->getQualifier(),