[ArchiveWriter] Use EndianStream. No functional change intended.

llvm-svn: 239913
This commit is contained in:
Benjamin Kramer 2015-06-17 16:02:56 +00:00
parent b689dede58
commit cd278b7e99
1 changed files with 4 additions and 9 deletions

View File

@ -18,6 +18,7 @@
#include "llvm/Object/Archive.h" #include "llvm/Object/Archive.h"
#include "llvm/Object/ObjectFile.h" #include "llvm/Object/ObjectFile.h"
#include "llvm/Object/SymbolicFile.h" #include "llvm/Object/SymbolicFile.h"
#include "llvm/Support/EndianStream.h"
#include "llvm/Support/Errc.h" #include "llvm/Support/Errc.h"
#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h" #include "llvm/Support/Format.h"
@ -83,9 +84,7 @@ static void printWithSpacePadding(raw_fd_ostream &OS, T Data, unsigned Size,
OS << Data; OS << Data;
unsigned SizeSoFar = OS.tell() - OldPos; unsigned SizeSoFar = OS.tell() - OldPos;
if (Size > SizeSoFar) { if (Size > SizeSoFar) {
unsigned Remaining = Size - SizeSoFar; OS.indent(Size - SizeSoFar);
for (unsigned I = 0; I < Remaining; ++I)
OS << ' ';
} else if (Size < SizeSoFar) { } else if (Size < SizeSoFar) {
assert(MayTruncate && "Data doesn't fit in Size"); assert(MayTruncate && "Data doesn't fit in Size");
// Some of the data this is used for (like UID) can be larger than the // Some of the data this is used for (like UID) can be larger than the
@ -94,12 +93,8 @@ static void printWithSpacePadding(raw_fd_ostream &OS, T Data, unsigned Size,
} }
} }
static void print32BE(raw_fd_ostream &Out, unsigned Val) { static void print32BE(raw_ostream &Out, uint32_t Val) {
// FIXME: Should use Endian.h here. support::endian::Writer<support::big>(Out).write(Val);
for (int I = 3; I >= 0; --I) {
char V = (Val >> (8 * I)) & 0xff;
Out << V;
}
} }
static void printRestOfMemberHeader(raw_fd_ostream &Out, static void printRestOfMemberHeader(raw_fd_ostream &Out,