diff options
author | Lubos Lunak <l.lunak@suse.cz> | 2013-11-27 21:14:43 +0000 |
---|---|---|
committer | Lubos Lunak <l.lunak@suse.cz> | 2013-11-27 21:14:43 +0000 |
commit | 5c461df836445bf7a4639c1145abaf3ecc6cd432 (patch) | |
tree | e14912613f921b044b5e4f4e2ec72a906b4b235e /lib/Rewrite | |
parent | 81d0481d41a694d2a4531651a2286ea58383d91d (diff) |
strip UTF-8 BOM in -frewrite-includes (PR#15664)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195877 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Rewrite')
-rw-r--r-- | lib/Rewrite/Frontend/InclusionRewriter.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Rewrite/Frontend/InclusionRewriter.cpp b/lib/Rewrite/Frontend/InclusionRewriter.cpp index bd4250adaa..71ceb5f0b6 100644 --- a/lib/Rewrite/Frontend/InclusionRewriter.cpp +++ b/lib/Rewrite/Frontend/InclusionRewriter.cpp @@ -367,6 +367,11 @@ bool InclusionRewriter::Process(FileID FileId, 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); |