[PATCH] PR14795 : -frewrite-includes sometimes results in incorrect line number
Eli Friedman
eli.friedman at gmail.com
Sun Jun 30 16:35:04 PDT 2013
On Sat, Jun 29, 2013 at 11:35 PM, Lubos Lunak <l.lunak at suse.cz> wrote:
>
> Hello,
>
> could somebody please review and commit the atached patch for pr14795?
> Thank
> you.
>
>
--- a/lib/Lex/Lexer.cpp
+++ b/lib/Lex/Lexer.cpp
@@ -2372,8 +2372,9 @@ bool Lexer::LexEndOfFile(Token &Result, const char
*CurPtr) {
FormTokenWithChars(Result, CurPtr, tok::eod);
// Restore comment saving mode, in case it was disabled for directive.
- resetExtendedTokenMode();
- return true; // Have a token.
+ if (PP)
+ resetExtendedTokenMode();
+ return true; // Have a token.
}
// If we are in raw mode, return this event as an EOF token. Let the
caller
How is this related?
+ // We surround every #include by #if 0 to comment it out, but
that
+ // changes line numbers. These are fixed up right after that,
but
+ // the whole #include could be inside a preprocessor
conditional
+ // that is not processed. So it is necessary to fix the line
This looks like it puts a line directive after every if/elif/else/endif.
That not really a problem, I guess, but it would be nice to avoid if
possible.
Otherwise, looks fine.
-Eli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130630/681b60eb/attachment.html>
More information about the cfe-commits
mailing list