@@ -82,16 +82,16 @@ void ObjDumper::printAsStringList(StringRef StringContent,
8282 continue ;
8383 }
8484 W.startLine () << format (" [%6tx] " , CurrentWord - StrContent);
85- printAsPrintable (W.startLine (), CurrentWord, WordSize);
86- W.startLine () << ' \n ' ;
85+ printAsPrintable (W.getOStream (), CurrentWord, WordSize);
86+ W.getOStream () << ' \n ' ;
8787 CurrentWord += WordSize + 1 ;
8888 }
8989}
9090
9191void ObjDumper::printFileSummary (StringRef FileStr, object::ObjectFile &Obj,
9292 ArrayRef<std::string> InputFilenames,
9393 const object::Archive *A) {
94- W.startLine () << " \n " ;
94+ W.getOStream () << " \n " ;
9595 W.printString (" File" , FileStr);
9696 W.printString (" Format" , Obj.getFileFormatName ());
9797 W.printString (" Arch" , Triple::getArchTypeName (Obj.getArch ()));
@@ -163,7 +163,8 @@ void ObjDumper::printSectionsAsString(const object::ObjectFile &Obj,
163163 for (object::SectionRef Section :
164164 getSectionRefsByNameOrIndex (Obj, Sections)) {
165165 StringRef SectionName = unwrapOrError (Obj.getFileName (), Section.getName ());
166- W.startLine () << " \n String dump of section '" << SectionName << " ':\n " ;
166+ W.getOStream () << ' \n ' ;
167+ W.startLine () << " String dump of section '" << SectionName << " ':\n " ;
167168
168169 StringRef SectionContent =
169170 unwrapOrError (Obj.getFileName (), Section.getContents ());
@@ -180,7 +181,8 @@ void ObjDumper::printSectionsAsHex(const object::ObjectFile &Obj,
180181 for (object::SectionRef Section :
181182 getSectionRefsByNameOrIndex (Obj, Sections)) {
182183 StringRef SectionName = unwrapOrError (Obj.getFileName (), Section.getName ());
183- W.startLine () << " \n Hex dump of section '" << SectionName << " ':\n " ;
184+ W.getOStream () << ' \n ' ;
185+ W.startLine () << " Hex dump of section '" << SectionName << " ':\n " ;
184186
185187 StringRef SectionContent =
186188 unwrapOrError (Obj.getFileName (), Section.getContents ());
@@ -196,13 +198,13 @@ void ObjDumper::printSectionsAsHex(const object::ObjectFile &Obj,
196198
197199 W.startLine () << format_hex (Section.getAddress () + (SecPtr - SecContent),
198200 10 );
199- W.startLine () << ' ' ;
201+ W.getOStream () << ' ' ;
200202 for (i = 0 ; TmpSecPtr < SecEnd && i < 4 ; ++i) {
201203 for (k = 0 ; TmpSecPtr < SecEnd && k < 4 ; k++, TmpSecPtr++) {
202204 uint8_t Val = *(reinterpret_cast <const uint8_t *>(TmpSecPtr));
203- W.startLine () << format_hex_no_prefix (Val, 2 );
205+ W.getOStream () << format_hex_no_prefix (Val, 2 );
204206 }
205- W.startLine () << ' ' ;
207+ W.getOStream () << ' ' ;
206208 }
207209
208210 // We need to print the correct amount of spaces to match the format.
@@ -211,17 +213,17 @@ void ObjDumper::printSectionsAsHex(const object::ObjectFile &Obj,
211213 // Least, if we cut in a middle of a row, we add the remaining characters,
212214 // which is (8 - (k * 2)).
213215 if (i < 4 )
214- W.startLine () << format (" %*c" , (4 - i) * 8 + (4 - i), ' ' );
216+ W.getOStream () << format (" %*c" , (4 - i) * 8 + (4 - i), ' ' );
215217 if (k < 4 )
216- W.startLine () << format (" %*c" , 8 - k * 2 , ' ' );
218+ W.getOStream () << format (" %*c" , 8 - k * 2 , ' ' );
217219
218220 TmpSecPtr = SecPtr;
219221 for (i = 0 ; TmpSecPtr + i < SecEnd && i < 16 ; ++i)
220- W.startLine () << (isPrint (TmpSecPtr[i])
221- ? static_cast <char >(TmpSecPtr[i])
222- : ' .' );
222+ W.getOStream () << (isPrint (TmpSecPtr[i])
223+ ? static_cast <char >(TmpSecPtr[i])
224+ : ' .' );
223225
224- W.startLine () << ' \n ' ;
226+ W.getOStream () << ' \n ' ;
225227 }
226228 }
227229}
0 commit comments