Hi, On Thu, June 16, 2011 14:00, Enea Zaffanella wrote: > Il 14/06/2011 16:43, Douglas Gregor ha scritto: >> On Jun 12, 2011, at 5:42 AM, Richard Smith wrote: >>> The attached patch fixes PR9812 by splitting TST_bool into TST_bool >>> (for >>> C++ bool) and TST__Bool (for C99 _Bool). They both still translate >>> into BuiltinType::Bool, but are now given the appropriate names in >>> diagnostics. >> >> Cool, thanks! >> >>> One subtlety: BuiltinTypeLoc::getWrittenTypeSpec tries to convert >>> backwards from a BuiltinType to a TypeSpecifierType. I've arbitrarily >>> made this continue to produce TST_bool for BuiltinType::Bool, but this >>> code is actually not currently reachable: the function is only called >>> by the AST serialization code, and only in cases where the type cannot >>> be bool. >> >> Weird, but okay. > > Sorry for this late answer, but I hadn't noticed this thread before.
Sorry for this late response! > 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 _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
