[PATCH] D13553: Support for llvm-bcanalyzer dumping of record array strings.

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 8 08:48:46 PDT 2015


On Thu, Oct 8, 2015 at 8:27 AM, Mehdi AMINI <mehdi.amini at apple.com> wrote:
> joker.eph added inline comments.
>
> ================
> Comment at: tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:518
> @@ +517,3 @@
> +            continue;
> +          assert(i + 2 == e && "Array op not second to last");
> +          std::string Str;
> ----------------
> I don't understand this assert? The position of an array is supposed to be always second to last? What has to follow?

This assert is cloned from similar code in BitstreamCursor::readRecord
that handles Array ops. As per
http://llvm.org/docs/BitCodeFormat.html#define-abbrev-encoding, an
Array op must always be the last operand in an abbrev, and includes
the Array op code (at position 'i' here), followed by the array
element type (at position 'i+1' here).
>
> ================
> Comment at: tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:521
> @@ +520,3 @@
> +          bool ArrayIsPrintable = true;
> +          for (unsigned j = i - 1, je = Record.size(); j != je; ++j) {
> +            if (!isprint(static_cast<unsigned char>(Record[j]))) {
> ----------------
> I don't know why is this loop going to the end of the record?

Because the array is always last in the Record, see above.

>
>
> http://reviews.llvm.org/D13553
>
>
>



-- 
Teresa Johnson | Software Engineer | tejohnson at google.com | 408-460-2413


More information about the llvm-commits mailing list