[cfe-commits] [PATCH] PR9812: _Bool != bool

Enea Zaffanella zaffanella at cs.unipr.it
Thu Jun 23 00:05:24 PDT 2011

Il 23/06/2011 02:31, Richard Smith ha scritto:
>> The goal of BuiltinTypeLoc is to provide quite accurate information
>> about the syntax actually used in the sources and it is therefore
>> essential to distinguish between TST__Bool and TST_bool.
>> To this end, the thing to do is to change the implementation of
>> bool needsExtraLocalData() const;
>> so as to return true for BuiltinType::Bool.
> I'm not so keen on this approach: it would inflate both the in-memory
> representation of every bool type and increase the size of the serialized
> AST. If we have no intention to begin supporting both bool and _Bool in
> the same language, I'd prefer to pass LangOptions into
> BuiltinTypeLoc::getWrittenTypeSpec and use that to reconstruct the correct
> type, or find a spare bit somewhere.
> Richard

That is indeed a better approach that will work perfectly provided _Bool
and bool will never occur together (I have seen so many language
extensions supported by compilers, hence I was not excluding this
possibility a priori).


More information about the cfe-commits mailing list