[PATCH] D154091: [clang-format] Recognize escape sequences when breaking strings
sstwcw via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 5 07:53:40 PDT 2023
sstwcw added a comment.
It won't break the string inside an escape sequence. But escape sequences like `\040`, `\x20`, and `\u0020` don't get recognized as whitespace.
================
Comment at: clang/lib/Format/BreakableToken.cpp:199
+ if (EscapeSequence && Advance == 2) {
+ switch (Text[1]) {
----------------
MyDeveloperDay wrote:
> Can we add a unit test for escape sequences > \X which I assume this handles
There are already tests that verify that the string does not get broken inside an escape sequence in `BreaksWideAndNSStringLiterals` and `DoNotBreakStringLiteralsInEscapeSequence`. And escape sequences longer than 1 character following the backslash should not begin with one of these letters. So I don't see what tests I should add.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154091/new/
https://reviews.llvm.org/D154091
More information about the cfe-commits
mailing list