diff options
Diffstat (limited to 'llvm/tools/llvm-readobj/COFFDumper.cpp')
| -rw-r--r-- | llvm/tools/llvm-readobj/COFFDumper.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/llvm/tools/llvm-readobj/COFFDumper.cpp b/llvm/tools/llvm-readobj/COFFDumper.cpp index ebb52aa2acd..6cb543b4251 100644 --- a/llvm/tools/llvm-readobj/COFFDumper.cpp +++ b/llvm/tools/llvm-readobj/COFFDumper.cpp @@ -24,6 +24,7 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/DebugInfo/CodeView/CodeView.h" #include "llvm/DebugInfo/CodeView/Line.h" +#include "llvm/DebugInfo/CodeView/RecordSerialization.h" #include "llvm/DebugInfo/CodeView/SymbolRecord.h" #include "llvm/DebugInfo/CodeView/TypeDumper.h" #include "llvm/DebugInfo/CodeView/TypeIndex.h" @@ -770,8 +771,8 @@ void COFFDumper::initializeFileAndStringTables(StringRef Data) { // The section consists of a number of subsection in the following format: // |SubSectionType|SubSectionSize|Contents...| uint32_t SubType, SubSectionSize; - error(consumeUInt32(Data, SubType)); - error(consumeUInt32(Data, SubSectionSize)); + error(consume(Data, SubType)); + error(consume(Data, SubSectionSize)); if (SubSectionSize > Data.size()) return error(object_error::parse_failed); switch (ModuleSubstreamKind(SubType)) { @@ -802,7 +803,7 @@ void COFFDumper::printCodeViewSymbolSection(StringRef SectionName, W.printNumber("Section", SectionName, Obj->getSectionID(Section)); uint32_t Magic; - error(consumeUInt32(Data, Magic)); + error(consume(Data, Magic)); W.printHex("Magic", Magic); if (Magic != COFF::DEBUG_SECTION_MAGIC) return error(object_error::parse_failed); @@ -813,8 +814,8 @@ void COFFDumper::printCodeViewSymbolSection(StringRef SectionName, // The section consists of a number of subsection in the following format: // |SubSectionType|SubSectionSize|Contents...| uint32_t SubType, SubSectionSize; - error(consumeUInt32(Data, SubType)); - error(consumeUInt32(Data, SubSectionSize)); + error(consume(Data, SubType)); + error(consume(Data, SubSectionSize)); ListScope S(W, "Subsection"); W.printEnum("SubSectionType", SubType, makeArrayRef(SubSectionTypes)); @@ -1211,7 +1212,7 @@ void COFFDumper::printCodeViewSymbolsSubsection(StringRef Subsection, case S_CALLEES: { ListScope S(W, Kind == S_CALLEES ? "Callees" : "Callers"); uint32_t Count; - error(consumeUInt32(SymData, Count)); + error(consume(SymData, Count)); for (uint32_t I = 0; I < Count; ++I) { const TypeIndex *FuncID; error(consumeObject(SymData, FuncID)); @@ -1500,7 +1501,7 @@ void COFFDumper::printCodeViewSymbolsSubsection(StringRef Subsection, error(consumeObject(SymData, Constant)); printTypeIndex("Type", Constant->Type); APSInt Value; - if (!decodeNumericLeaf(SymData, Value)) + if (consume(SymData, Value)) error(object_error::parse_failed); W.printNumber("Value", Value); StringRef Name = SymData.split('\0').first; @@ -1551,7 +1552,7 @@ void COFFDumper::printCodeViewFileChecksums(StringRef Subsection) { void COFFDumper::printCodeViewInlineeLines(StringRef Subsection) { StringRef Data = Subsection; uint32_t Signature; - error(consumeUInt32(Data, Signature)); + error(consume(Data, Signature)); bool HasExtraFiles = Signature == unsigned(InlineeLinesSignature::ExtraFiles); while (!Data.empty()) { @@ -1564,12 +1565,12 @@ void COFFDumper::printCodeViewInlineeLines(StringRef Subsection) { if (HasExtraFiles) { uint32_t ExtraFileCount; - error(consumeUInt32(Data, ExtraFileCount)); + error(consume(Data, ExtraFileCount)); W.printNumber("ExtraFileCount", ExtraFileCount); ListScope ExtraFiles(W, "ExtraFiles"); for (unsigned I = 0; I < ExtraFileCount; ++I) { uint32_t FileID; - error(consumeUInt32(Data, FileID)); + error(consume(Data, FileID)); printFileNameForOffset("FileID", FileID); } } @@ -1606,7 +1607,7 @@ StringRef COFFDumper::getFileNameForFileOffset(uint32_t FileOffset) { // The string table offset comes first before the file checksum. StringRef Data = CVFileChecksumTable.drop_front(FileOffset); uint32_t StringOffset; - error(consumeUInt32(Data, StringOffset)); + error(consume(Data, StringOffset)); // Check if the string table offset is valid. if (StringOffset >= CVStringTable.size()) @@ -1631,7 +1632,7 @@ void COFFDumper::printCodeViewTypeSection(StringRef SectionName, W.printBinaryBlock("Data", Data); uint32_t Magic; - error(consumeUInt32(Data, Magic)); + error(consume(Data, Magic)); W.printHex("Magic", Magic); if (Magic != COFF::DEBUG_SECTION_MAGIC) return error(object_error::parse_failed); |

