From: Chris Lattner Date: Mon, 11 Jan 2010 02:38:50 +0000 (+0000) Subject: add a TODO for a perf improvement in LexIdentifier. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cd991dbb12f24368753cef086c7ad3ec203c9ea6;p=clang add a TODO for a perf improvement in LexIdentifier. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93141 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp index d82f8fcf85..0a74b26482 100644 --- a/lib/Lex/Lexer.cpp +++ b/lib/Lex/Lexer.cpp @@ -643,14 +643,17 @@ void Lexer::LexIdentifier(Token &Result, const char *CurPtr) { // Match [_A-Za-z0-9]*, we have already matched [_A-Za-z$] unsigned Size; unsigned char C = *CurPtr++; - while (isIdentifierBody(C)) { + while (isIdentifierBody(C)) C = *CurPtr++; - } + --CurPtr; // Back up over the skipped character. // Fast path, no $,\,? in identifier found. '\' might be an escaped newline // or UCN, and ? might be a trigraph for '\', an escaped newline or UCN. // FIXME: UCNs. + // + // TODO: Could merge these checks into a CharInfo flag to make the comparison + // cheaper if (C != '\\' && C != '?' && (C != '$' || !Features.DollarIdents)) { FinishIdentifier: const char *IdStart = BufferPtr;