From 6b9f46e4e4360b2944101376193f17133ddaa5c9 Mon Sep 17 00:00:00 2001 From: Teresa Johnson Date: Thu, 8 Oct 2015 15:56:24 +0000 Subject: [PATCH] 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249695 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/tools/gold/X86/thinlto.ll | 8 ++++++-- tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp | 25 ++++++++++++++++++++++- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/test/tools/gold/X86/thinlto.ll b/test/tools/gold/X86/thinlto.ll index 296b9460005..b24e4af80bf 100644 --- a/test/tools/gold/X86/thinlto.ll +++ b/test/tools/gold/X86/thinlto.ll @@ -8,13 +8,17 @@ ; RUN: not test -e %t3 ; COMBINED: "; + 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(Record[j]))) { + ArrayIsPrintable = false; + break; + } + Str += (char)Record[j]; + } + if (ArrayIsPrintable) outs() << " record string = '" << Str << "'"; + break; + } + } + if (Blob.data()) { outs() << " blob data = "; if (ShowBinaryBlobs) { -- 2.34.1