r217771 - When pretty printing attributes that have enumeration arguments, print the enumerator identifier (as a string literal) instead of the internal enumerator integral value.

Aaron Ballman aaron at aaronballman.com
Mon Sep 15 09:23:29 PDT 2014


On Mon, Sep 15, 2014 at 12:13 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> On Mon, Sep 15, 2014 at 8:14 AM, Aaron Ballman <aaron at aaronballman.com>
> wrote:
>>
>> Author: aaronballman
>> Date: Mon Sep 15 10:14:13 2014
>> New Revision: 217771
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=217771&view=rev
>> Log:
>> When pretty printing attributes that have enumeration arguments, print the
>> enumerator identifier (as a string literal) instead of the internal
>> enumerator integral value.
>
>
> I don't think this is a complete solution to the problem: EnumArgument is
> used both for string literal enumerations and for identifier enumerations,
> and the .td file doesn't distinguish the two cases. This will incorrectly
> print "" around values for attributes that take an identifier.

You are correct, we don't distinguish between the two in the tablegen
file and that should be updated at some point. There are so many
problems with attribute pretty printing right now (they show up in the
wrong locations, they don't show up at all, they show up with
semantic-but-not-syntactic arguments, etc) that I think this is still
a step in the positive direction. I'll add a FIXME to the generator
code to track this though.

(As an example for where this matters: the pcs attribute requires a
string literal semantically, but the blocks attribute only accepts an
identifier semantically.)

~Aaron



More information about the cfe-commits mailing list