[cfe-commits] r44339 - in /cfe/trunk: Lex/LiteralSupport.cpp include/clang/Lex/LiteralSupport.h
clattner at apple.com
Thu Nov 29 11:37:56 PST 2007
On Nov 29, 2007, at 11:22 AM, Ted Kremenek wrote:
>> If ThisTokEnd points to a valid character that cannot continue
>> the literal, then pass ThisTokBegin and be done with it - APFloat
>> parses until the first character that is syntactically incorrect;
>> it assumes the caller has verified the syntax. In other words
>> \0 is just one example of a suitable terminator; almost anything
>> outside [0-9.eE+-pP] will do.
> Unfortunately, it's not clear that what ThisTokEnd points to will have
> these kind of guarantees. I would need to look more on what exactly
> APFloat considers a terminator. Alternatively, providing an extent to
> convertFromString would make the interface more generic, allowing one
> to parse APFloats from any arbitrary buffer.
to be a little more clear, we know that the terminator character
isn't valid for a pp-number. However, I'm a bit hesitant to tightly
couple APFloat and the CFE's assumptions like this. In my mind,
making a copy of the input text to null terminate it is fine for now,
ultimately it would be better to switch the number parser to take two
const char*'s as a range to read from.
More information about the cfe-commits