Fix a bug in codegenprep where it was losing track of values OptimizeMemoryInst
[oota-llvm.git] / tools / obj2yaml / coff2yaml.cpp
index 349d0c175624d575d00c17863458f50a88423f12..5106a4a44b60fd8919ba63fc6977e22b5e37f52e 100644 (file)
@@ -233,23 +233,18 @@ const char *nameLookup(const pod_pair<T, const char *> (&Arr)[N],
   return NotFound;
 }
 
-static raw_ostream &yamlCOFFHeader(const object::coff_file_header *Header,
-                                   raw_ostream &Out) {
-  COFF::header H;
-  H.Machine = Header->Machine;
-  H.Characteristics = Header->Characteristics;
-
+static void yamlCOFFHeader(const object::coff_file_header *Header,
+                           raw_ostream &Out) {
   Out << "header: !Header\n";
   Out << "  Machine: ";
   Out << nameLookup(MachineTypePairs, Header->Machine, "# Unknown_MachineTypes")
       << " # (";
-  return yaml::writeHexNumber(Out, Header->Machine) << ")\n\n";
+  objyaml::writeHexNumber(Out, Header->Machine) << ")\n\n";
 }
 
 
-static raw_ostream &yamlCOFFSections(object::COFFObjectFile &Obj,
-                                     std::size_t NumSections,
-                                     raw_ostream &Out) {
+static void yamlCOFFSections(object::COFFObjectFile &Obj,
+                             std::size_t NumSections, raw_ostream &Out) {
   error_code ec;
   Out << "sections:\n";
   for (object::section_iterator iter = Obj.begin_sections();
@@ -267,12 +262,12 @@ static raw_ostream &yamlCOFFSections(object::COFFObjectFile &Obj,
         << ", ";
     writeBitMask(Out, SectionCharacteristicsPairs2, sect->Characteristics);
     Out << "] # ";
-    yaml::writeHexNumber(Out, sect->Characteristics) << '\n';
+    objyaml::writeHexNumber(Out, sect->Characteristics) << '\n';
 
     ArrayRef<uint8_t> sectionData;
     Obj.getSectionContents(sect, sectionData);
     Out << "    SectionData: ";
-    yaml::writeHexStream(Out, sectionData) << '\n';
+    objyaml::writeHexStream(Out, sectionData) << '\n';
     if (iter->begin_relocations() != iter->end_relocations())
       Out << "    Relocations:\n";
     for (object::relocation_iterator rIter = iter->begin_relocations();
@@ -281,7 +276,7 @@ static raw_ostream &yamlCOFFSections(object::COFFObjectFile &Obj,
 
         Out << "      - !Relocation\n";
         Out << "        VirtualAddress: " ;
-        yaml::writeHexNumber(Out, reloc->VirtualAddress) << '\n';
+        objyaml::writeHexNumber(Out, reloc->VirtualAddress) << '\n';
         Out << "        SymbolTableIndex: " << reloc->SymbolTableIndex << '\n';
         Out << "        Type: "
             << nameLookup(RelocationTypeX86Pairs, reloc->Type) << '\n';
@@ -290,12 +285,10 @@ static raw_ostream &yamlCOFFSections(object::COFFObjectFile &Obj,
       }
 
   }
-  return Out;
 }
 
-static raw_ostream& yamlCOFFSymbols(object::COFFObjectFile &Obj,
-                                    std::size_t NumSymbols,
-                                    raw_ostream &Out) {
+static void yamlCOFFSymbols(object::COFFObjectFile &Obj, std::size_t NumSymbols,
+                            raw_ostream &Out) {
   error_code ec;
   Out << "symbols:\n";
   for (object::symbol_iterator iter = Obj.begin_symbols();
@@ -334,13 +327,11 @@ static raw_ostream& yamlCOFFSymbols(object::COFFObjectFile &Obj,
       Out << "    NumberOfAuxSymbols: "
           << (int) symbol->NumberOfAuxSymbols << '\n';
       Out << "    AuxillaryData: ";
-      yaml::writeHexStream(Out, aux);
+      objyaml::writeHexStream(Out, aux);
     }
 
     Out << '\n';
   }
-
-  return Out;
 }