[PATCH] Teach builtin clz, ctz, and popcount to be const

mail at justinbogner.com mail at justinbogner.com
Wed Jun 12 23:32:26 PDT 2013

Richard Smith <richard at metafoo.co.uk> writes:
>> Don't return false from VisitCallExpr without emitting a diagnostic (see the
>> comment at the top of the file) -- replace the
>>   if (!Val)
>>     return false;
>> with
>>   if (!Val)
>>     return Error(E);
>> Otherwise LGTM, thanks!
> Committed with that tweak as r183886.

Thanks. I don't fully understand the difference between returning false
and calling Error here, based on the previous expression and the
comments at the top of the file. Is it simply that the attempt to const
fold an int here will have already emitted an appropriate diagnostic, so
we only need to do more when we have local logic?

On a related note, what diagnostic does Error without parameters emit
here? How is it different from the "not a compile time constant" error
we get from simply returning false?

Sorry if these questions are obvious.

More information about the cfe-commits mailing list