forked from OSchip/llvm-project
strip UTF-8 BOM in -frewrite-includes (PR#15664)
llvm-svn: 195877
This commit is contained in:
parent
72e5b93b82
commit
c6b9270d04
|
@ -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);
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
// This file starts with UTF-8 BOM marker.
|
|
@ -0,0 +1,4 @@
|
|||
// RUN: %clang -E -frewrite-includes -I %S/Inputs %s -o - | %clang -fsyntax-only -Xclang -verify -x c -
|
||||
// expected-no-diagnostics
|
||||
|
||||
#include "rewrite-includes-bom.h"
|
Loading…
Reference in New Issue