forked from OSchip/llvm-project
Don't strlen() every file before parsing it.
llvm-svn: 131132
This commit is contained in:
parent
27390b4a0e
commit
86a5101c27
|
@ -76,7 +76,8 @@ void Lexer::InitLexer(const char *BufStart, const char *BufPtr,
|
|||
// skip the UTF-8 BOM if it's present.
|
||||
if (BufferStart == BufferPtr) {
|
||||
// Determine the size of the BOM.
|
||||
size_t BOMLength = llvm::StringSwitch<size_t>(BufferStart)
|
||||
llvm::StringRef Buf(BufferStart, BufferEnd - BufferStart);
|
||||
size_t BOMLength = llvm::StringSwitch<size_t>(Buf)
|
||||
.StartsWith("\xEF\xBB\xBF", 3) // UTF-8 BOM
|
||||
.Default(0);
|
||||
|
||||
|
|
Loading…
Reference in New Issue