[cfe-commits] r68140 - in /cfe/trunk: 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
Douglas Gregor
dgregor at apple.com
Tue Mar 31 13:22:05 PDT 2009
Author: dgregor
Date: Tue Mar 31 15:22:05 2009
New Revision: 68140
URL: http://llvm.org/viewvc/llvm-project?rev=68140&view=rev
Log:
Some cleanup and renaming. No functionality change
Modified:
cfe/trunk/include/clang/AST/NestedNameSpecifier.h
cfe/trunk/include/clang/AST/TemplateName.h
cfe/trunk/lib/AST/NestedNameSpecifier.cpp
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/AST/TemplateName.cpp
cfe/trunk/lib/AST/Type.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
Modified: cfe/trunk/include/clang/AST/NestedNameSpecifier.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/NestedNameSpecifier.h?rev=68140&r1=68139&r2=68140&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/NestedNameSpecifier.h (original)
+++ cfe/trunk/include/clang/AST/NestedNameSpecifier.h Tue Mar 31 15:22:05 2009
@@ -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();
};
}
Modified: cfe/trunk/include/clang/AST/TemplateName.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TemplateName.h?rev=68140&r1=68139&r2=68140&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/TemplateName.h (original)
+++ cfe/trunk/include/clang/AST/TemplateName.h Tue Mar 31 15:22:05 2009
@@ -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());
Modified: cfe/trunk/lib/AST/NestedNameSpecifier.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/NestedNameSpecifier.cpp?rev=68140&r1=68139&r2=68140&view=diff
==============================================================================
--- cfe/trunk/lib/AST/NestedNameSpecifier.cpp (original)
+++ cfe/trunk/lib/AST/NestedNameSpecifier.cpp Tue Mar 31 15:22:05 2009
@@ -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());
}
Modified: cfe/trunk/lib/AST/StmtPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=68140&r1=68139&r2=68140&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtPrinter.cpp (original)
+++ cfe/trunk/lib/AST/StmtPrinter.cpp Tue Mar 31 15:22:05 2009
@@ -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();
}
Modified: cfe/trunk/lib/AST/TemplateName.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TemplateName.cpp?rev=68140&r1=68139&r2=68140&view=diff
==============================================================================
--- cfe/trunk/lib/AST/TemplateName.cpp (original)
+++ cfe/trunk/lib/AST/TemplateName.cpp Tue Mar 31 15:22:05 2009
@@ -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());
}
Modified: cfe/trunk/lib/AST/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Type.cpp?rev=68140&r1=68139&r2=68140&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Type.cpp (original)
+++ cfe/trunk/lib/AST/Type.cpp Tue Mar 31 15:22:05 2009
@@ -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();
}
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=68140&r1=68139&r2=68140&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Tue Mar 31 15:22:05 2009
@@ -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(),
More information about the cfe-commits
mailing list