summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-readobj
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-02-28 00:04:07 +0000
committerZachary Turner <zturner@google.com>2017-02-28 00:04:07 +0000
commit695ed56ba5d3bd3b86c6a4ed6d79b89eb8fbd2f4 (patch)
treecaf35bd7345bb071545ef39b636b40ffafc41504 /llvm/tools/llvm-readobj
parent59cd89332010b22e82c3110d558ff37948c4df1e (diff)
downloadbcm5719-llvm-695ed56ba5d3bd3b86c6a4ed6d79b89eb8fbd2f4.tar.gz
bcm5719-llvm-695ed56ba5d3bd3b86c6a4ed6d79b89eb8fbd2f4.zip
[PDB] Make streams carry their own endianness.
Before the endianness was specified on each call to read or write of the StreamReader / StreamWriter, but in practice it's extremely rare for streams to have data encoded in multiple different endiannesses, so we should optimize for the 99% use case. This makes the code cleaner and more general, but otherwise has NFC. llvm-svn: 296415
Diffstat (limited to 'llvm/tools/llvm-readobj')
-rw-r--r--llvm/tools/llvm-readobj/COFFDumper.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/tools/llvm-readobj/COFFDumper.cpp b/llvm/tools/llvm-readobj/COFFDumper.cpp
index aef9ea530b6..6de64403214 100644
--- a/llvm/tools/llvm-readobj/COFFDumper.cpp
+++ b/llvm/tools/llvm-readobj/COFFDumper.cpp
@@ -840,7 +840,7 @@ void COFFDumper::printCodeViewSymbolSection(StringRef SectionName,
}
case ModuleSubstreamKind::FrameData: {
// First four bytes is a relocation against the function.
- BinaryByteStream S(Contents);
+ BinaryByteStream S(Contents, llvm::support::little);
BinaryStreamReader SR(S);
const uint32_t *CodePtr;
error(SR.readObject(CodePtr));
@@ -965,7 +965,7 @@ void COFFDumper::printCodeViewSymbolsSubsection(StringRef Subsection,
CVSymbolDumper CVSD(W, TypeDB, std::move(CODD),
opts::CodeViewSubsectionBytes);
- BinaryByteStream Stream(BinaryData);
+ BinaryByteStream Stream(BinaryData, llvm::support::little);
CVSymbolArray Symbols;
BinaryStreamReader Reader(Stream);
if (auto EC = Reader.readArray(Symbols, Reader.getLength())) {
@@ -982,7 +982,7 @@ void COFFDumper::printCodeViewSymbolsSubsection(StringRef Subsection,
}
void COFFDumper::printCodeViewFileChecksums(StringRef Subsection) {
- BinaryByteStream S(Subsection);
+ BinaryByteStream S(Subsection, llvm::support::little);
BinaryStreamReader SR(S);
while (!SR.empty()) {
DictScope S(W, "FileChecksum");
@@ -1011,10 +1011,10 @@ void COFFDumper::printCodeViewFileChecksums(StringRef Subsection) {
}
void COFFDumper::printCodeViewInlineeLines(StringRef Subsection) {
- BinaryByteStream S(Subsection);
+ BinaryByteStream S(Subsection, llvm::support::little);
BinaryStreamReader SR(S);
uint32_t Signature;
- error(SR.readInteger(Signature, llvm::support::little));
+ error(SR.readInteger(Signature));
bool HasExtraFiles = Signature == unsigned(InlineeLinesSignature::ExtraFiles);
while (!SR.empty()) {
@@ -1027,12 +1027,12 @@ void COFFDumper::printCodeViewInlineeLines(StringRef Subsection) {
if (HasExtraFiles) {
uint32_t ExtraFileCount;
- error(SR.readInteger(ExtraFileCount, llvm::support::little));
+ error(SR.readInteger(ExtraFileCount));
W.printNumber("ExtraFileCount", ExtraFileCount);
ListScope ExtraFiles(W, "ExtraFiles");
for (unsigned I = 0; I < ExtraFileCount; ++I) {
uint32_t FileID;
- error(SR.readInteger(FileID, llvm::support::little));
+ error(SR.readInteger(FileID));
printFileNameForOffset("FileID", FileID);
}
}
@@ -1077,7 +1077,7 @@ void COFFDumper::mergeCodeViewTypes(TypeTableBuilder &CVTypes) {
error(object_error::parse_failed);
ArrayRef<uint8_t> Bytes(reinterpret_cast<const uint8_t *>(Data.data()),
Data.size());
- BinaryByteStream Stream(Bytes);
+ BinaryByteStream Stream(Bytes, llvm::support::little);
CVTypeArray Types;
BinaryStreamReader Reader(Stream);
if (auto EC = Reader.readArray(Types, Reader.getLength())) {
OpenPOWER on IntegriCloud