[PATCH] D36159: clang-format: [JS] handle single lines comments ending in `\\`.

Martin Probst via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 8 07:46:24 PDT 2017


mprobst marked an inline comment as done.
mprobst added inline comments.


================
Comment at: lib/Format/FormatTokenLexer.cpp:544-545
+    while (BackslashPos != StringRef::npos) {
+      if (BackslashPos + 1 < FormatTok->TokenText.size() &&
+          FormatTok->TokenText[BackslashPos + 1] == '\n') {
+        const char *Offset = Lex->getBufferLocation();
----------------
klimek wrote:
> Just wondering whether the \n can be in the next token. Probably not, though, the way we set up the lexer.
AFAIU (and experimentation confirms) LLVM always lexes the `\n` as separate whitespace from the `// ...` line comment, but for backslash escaped line endings after the `\\` the `\n` is inside of it - after all it's part of the one comment token that continues on the next line.


https://reviews.llvm.org/D36159





More information about the cfe-commits mailing list