[cfe-commits] r59421 - /cfe/trunk/lib/AST/ExprConstant.cpp
Nuno Lopes
nunoplopes at sapo.pt
Sun Nov 16 14:07:27 PST 2008
> On Sun, Nov 16, 2008 at 11:28 AM, Nuno Lopes <nunoplopes at sapo.pt> wrote:
>> Author: nlopes
>> Date: Sun Nov 16 13:28:31 2008
>> New Revision: 59421
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=59421&view=rev
>> Log:
>> make IntExprEvaluator fold the ?: operator
>
> Nice.
>
>> +bool IntExprEvaluator::VisitConditionalOperator(const
>> ConditionalOperator *E) {
>> + llvm::APSInt Cond(32);
>> + if (!EvaluateInteger(E->getCond(), Cond, Info))
>> + return false;
>
> This should really be using HandleConversionToBool; the condition
> isn't guaranteed to be an integer.
Thanks for reviewing. I've commited the fix and I confirm it fixes things
like 'if (1.0 ? 1 : 0) { ...}'.
Nuno
More information about the cfe-commits
mailing list