diff options
| author | Eli Friedman <eli.friedman@gmail.com> | 2011-05-10 17:11:21 +0000 |
|---|---|---|
| committer | Eli Friedman <eli.friedman@gmail.com> | 2011-05-10 17:11:21 +0000 |
| commit | 86a5101c277646fc8b82ab4b246fea82a0df7fd7 (patch) | |
| tree | 8cb0c66209571f2cdbf6fc270ffdb3ca973a096c /clang/lib/Lex | |
| parent | 27390b4a0e187a673bf9b90f32164fd953a0c967 (diff) | |
| download | bcm5719-llvm-86a5101c277646fc8b82ab4b246fea82a0df7fd7.tar.gz bcm5719-llvm-86a5101c277646fc8b82ab4b246fea82a0df7fd7.zip | |
Don't strlen() every file before parsing it.
llvm-svn: 131132
Diffstat (limited to 'clang/lib/Lex')
| -rw-r--r-- | clang/lib/Lex/Lexer.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index 16cc4f8fd54..3b1149c08af 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/lib/Lex/Lexer.cpp @@ -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); |

