aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/CommentLexer.cpp
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2012-12-30 19:45:46 +0000
committerDmitri Gribenko <gribozavr@gmail.com>2012-12-30 19:45:46 +0000
commitaa7dbafc3539868ce271cb336444ec544260905a (patch)
treec0485904d5e7cfef115485dadc430ec33c307485 /lib/AST/CommentLexer.cpp
parent9f0c692c4db9012248c65fab6cb703f2ce444dfe (diff)
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
Diffstat (limited to 'lib/AST/CommentLexer.cpp')
-rw-r--r--lib/AST/CommentLexer.cpp15
1 files changed, 6 insertions, 9 deletions
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;
}