[PATCH] Refactor attribute arguments

Aaron Ballman aaron at aaronballman.com
Tue Jul 23 07:06:48 PDT 2013


LGTY then?

~Aaron

On Mon, Jul 22, 2013 at 5:44 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
> On Mon, Jul 22, 2013 at 2:37 PM, Aaron Ballman <aaron at aaronballman.com> wrote:
>> My testing showed it to be the case -- when using the index returned
>> from checkFunctionOrMethodArgumentIndex, it was always off by one or
>> two depending on context.  Specifically:
>>
>> const char* g2(const char*) __attribute__((format_arg(2)));
>>
>> checkFunctionOrMethodIndex would return index 0 because it cares about
>> the const char * -- adding 1 to it when passing in the argument to
>> addAttr (to make it one based instead of zero based) was not
>> sufficient; I would get crashes in other parts of the system for that
>> test case.  Having it pass in two is consistent with the previous
>> behavior.
>
> Oh, right... checkFunctionOrMethodArgumentIndex is performing the
> conversion, but Sema for format attributes expects the unconverted
> version.  We should probably clean that up at some point, but that
> shouldn't block this patch.
>
> -Eli



More information about the cfe-commits mailing list