Comment lexing: replace manual comparison with StringRef::find_first_of

This gives an about 1.8% improvement on Clang bootstrap with -Wdocumentation

llvm-svn: 171262
This commit is contained in:
Dmitri Gribenko 2012-12-30 19:45:46 +00:00
parent 6dbdd4307b
commit 10af67a9c3
1 changed files with 6 additions and 9 deletions

View File

@ -415,15 +415,12 @@ void Lexer::lexCommentText(Token &T) {
return;
default: {
while (true) {
TokenPtr++;
if (TokenPtr == CommentEnd)
break;
const char C = *TokenPtr;
if(C == '\n' || C == '\r' ||
C == '\\' || C == '@' || C == '&' || C == '<')
break;
}
size_t End = StringRef(TokenPtr, CommentEnd - TokenPtr).
find_first_of("\n\r\\@&<");
if (End != StringRef::npos)
TokenPtr += End;
else
TokenPtr = CommentEnd;
formTextToken(T, TokenPtr);
return;
}