summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-readobj/COFFDumper.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-02-25 00:44:30 +0000
committerZachary Turner <zturner@google.com>2017-02-25 00:44:30 +0000
commitaf299ea5d456aa2fc19d7fdb041a0452d209fd4c (patch)
tree2d863cba130306041941aeec5b44baa2e9c00ec1 /llvm/tools/llvm-readobj/COFFDumper.cpp
parent42de38076517bc68a2b97c55dcbac7ea8d80b11b (diff)
downloadbcm5719-llvm-af299ea5d456aa2fc19d7fdb041a0452d209fd4c.tar.gz
bcm5719-llvm-af299ea5d456aa2fc19d7fdb041a0452d209fd4c.zip
[PDB] General improvements to Stream library.
This adds various new functionality and cleanup surrounding the use of the Stream library. Major changes include: * Renaming of all classes for more consistency / meaningfulness * Addition of some new methods for reading multiple values at once. * Full suite of unit tests for reader / writer functionality. * Full set of doxygen comments for all classes. * Streams now store their own endianness. * Fixed some bugs in a few of the classes that were discovered by the unit tests. llvm-svn: 296215
Diffstat (limited to 'llvm/tools/llvm-readobj/COFFDumper.cpp')
-rw-r--r--llvm/tools/llvm-readobj/COFFDumper.cpp35
1 files changed, 17 insertions, 18 deletions
diff --git a/llvm/tools/llvm-readobj/COFFDumper.cpp b/llvm/tools/llvm-readobj/COFFDumper.cpp
index 329768fcaa6..be90d18b121 100644
--- a/llvm/tools/llvm-readobj/COFFDumper.cpp
+++ b/llvm/tools/llvm-readobj/COFFDumper.cpp
@@ -56,7 +56,6 @@
using namespace llvm;
using namespace llvm::object;
using namespace llvm::codeview;
-using namespace llvm::msf;
using namespace llvm::support;
using namespace llvm::Win64EH;
@@ -155,7 +154,7 @@ public:
Sec = Obj->getCOFFSection(SR);
}
- uint32_t getRecordOffset(msf::StreamReader Reader) override {
+ uint32_t getRecordOffset(BinaryStreamReader Reader) override {
ArrayRef<uint8_t> Data;
if (auto EC = Reader.readLongestContiguousChunk(Data)) {
llvm::consumeError(std::move(EC));
@@ -841,13 +840,13 @@ void COFFDumper::printCodeViewSymbolSection(StringRef SectionName,
}
case ModuleSubstreamKind::FrameData: {
// First four bytes is a relocation against the function.
- msf::ByteStream S(Contents);
- msf::StreamReader SR(S);
- const uint32_t *CodePtr;
- error(SR.readObject(CodePtr));
+ BinaryByteStream S(Contents, llvm::support::little);
+ BinaryStreamReader SR(S);
+ StringRef CodePtr;
+ error(SR.readFixedString(CodePtr, 4));
StringRef LinkageName;
error(resolveSymbolName(Obj->getCOFFSection(Section), SectionContents,
- CodePtr, LinkageName));
+ CodePtr.data(), LinkageName));
W.printString("LinkageName", LinkageName);
// To find the active frame description, search this array for the
@@ -966,9 +965,9 @@ void COFFDumper::printCodeViewSymbolsSubsection(StringRef Subsection,
CVSymbolDumper CVSD(W, TypeDB, std::move(CODD),
opts::CodeViewSubsectionBytes);
- ByteStream Stream(BinaryData);
+ BinaryByteStream Stream(BinaryData, llvm::support::little);
CVSymbolArray Symbols;
- StreamReader Reader(Stream);
+ BinaryStreamReader Reader(Stream);
if (auto EC = Reader.readArray(Symbols, Reader.getLength())) {
consumeError(std::move(EC));
W.flush();
@@ -983,8 +982,8 @@ void COFFDumper::printCodeViewSymbolsSubsection(StringRef Subsection,
}
void COFFDumper::printCodeViewFileChecksums(StringRef Subsection) {
- msf::ByteStream S(Subsection);
- msf::StreamReader SR(S);
+ BinaryByteStream S(Subsection, llvm::support::little);
+ BinaryStreamReader SR(S);
while (!SR.empty()) {
DictScope S(W, "FileChecksum");
const FileChecksum *FC;
@@ -1012,10 +1011,10 @@ void COFFDumper::printCodeViewFileChecksums(StringRef Subsection) {
}
void COFFDumper::printCodeViewInlineeLines(StringRef Subsection) {
- msf::ByteStream S(Subsection);
- msf::StreamReader SR(S);
+ 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()) {
@@ -1028,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);
}
}
@@ -1078,9 +1077,9 @@ void COFFDumper::mergeCodeViewTypes(TypeTableBuilder &CVTypes) {
error(object_error::parse_failed);
ArrayRef<uint8_t> Bytes(reinterpret_cast<const uint8_t *>(Data.data()),
Data.size());
- ByteStream Stream(Bytes);
+ BinaryByteStream Stream(Bytes, llvm::support::little);
CVTypeArray Types;
- StreamReader Reader(Stream);
+ BinaryStreamReader Reader(Stream);
if (auto EC = Reader.readArray(Types, Reader.getLength())) {
consumeError(std::move(EC));
W.flush();
OpenPOWER on IntegriCloud