summaryrefslogtreecommitdiff
path: root/tools/obj2yaml
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2013-04-08 08:55:18 +0000
committerChandler Carruth <chandlerc@gmail.com>2013-04-08 08:55:18 +0000
commit89ec385e5e2f080bbe97bddefbff38232419c7f3 (patch)
tree99f94831e1cdd4dcd1f1ebd89083e64e80c171c3 /tools/obj2yaml
parent97034bb95d4bc76f096d0014332f0a683971e33a (diff)
downloadllvm-89ec385e5e2f080bbe97bddefbff38232419c7f3.tar.gz
llvm-89ec385e5e2f080bbe97bddefbff38232419c7f3.tar.bz2
llvm-89ec385e5e2f080bbe97bddefbff38232419c7f3.tar.xz
Remove a global 'endl' variable from the other file as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179010 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/obj2yaml')
-rw-r--r--tools/obj2yaml/coff2yaml.cpp47
1 files changed, 22 insertions, 25 deletions
diff --git a/tools/obj2yaml/coff2yaml.cpp b/tools/obj2yaml/coff2yaml.cpp
index f0241d931e..cc7ac00276 100644
--- a/tools/obj2yaml/coff2yaml.cpp
+++ b/tools/obj2yaml/coff2yaml.cpp
@@ -201,9 +201,6 @@ RelocationTypesARMPairs [] = {
};
#undef STRING_PAIR
-
-static const char endl = '\n';
-
namespace yaml { // COFF-specific yaml-writing specific routines
static llvm::raw_ostream &writeName(llvm::raw_ostream &Out,
@@ -242,25 +239,25 @@ const char *nameLookup(const pod_pair<T, const char *> (&Arr)[N],
static llvm::raw_ostream &yamlCOFFHeader(
const llvm::object::coff_file_header *Header,llvm::raw_ostream &Out) {
- Out << "header: !Header" << endl;
+ Out << "header: !Header\n";
Out << " Machine: ";
Out << nameLookup(MachineTypePairs, Header->Machine, "# Unknown_MachineTypes")
<< " # (";
- return yaml::writeHexNumber(Out, Header->Machine) << ")" << endl << endl;
+ return yaml::writeHexNumber(Out, Header->Machine) << ")\n\n";
}
static llvm::raw_ostream &yamlCOFFSections(llvm::object::COFFObjectFile &Obj,
std::size_t NumSections, llvm::raw_ostream &Out) {
llvm::error_code ec;
- Out << "sections:" << endl;
+ Out << "sections:\n";
for (llvm::object::section_iterator iter = Obj.begin_sections();
iter != Obj.end_sections(); iter.increment(ec)) {
const llvm::object::coff_section *sect = Obj.getCOFFSection(iter);
- Out << " - !Section" << endl;
+ Out << " - !Section\n";
Out << " Name: ";
- yaml::writeName(Out, sect->Name, sizeof(sect->Name)) << endl;
+ yaml::writeName(Out, sect->Name, sizeof(sect->Name)) << '\n';
Out << " Characteristics: [";
yaml::writeBitMask(Out, SectionCharacteristicsPairs1, sect->Characteristics);
@@ -269,26 +266,26 @@ static llvm::raw_ostream &yamlCOFFSections(llvm::object::COFFObjectFile &Obj,
<< ", ";
yaml::writeBitMask(Out, SectionCharacteristicsPairs2, sect->Characteristics);
Out << "] # ";
- yaml::writeHexNumber(Out, sect->Characteristics) << endl;
+ yaml::writeHexNumber(Out, sect->Characteristics) << '\n';
llvm::ArrayRef<uint8_t> sectionData;
Obj.getSectionContents(sect, sectionData);
Out << " SectionData: ";
- yaml::writeHexStream(Out, sectionData) << endl;
+ yaml::writeHexStream(Out, sectionData) << '\n';
if (iter->begin_relocations() != iter->end_relocations())
Out << " Relocations:\n";
for (llvm::object::relocation_iterator rIter = iter->begin_relocations();
rIter != iter->end_relocations(); rIter.increment(ec)) {
const llvm::object::coff_relocation *reloc = Obj.getCOFFRelocation(rIter);
- Out << " - !Relocation" << endl;
+ Out << " - !Relocation\n";
Out << " VirtualAddress: " ;
- yaml::writeHexNumber(Out, reloc->VirtualAddress) << endl;
- Out << " SymbolTableIndex: " << reloc->SymbolTableIndex << endl;
+ yaml::writeHexNumber(Out, reloc->VirtualAddress) << '\n';
+ Out << " SymbolTableIndex: " << reloc->SymbolTableIndex << '\n';
Out << " Type: "
- << nameLookup(RelocationTypeX86Pairs, reloc->Type) << endl;
+ << nameLookup(RelocationTypeX86Pairs, reloc->Type) << '\n';
// TODO: Use the correct reloc type for the machine.
- Out << endl;
+ Out << '\n';
}
}
@@ -298,7 +295,7 @@ static llvm::raw_ostream &yamlCOFFSections(llvm::object::COFFObjectFile &Obj,
static llvm::raw_ostream& yamlCOFFSymbols(llvm::object::COFFObjectFile &Obj,
std::size_t NumSymbols, llvm::raw_ostream &Out) {
llvm::error_code ec;
- Out << "symbols:" << endl;
+ Out << "symbols:\n";
for (llvm::object::symbol_iterator iter = Obj.begin_symbols();
iter != Obj.end_symbols(); iter.increment(ec)) {
// Gather all the info that we need
@@ -309,36 +306,36 @@ static llvm::raw_ostream& yamlCOFFSymbols(llvm::object::COFFObjectFile &Obj,
std::size_t complexType = symbol->getComplexType();
std::size_t storageClass = symbol->StorageClass;
- Out << " - !Symbol" << endl;
- Out << " Name: " << str << endl;
+ Out << " - !Symbol\n";
+ Out << " Name: " << str << '\n';
- Out << " Value: " << symbol->Value << endl;
- Out << " SectionNumber: " << symbol->SectionNumber << endl;
+ Out << " Value: " << symbol->Value << '\n';
+ Out << " SectionNumber: " << symbol->SectionNumber << '\n';
Out << " SimpleType: "
<< nameLookup(SymbolBaseTypePairs, simpleType,
"# Unknown_SymbolBaseType")
- << " # (" << simpleType << ")" << endl;
+ << " # (" << simpleType << ")\n";
Out << " ComplexType: "
<< nameLookup(SymbolComplexTypePairs, complexType,
"# Unknown_SymbolComplexType")
- << " # (" << complexType << ")" << endl;
+ << " # (" << complexType << ")\n";
Out << " StorageClass: "
<< nameLookup(SymbolStorageClassPairs, storageClass,
"# Unknown_StorageClass")
- << " # (" << (int) storageClass << ")" << endl;
+ << " # (" << (int) storageClass << ")\n";
if (symbol->NumberOfAuxSymbols > 0) {
llvm::ArrayRef<uint8_t> aux = Obj.getSymbolAuxData(symbol);
Out << " NumberOfAuxSymbols: "
- << (int) symbol->NumberOfAuxSymbols << endl;
+ << (int) symbol->NumberOfAuxSymbols << '\n';
Out << " AuxillaryData: ";
yaml::writeHexStream(Out, aux);
}
- Out << endl;
+ Out << '\n';
}
return Out;