diff options
| author | Reid Kleckner <rnk@google.com> | 2016-05-31 18:15:23 +0000 |
|---|---|---|
| committer | Reid Kleckner <rnk@google.com> | 2016-05-31 18:15:23 +0000 |
| commit | 3b3f490f9c5706bb4d216068283f78694826100b (patch) | |
| tree | 8650d5915d5e56361abd1bbe86ce90c3e4ba84c4 /llvm/lib/DebugInfo/CodeView | |
| parent | 3836482abcd2e26630026d71100852f45b25aa20 (diff) | |
| download | bcm5719-llvm-3b3f490f9c5706bb4d216068283f78694826100b.tar.gz bcm5719-llvm-3b3f490f9c5706bb4d216068283f78694826100b.zip | |
[codeview] Add a CVTypeDumper::dump(ArrayRef<uint8_t>) overload
This is a convenient wrapper when the type record is already laid out as
bytes in memory.
llvm-svn: 271309
Diffstat (limited to 'llvm/lib/DebugInfo/CodeView')
| -rw-r--r-- | llvm/lib/DebugInfo/CodeView/TypeDumper.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
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<uint8_t> 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; |

