diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2010-04-17 09:33:03 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2010-04-17 09:33:03 +0000 |
commit | 900fc6388e803868a34b9483510c345e9b49d7eb (patch) | |
tree | 039296944edf1cf7ea7bcff92bcd42d550fb9c84 /lib/Frontend/ASTConsumers.cpp | |
parent | 7a22f02a02616be8fd817529f1696a88a35ee041 (diff) |
Add raw_ostream operators to NamedDecl for convenience. Switch over all users of getNameAsString on a stream.
The next step is to print the name directly into the stream, avoiding a temporary std::string copy.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101632 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/ASTConsumers.cpp')
-rw-r--r-- | lib/Frontend/ASTConsumers.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/lib/Frontend/ASTConsumers.cpp b/lib/Frontend/ASTConsumers.cpp index b53a80e47b..7b8ebf9203 100644 --- a/lib/Frontend/ASTConsumers.cpp +++ b/lib/Frontend/ASTConsumers.cpp @@ -164,7 +164,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, case Decl::Namespace: { Out << "[namespace] "; const NamespaceDecl* ND = cast<NamespaceDecl>(DC); - Out << ND->getNameAsString(); + Out << ND; break; } case Decl::Enum: { @@ -173,7 +173,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, Out << "[enum] "; else Out << "<enum> "; - Out << ED->getNameAsString(); + Out << ED; break; } case Decl::Record: { @@ -182,7 +182,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, Out << "[struct] "; else Out << "<struct> "; - Out << RD->getNameAsString(); + Out << RD; break; } case Decl::CXXRecord: { @@ -191,7 +191,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, Out << "[class] "; else Out << "<class> "; - Out << RD->getNameAsString() << " " << DC; + Out << RD << ' ' << DC; break; } case Decl::ObjCMethod: @@ -224,7 +224,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, Out << "[function] "; else Out << "<function> "; - Out << FD->getNameAsString(); + Out << FD; // Print the parameters. Out << "("; bool PrintComma = false; @@ -234,7 +234,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, Out << ", "; else PrintComma = true; - Out << (*I)->getNameAsString(); + Out << *I; } Out << ")"; break; @@ -247,7 +247,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, Out << "(c++ method) "; else Out << "<c++ method> "; - Out << D->getNameAsString(); + Out << D; // Print the parameters. Out << "("; bool PrintComma = false; @@ -257,7 +257,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, Out << ", "; else PrintComma = true; - Out << (*I)->getNameAsString(); + Out << *I; } Out << ")"; @@ -277,7 +277,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, Out << "(c++ ctor) "; else Out << "<c++ ctor> "; - Out << D->getNameAsString(); + Out << D; // Print the parameters. Out << "("; bool PrintComma = false; @@ -287,7 +287,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, Out << ", "; else PrintComma = true; - Out << (*I)->getNameAsString(); + Out << *I; } Out << ")"; @@ -306,7 +306,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, Out << "(c++ dtor) "; else Out << "<c++ dtor> "; - Out << D->getNameAsString(); + Out << D; // Check the semantic DC. const DeclContext* SemaDC = D->getDeclContext(); const DeclContext* LexicalDC = D->getLexicalDeclContext(); @@ -322,7 +322,7 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, Out << "(c++ conversion) "; else Out << "<c++ conversion> "; - Out << D->getNameAsString(); + Out << D; // Check the semantic DC. const DeclContext* SemaDC = D->getDeclContext(); const DeclContext* LexicalDC = D->getLexicalDeclContext(); @@ -369,42 +369,42 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, } case Decl::Field: { FieldDecl* FD = cast<FieldDecl>(*I); - Out << "<field> " << FD->getNameAsString() << "\n"; + Out << "<field> " << FD << '\n'; break; } case Decl::Typedef: { TypedefDecl* TD = cast<TypedefDecl>(*I); - Out << "<typedef> " << TD->getNameAsString() << "\n"; + Out << "<typedef> " << TD << '\n'; break; } case Decl::EnumConstant: { EnumConstantDecl* ECD = cast<EnumConstantDecl>(*I); - Out << "<enum constant> " << ECD->getNameAsString() << "\n"; + Out << "<enum constant> " << ECD << '\n'; break; } case Decl::Var: { VarDecl* VD = cast<VarDecl>(*I); - Out << "<var> " << VD->getNameAsString() << "\n"; + Out << "<var> " << VD << '\n'; break; } case Decl::ImplicitParam: { ImplicitParamDecl* IPD = cast<ImplicitParamDecl>(*I); - Out << "<implicit parameter> " << IPD->getNameAsString() << "\n"; + Out << "<implicit parameter> " << IPD << '\n'; break; } case Decl::ParmVar: { ParmVarDecl* PVD = cast<ParmVarDecl>(*I); - Out << "<parameter> " << PVD->getNameAsString() << "\n"; + Out << "<parameter> " << PVD << '\n'; break; } case Decl::ObjCProperty: { ObjCPropertyDecl* OPD = cast<ObjCPropertyDecl>(*I); - Out << "<objc property> " << OPD->getNameAsString() << "\n"; + Out << "<objc property> " << OPD << '\n'; break; } case Decl::FunctionTemplate: { FunctionTemplateDecl* FTD = cast<FunctionTemplateDecl>(*I); - Out << "<function template> " << FTD->getNameAsString() << "\n"; + Out << "<function template> " << FTD << '\n'; break; } case Decl::FileScopeAsm: { @@ -417,16 +417,16 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, } case Decl::NamespaceAlias: { NamespaceAliasDecl* NAD = cast<NamespaceAliasDecl>(*I); - Out << "<namespace alias> " << NAD->getNameAsString() << "\n"; + Out << "<namespace alias> " << NAD << '\n'; break; } case Decl::ClassTemplate: { ClassTemplateDecl *CTD = cast<ClassTemplateDecl>(*I); - Out << "<class template> " << CTD->getNameAsString() << '\n'; + Out << "<class template> " << CTD << '\n'; break; } default: - Out << "DeclKind: " << DK << '"' << I->getDeclKindName() << "\"\n"; + Out << "DeclKind: " << DK << '"' << *I << "\"\n"; assert(0 && "decl unhandled"); } } |