From 3b3f490f9c5706bb4d216068283f78694826100b Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Tue, 31 May 2016 18:15:23 +0000 Subject: [codeview] Add a CVTypeDumper::dump(ArrayRef) overload This is a convenient wrapper when the type record is already laid out as bytes in memory. llvm-svn: 271309 --- llvm/lib/DebugInfo/CodeView/TypeDumper.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'llvm/lib/DebugInfo/CodeView') diff --git a/llvm/lib/DebugInfo/CodeView/TypeDumper.cpp b/llvm/lib/DebugInfo/CodeView/TypeDumper.cpp index edfaea1315a..d27ef494202 100644 --- a/llvm/lib/DebugInfo/CodeView/TypeDumper.cpp +++ b/llvm/lib/DebugInfo/CodeView/TypeDumper.cpp @@ -12,6 +12,7 @@ #include "llvm/DebugInfo/CodeView/CVTypeVisitor.h" #include "llvm/DebugInfo/CodeView/TypeIndex.h" #include "llvm/DebugInfo/CodeView/TypeRecord.h" +#include "llvm/DebugInfo/CodeView/ByteStream.h" #include "llvm/Support/ScopedPrinter.h" using namespace llvm; @@ -690,6 +691,18 @@ bool CVTypeDumper::dump(const CVTypeArray &Types) { return !Dumper.hadError(); } +bool CVTypeDumper::dump(ArrayRef Data) { + ByteStream Stream(Data); + CVTypeArray Types; + StreamReader Reader(Stream); + if (auto EC = Reader.readArray(Types, Reader.getLength())) { + consumeError(std::move(EC)); + return false; + } + + return dump(Types); +} + void CVTypeDumper::setPrinter(ScopedPrinter *P) { static ScopedPrinter NullP(llvm::nulls()); W = P ? P : &NullP; -- cgit v1.2.3