On Mar 17, 2012, at 5:40 PM, Jordan Rose wrote:
>
> On Mar 6, 2012, at 12:05, Ted Kremenek wrote:
>
>> +ExprResult Sema::ActOnObjCBoolLiteral(SourceLocation AtLoc,
>> + SourceLocation ValueLoc,
>> + bool Value) {
>> + ExprResult Inner;
>> + if (getLangOptions().CPlusPlus) {
>> + Inner = ActOnCXXBoolLiteral(ValueLoc, Value? tok::kw_true :
>> tok::kw_false);
>> + } else {
>> + // C doesn't actually have a way to represent literal values of type
>> + // _Bool. So, we'll use 0/1 and implicit cast to _Bool.
>> + Inner = ActOnIntegerConstant(ValueLoc, Value? 1 : 0);
>> + Inner = ImpCastExprToType(Inner.get(), Context.BoolTy,
>> + CK_IntegralToBoolean);
>> + }
>> +
>> + return BuildObjCNumericLiteral(AtLoc, Inner.get());
>
> Late with code review, but since you have ActOnObjCBoolLiteral(SourceLocation
> OpLoc, tok::TokenKind Kind), why not use that now? I assume that's why it was
> even introduced...to AVOID this cast dance.
Actions.ActOnObjCBoolLiteral(ConsumeToken(), Kind) produces the AST for
__objc_yes/__objc_no scalar values while ObjCNumericLiteral is for
@__objc_yes/@__objc_no objects.
I agree that names are confusing.
- fariborz
>
> (The names are confusing me, too... ActOnObjCBoolLiteral is handling both
> __objc_yes and @__objc_yes (...and @true).)
>
>
> _______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits