[llvm-branch-commits] [cfe-branch] r195987 - Merging r195877:
Bill Wendling
isanbard at gmail.com
Sat Nov 30 18:07:36 PST 2013
Author: void
Date: Sat Nov 30 20:07:35 2013
New Revision: 195987
URL: http://llvm.org/viewvc/llvm-project?rev=195987&view=rev
Log:
Merging r195877:
------------------------------------------------------------------------
r195877 | llunak | 2013-11-27 13:14:43 -0800 (Wed, 27 Nov 2013) | 3 lines
strip UTF-8 BOM in -frewrite-includes (PR#15664)
------------------------------------------------------------------------
Added:
cfe/branches/release_34/test/Frontend/Inputs/rewrite-includes-bom.h
- copied unchanged from r195877, cfe/trunk/test/Frontend/Inputs/rewrite-includes-bom.h
cfe/branches/release_34/test/Frontend/rewrite-includes-bom.c
- copied unchanged from r195877, cfe/trunk/test/Frontend/rewrite-includes-bom.c
Modified:
cfe/branches/release_34/ (props changed)
cfe/branches/release_34/lib/Rewrite/Frontend/InclusionRewriter.cpp
Propchange: cfe/branches/release_34/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Nov 30 20:07:35 2013
@@ -1,4 +1,4 @@
/cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:195126,195128,195135-195136,195146,195149,195154,195158,195163,195168,195174,195268,195283,195303,195326,195329,195367,195384,195409,195420,195422,195501,195547,195556,195558,195587,195620,195669,195687,195693,195710,195716,195760,195768,195827,195887-195888,195983
+/cfe/trunk:195126,195128,195135-195136,195146,195149,195154,195158,195163,195168,195174,195268,195283,195303,195326,195329,195367,195384,195409,195420,195422,195501,195547,195556,195558,195587,195620,195669,195687,195693,195710,195716,195760,195768,195827,195877,195887-195888,195983
/cfe/trunk/test:170344
/cfe/trunk/test/SemaTemplate:126920
Modified: cfe/branches/release_34/lib/Rewrite/Frontend/InclusionRewriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_34/lib/Rewrite/Frontend/InclusionRewriter.cpp?rev=195987&r1=195986&r2=195987&view=diff
==============================================================================
--- cfe/branches/release_34/lib/Rewrite/Frontend/InclusionRewriter.cpp (original)
+++ cfe/branches/release_34/lib/Rewrite/Frontend/InclusionRewriter.cpp Sat Nov 30 20:07:35 2013
@@ -367,6 +367,11 @@ bool InclusionRewriter::Process(FileID F
unsigned NextToWrite = 0;
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);
More information about the llvm-branch-commits
mailing list