diff options
| author | Teresa Johnson <tejohnson@google.com> | 2015-10-08 15:56:24 +0000 |
|---|---|---|
| committer | Teresa Johnson <tejohnson@google.com> | 2015-10-08 15:56:24 +0000 |
| commit | b1cfcd4a53e34a88ecf937555b763f94051d3dff (patch) | |
| tree | 3a5c716190badf859d52da59a9ff18ae70514a12 /llvm/tools | |
| parent | 263b772bda18a16b6785b8875ae26c77ba991361 (diff) | |
| download | bcm5719-llvm-b1cfcd4a53e34a88ecf937555b763f94051d3dff.tar.gz bcm5719-llvm-b1cfcd4a53e34a88ecf937555b763f94051d3dff.zip | |
Support for llvm-bcanalyzer dumping of record array strings.
Summary:
Adds support for automatically detecting and printing strings
represented by Array abbrev operands, analogous to the string dumping
performed for Blob abbrev operands.
Enhanced the ThinLTO combined index test to check for the appropriate
module and function strings.
Reviewers: dexonsmith, joker.eph, davidxl
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D13553
llvm-svn: 249695
Diffstat (limited to 'llvm/tools')
| -rw-r--r-- | llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp b/llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp index 7243a6474e3..b67b89d018c 100644 --- a/llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp +++ b/llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp @@ -499,14 +499,37 @@ static bool ParseBlock(BitstreamCursor &Stream, unsigned BlockID, GetCodeName(Code, BlockID, *Stream.getBitStreamReader(), CurStreamType)) outs() << " codeid=" << Code; - if (Entry.ID != bitc::UNABBREV_RECORD) + const BitCodeAbbrev *Abbv = nullptr; + if (Entry.ID != bitc::UNABBREV_RECORD) { + Abbv = Stream.getAbbrev(Entry.ID); outs() << " abbrevid=" << Entry.ID; + } for (unsigned i = 0, e = Record.size(); i != e; ++i) outs() << " op" << i << "=" << (int64_t)Record[i]; outs() << "/>"; + if (Abbv) { + for (unsigned i = 1, e = Abbv->getNumOperandInfos(); i != e; ++i) { + const BitCodeAbbrevOp &Op = Abbv->getOperandInfo(i); + if (!Op.isEncoding() || Op.getEncoding() != BitCodeAbbrevOp::Array) + continue; + assert(i + 2 == e && "Array op not second to last"); + std::string Str; + bool ArrayIsPrintable = true; + for (unsigned j = i - 1, je = Record.size(); j != je; ++j) { + if (!isprint(static_cast<unsigned char>(Record[j]))) { + ArrayIsPrintable = false; + break; + } + Str += (char)Record[j]; + } + if (ArrayIsPrintable) outs() << " record string = '" << Str << "'"; + break; + } + } + if (Blob.data()) { outs() << " blob data = "; if (ShowBinaryBlobs) { |

