diff options
| -rw-r--r-- | clang/include/clang/AST/NestedNameSpecifier.h | 4 | ||||
| -rw-r--r-- | clang/include/clang/AST/TemplateName.h | 4 | ||||
| -rw-r--r-- | clang/lib/AST/NestedNameSpecifier.cpp | 14 | ||||
| -rw-r--r-- | clang/lib/AST/StmtPrinter.cpp | 4 | ||||
| -rw-r--r-- | clang/lib/AST/TemplateName.cpp | 16 | ||||
| -rw-r--r-- | clang/lib/AST/Type.cpp | 6 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiate.cpp | 5 | 
7 files changed, 20 insertions, 33 deletions
diff --git a/clang/include/clang/AST/NestedNameSpecifier.h b/clang/include/clang/AST/NestedNameSpecifier.h index 0eb68269197..864459b8ced 100644 --- a/clang/include/clang/AST/NestedNameSpecifier.h +++ b/clang/include/clang/AST/NestedNameSpecifier.h @@ -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();  };  } diff --git a/clang/include/clang/AST/TemplateName.h b/clang/include/clang/AST/TemplateName.h index 09e81be091d..86c443985de 100644 --- a/clang/include/clang/AST/TemplateName.h +++ b/clang/include/clang/AST/TemplateName.h @@ -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()); diff --git a/clang/lib/AST/NestedNameSpecifier.cpp b/clang/lib/AST/NestedNameSpecifier.cpp index 40efe2a1698..2db8c763431 100644 --- a/clang/lib/AST/NestedNameSpecifier.cpp +++ b/clang/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 @@ 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());  } diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp index bd5e22491e6..cd0e8822a8a 100644 --- a/clang/lib/AST/StmtPrinter.cpp +++ b/clang/lib/AST/StmtPrinter.cpp @@ -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();  } diff --git a/clang/lib/AST/TemplateName.cpp b/clang/lib/AST/TemplateName.cpp index 3659e2350de..659796d27b2 100644 --- a/clang/lib/AST/TemplateName.cpp +++ b/clang/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 @@ 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());  } diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index a4117b2bdf9..669eb7ce9c3 100644 --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -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();    } diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index c9f0d4fd799..2f12716b722 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -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(),  | 

