[cfe-commits] r59671 - in /cfe/trunk/lib/Lex: PPLexerChange.cpp PPMacroExpansion.cpp Preprocessor.cpp
Chris Lattner
clattner at apple.com
Wed Nov 19 23:42:33 PST 2008
On Nov 19, 2008, at 2:43 PM, Ted Kremenek wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=59671&view=rev
> Log:
> Move more cases of using 'CurLexer' to 'CurPPLexer'.
> Use PTHLexer::isNextPPTokenLParen() when using the PTHLexer.
Ok.
>
> - Callbacks->FileChanged(CurLexer->getSourceLocation(CurLexer-
> >BufferPtr),
> - PPCallbacks::ExitFile, FileType);
> + if (CurLexer)
> + Callbacks->FileChanged(CurLexer->getSourceLocation(CurLexer-
> >BufferPtr),
> + PPCallbacks::ExitFile, FileType);
> + // FIXME: Add callback support for PTHLexer.
Thanks for turning this into assert(0) in a subsequent commit.
> @@ -184,24 +186,31 @@
> // rather than "on the line following it", which doesn't exist.
> This makes
> // diagnostics relating to the end of file include the last file
> that the user
> // actually typed, which is goodness.
> + if (CurLexer) {
> + const char *EndPos = CurLexer->BufferEnd;
> if (EndPos != CurLexer->BufferStart &&
FWIW, I agree that this diagnostic should not apply to PTH.
> + else {
> + CurPTHLexer->setEOF(Result);
> + CurPTHLexer.reset();
I don't like the name "setEOF". This looks like your setting
CurPTHLexer to EOF, not that you're setting Result to EOF.
How about:
CurPTHLexer->getEOFToken(Result);
or even:
Result = CurPTHLexer->getEOFToken();
-Chris
More information about the cfe-commits
mailing list