forked from OSchip/llvm-project
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:
parent
6dbdd4307b
commit
10af67a9c3
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue