[PATCH] D30748: [Lexer] Finding beginning of token with escaped new line
Alexander Kornienko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 9 03:30:42 PST 2017
alexfh requested changes to this revision.
alexfh added inline comments.
This revision now requires changes to proceed.
================
Comment at: lib/Lex/Lexer.cpp:457
+static bool isNewLineEscaped(const char *BufferStart, const char *Str) {
+ while (Str > BufferStart && isWhitespace(*Str))
+ --Str;
----------------
We only care about two specific sequences here: `\\\r\n` or `\\\n`, not a backslash followed by arbitrary whitespace.
================
Comment at: unittests/Lex/LexerTest.cpp:386
+ // further offset calculation to be more straightforward.
+ const auto IdentifierLength = 8;
+ std::string textToLex =
----------------
LLVM doesn't use "almost always auto" style. See http://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable
================
Comment at: unittests/Lex/LexerTest.cpp:387
+ const auto IdentifierLength = 8;
+ std::string textToLex =
+ "rabarbar\n"
----------------
Variable names should start with a capital letter: `TextToLex`. Same elsewhere.
================
Comment at: unittests/Lex/LexerTest.cpp:402
+
+ auto foundLocation = SourceMgr.getDecomposedExpansionLoc(
+ Lexer::GetBeginningOfToken(
----------------
Please clang-format.
https://reviews.llvm.org/D30748
More information about the cfe-commits
mailing list