[cfe-dev] Relexing more than one tokens
Chris Lattner
clattner at apple.com
Wed Jul 8 09:21:06 PDT 2009
On Jul 7, 2009, at 11:54 PM, Abramo Bagnara wrote:
>>> Are you meaning that preprocessing the whole translation unit
>>> again I'd
>>> get the same SourceLocation opaque ID?
>>
>> Hopefully. If not, you can do a "deep comparison" along the lines of
>> SourceManager::isBeforeInTranslationUnit.
>
> Instead of preprocessing the whole translation unit, wouldn't be more
> effective to transform Preprocessor::Lex() in a virtual method and
> permit to applications to use a derived class of Preprocessor that
> have
> a Lex method that after calling Preprocessor::Lex() saves a copy of
> each
> tokens in the big vector you said above?
Yes, but that would impose an unacceptable performance penalty on the
normal case. Also, you can't subclass "Preprocessor".
-Chris
More information about the cfe-dev
mailing list