summaryrefslogtreecommitdiffstats
path: root/clang/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
commit10af67a9c3a5b1069b9403a0b3cf8ed94b983a09 (patch)
tree2a600838544fab8ee8982f191584b75d28d51d09 /clang/lib/AST/CommentLexer.cpp
parent6dbdd4307bc397ee73ae134aa1757e905f231244 (diff)
downloadbcm5719-llvm-10af67a9c3a5b1069b9403a0b3cf8ed94b983a09.tar.gz
bcm5719-llvm-10af67a9c3a5b1069b9403a0b3cf8ed94b983a09.zip
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
Diffstat (limited to 'clang/lib/AST/CommentLexer.cpp')
-rw-r--r--clang/lib/AST/CommentLexer.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/clang/lib/AST/CommentLexer.cpp b/clang/lib/AST/CommentLexer.cpp
index 31a09f71d99..c5de09d0b27 100644
--- a/clang/lib/AST/CommentLexer.cpp
+++ b/clang/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;
}
OpenPOWER on IntegriCloud