]> granicus.if.org Git - clang/commitdiff
Some cleanup and renaming. No functionality change
authorDouglas Gregor <dgregor@apple.com>
Tue, 31 Mar 2009 20:22:05 +0000 (20:22 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 31 Mar 2009 20:22:05 +0000 (20:22 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68140 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/NestedNameSpecifier.h
include/clang/AST/TemplateName.h
lib/AST/NestedNameSpecifier.cpp
lib/AST/StmtPrinter.cpp
lib/AST/TemplateName.cpp
lib/AST/Type.cpp
lib/Sema/SemaTemplateInstantiate.cpp

index 0eb682691975cc1c97100a90bde185bb6fb65ecf..864459b8cede1ad583b6884e3600e14420541bbe 100644 (file)
@@ -159,7 +159,7 @@ public:
 
   /// \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 @@ public:
 
   /// \brief Dump the nested name specifier to standard output to aid
   /// in debugging.
-  void Dump();
+  void dump();
 };
 
 }
index 09e81be091d115cdbd04633dcd2f4f65c8653f98..86c443985de24c23f033e50885df038a2f979be9 100644 (file)
@@ -97,11 +97,11 @@ public:
   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());
index 40efe2a16989c62629f3112ce7da9af716cdcdf6..2db8c763431849364c2efa9c68de20061bb2d8a2 100644 (file)
@@ -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 @@ bool NestedNameSpecifier::isDependent() const {
 
 /// \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 @@ void NestedNameSpecifier::Destroy(ASTContext &Context) {
   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());
 }
index bd5e22491e6551bd344b7a82b5513f123689de4f..cd0e8822a8ab00bdeb1bf89e41d987e2c439e2d9 100644 (file)
@@ -533,12 +533,12 @@ void StmtPrinter::VisitDeclRefExpr(DeclRefExpr *Node) {
 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();
 }
 
index 3659e2350de61042fccb0da7039916812cc4f5c3..659796d27b2e28c6d53cbb0ec706aaf67742da94 100644 (file)
@@ -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 @@ bool TemplateName::isDependent() const {
   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());
 }
index a4117b2bdf970784a9f612e4e38c3ae55788c604..669eb7ce9c3d698d351436499421d4982b9e8001 100644 (file)
@@ -1411,7 +1411,7 @@ getAsStringInternal(std::string &InnerString) const {
 
   {
     llvm::raw_string_ostream OS(SpecString);
-    Template.Print(OS);
+    Template.print(OS);
   }
 
   SpecString += PrintTemplateArgumentList(getArgs(), getNumArgs());
@@ -1426,7 +1426,7 @@ void QualifiedNameType::getAsStringInternal(std::string &InnerString) const {
 
   {
     llvm::raw_string_ostream OS(MyString);
-    NNS->Print(OS);
+    NNS->print(OS);
   }
   
   std::string TypeStr;
@@ -1449,7 +1449,7 @@ void TypenameType::getAsStringInternal(std::string &InnerString) const {
   {
     llvm::raw_string_ostream OS(MyString);
     OS << "typename ";
-    NNS->Print(OS);
+    NNS->print(OS);
     OS << Name->getName();
   }
   
index c9f0d4fd799c8f758aeabebc848c5bc4a50b22cb..2f12716b722fb8959201dc2d99cb1ff32707d3f3 100644 (file)
@@ -853,13 +853,12 @@ Sema::InstantiateTemplateName(TemplateName Name, SourceLocation Loc,
     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(),