On 03/12/2013 20:01, Lubos Lunak wrote:
On Tuesday 03 of December 2013, Reid Kleckner wrote:
This seems like it has the side effect of trimming leading whitespace from
the rewritten file, but that's probably fine.
It's not. The main file does not start with any line markers, so it is
possible that lines in warnings/errors will be wrong. Please fix this or
revert the change to the previous one that works.
Hi Lubos,
I don't see the problem here. Can you explain, preferably with a test case?
Alp.
On Wed, Nov 27, 2013 at 11:21 PM, Alp Toker <[email protected]> wrote:
Author: alp
Date: Thu Nov 28 01:21:44 2013
New Revision: 195910
URL: http://llvm.org/viewvc/llvm-project?rev=195910&view=rev
Log:
InclusionRewriter: Avoid duplicated BOM check
The lexer already knows its position in the file, so use that instead of
guessing it might be 3.
Modified:
cfe/trunk/lib/Rewrite/Frontend/InclusionRewriter.cpp
Modified: cfe/trunk/lib/Rewrite/Frontend/InclusionRewriter.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/Frontend/Inclus
ionRewriter.cpp?rev=195910&r1=195909&r2=195910&view=diff
=========================================================================
===== --- cfe/trunk/lib/Rewrite/Frontend/InclusionRewriter.cpp (original)
+++ cfe/trunk/lib/Rewrite/Frontend/InclusionRewriter.cpp Thu Nov 28
01:21:44 2013
@@ -363,15 +363,11 @@ bool InclusionRewriter::Process(FileID F
if (SM.getFileIDSize(FileId) == 0)
return false;
- // The next byte to be copied from the source file
- unsigned NextToWrite = 0;
+ // The next byte to be copied from the source file, which may be
non-zero if
+ // the lexer handled a BOM.
+ unsigned NextToWrite = SM.getFileOffset(RawLex.getSourceLocation());
int Line = 1; // The current input file line number.
- // Ignore UTF-8 BOM, otherwise it'd end up somewhere else than the
start - // of the resulting file.
- if (FromFile.getBuffer().startswith("\xEF\xBB\xBF"))
- NextToWrite = 3;
-
Token RawToken;
RawLex.LexFromRawLexer(RawToken);
--
http://www.nuanti.com
the browser experts
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits