<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Dec 3, 2013 at 12:01 PM, Lubos Lunak <span dir="ltr"><<a href="mailto:l.lunak@centrum.cz" target="_blank">l.lunak@centrum.cz</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Tuesday 03 of December 2013, Reid Kleckner wrote:<br>
> This seems like it has the side effect of trimming leading whitespace from<br>
> the rewritten file, but that's probably fine.<br>
<br>
</div> It's not. The main file does not start with any line markers, so it is<br>
possible that lines in warnings/errors will be wrong. Please fix this or<br>
revert the change to the previous one that works.</blockquote><div><br></div><div>Alternatively, can we emit a #line directive if the line of the first token isn't on line 1?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">
> On Wed, Nov 27, 2013 at 11:21 PM, Alp Toker <<a href="mailto:alp@nuanti.com">alp@nuanti.com</a>> wrote:<br>
> > Author: alp<br>
> > Date: Thu Nov 28 01:21:44 2013<br>
> > New Revision: 195910<br>
> ><br>
> > URL: <a href="http://llvm.org/viewvc/llvm-project?rev=195910&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=195910&view=rev</a><br>
> > Log:<br>
> > InclusionRewriter: Avoid duplicated BOM check<br>
> ><br>
> > The lexer already knows its position in the file, so use that instead of<br>
> > guessing it might be 3.<br>
> ><br>
> > Modified:<br>
> > cfe/trunk/lib/Rewrite/Frontend/InclusionRewriter.cpp<br>
> ><br>
> > Modified: cfe/trunk/lib/Rewrite/Frontend/InclusionRewriter.cpp<br>
> > URL:<br>
> > <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/Frontend/Inclus" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/Frontend/Inclus</a><br>
> >ionRewriter.cpp?rev=195910&r1=195909&r2=195910&view=diff<br>
> ><br>
> > =========================================================================<br>
</div>> >===== --- cfe/trunk/lib/Rewrite/Frontend/InclusionRewriter.cpp (original)<br>
<div class="HOEnZb"><div class="h5">> > +++ cfe/trunk/lib/Rewrite/Frontend/InclusionRewriter.cpp Thu Nov 28<br>
> > 01:21:44 2013<br>
> > @@ -363,15 +363,11 @@ bool InclusionRewriter::Process(FileID F<br>
> > if (SM.getFileIDSize(FileId) == 0)<br>
> > return false;<br>
> ><br>
> > - // The next byte to be copied from the source file<br>
> > - unsigned NextToWrite = 0;<br>
> > + // The next byte to be copied from the source file, which may be<br>
> > non-zero if<br>
> > + // the lexer handled a BOM.<br>
> > + unsigned NextToWrite = SM.getFileOffset(RawLex.getSourceLocation());<br>
> > int Line = 1; // The current input file line number.<br>
> ><br>
> > - // Ignore UTF-8 BOM, otherwise it'd end up somewhere else than the<br>
> > start - // of the resulting file.<br>
> > - if (FromFile.getBuffer().startswith("\xEF\xBB\xBF"))<br>
> > - NextToWrite = 3;<br>
> > -<br>
> > Token RawToken;<br>
> > RawLex.LexFromRawLexer(RawToken);<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Lubos Lunak<br>
</font></span></blockquote></div><br></div></div>