[cfe-commits] r152137 - in /cfe/trunk: include/clang/AST/ include/clang/Basic/ include/clang/Driver/ include/clang/Frontend/ include/clang/Parse/ include/clang/Sema/ include/clang/Serialization/ lib/AST/ lib/CodeGen/ lib/Driver/ lib/Lex/ lib/Parse/ lib/Sema/ lib/Serialization/ test/CodeGenObjC/ test/CodeGenObjC/Inputs/ test/CodeGenObjCXX/ test/CodeGenObjCXX/Inputs/ test/Driver/ test/PCH/ test/SemaObjC/ test/SemaObjCXX/
jahanian
fjahanian at apple.com
Mon Mar 19 10:13:41 PDT 2012
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
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list