From: Dmitri Gribenko Date: Sun, 30 Dec 2012 19:45:46 +0000 (+0000) Subject: Comment lexing: replace manual comparison with StringRef::find_first_of X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aa7dbafc3539868ce271cb336444ec544260905a;p=clang Comment lexing: replace manual comparison with StringRef::find_first_of This gives an about 1.8% improvement on Clang bootstrap with -Wdocumentation git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171262 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/CommentLexer.cpp b/lib/AST/CommentLexer.cpp index 31a09f71d9..c5de09d0b2 100644 --- a/lib/AST/CommentLexer.cpp +++ b/lib/AST/CommentLexer.cpp @@ -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; }