diff options
| author | william woodruff <william@yossarian.net> | 2021-10-10 09:40:22 +0530 |
|---|---|---|
| committer | Shivam Gupta <shivam98.tkg@gmail.com> | 2021-10-10 10:15:14 +0530 |
| commit | e7fc254875ca9e82b899d5354fae9b5b779ff485 (patch) | |
| tree | 728e49d5eee5aee8915be9c18b6f198352c34c95 /llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp | |
| parent | f95d9c95bbf4cf662b9a181245fc6dcede39f590 (diff) | |
[BitcodeAnalyzer] allow a motivated user to dump BLOCKINFO
This adds the `--dump-blockinfo` flag to `llvm-bcanalyzer`, allowing a sufficiently motivated user to dump (parts of) the `BLOCKINFO_BLOCK` block. The default behavior is unchanged, and `--dump-blockinfo` only takes effect in the same context as other flags that control dump behavior (i.e., requires that `--dump` is also passed).
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D107536
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp')
| -rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp b/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp index f577d3886e01..7777c5d9b1dc 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp @@ -744,7 +744,7 @@ Error BitcodeAnalyzer::parseBlock(unsigned BlockID, unsigned IndentLevel, // BLOCKINFO is a special part of the stream. bool DumpRecords = O.hasValue(); if (BlockID == bitc::BLOCKINFO_BLOCK_ID) { - if (O) + if (O && !O->DumpBlockinfo) O->OS << Indent << "<BLOCKINFO_BLOCK/>\n"; Expected<Optional<BitstreamBlockInfo>> MaybeNewBlockInfo = Stream.ReadBlockInfoBlock(/*ReadBlockInfoNames=*/true); @@ -758,8 +758,8 @@ Error BitcodeAnalyzer::parseBlock(unsigned BlockID, unsigned IndentLevel, if (Error Err = Stream.JumpToBit(BlockBitStart)) return Err; // It's not really interesting to dump the contents of the blockinfo - // block. - DumpRecords = false; + // block, so only do it if the user explicitly requests it. + DumpRecords = O && O->DumpBlockinfo; } unsigned NumWords = 0; |
