[PATCH] D115168: [clang-format] [PR49298] Sort includes pass will sort inside raw strings
Marek Kurdej via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 9 11:36:09 PST 2021
curdeius added inline comments.
================
Comment at: clang/lib/Format/Format.cpp:2590
+ llvm::Regex RawStringRegex(
+ "R\"([A-Za-z0-9_{}#<>%:;.?*+/^&\\$|~!=,'\\-]*)\\(");
+ SmallVector<StringRef, 2> RawStringMatches;
----------------
I'm picky but you missed `[` and `]`, no?
================
Comment at: clang/lib/Format/Format.cpp:2604
+ // Skip past until we think we are at the rawstring literal close.
+ if (RawStringRegex.match(Trimmed, &RawStringMatches)) {
+ std::string CharSequence = RawStringMatches[1].str();
----------------
Will this match the first or the last occurrence? If it's the last then it's ok. Otherwise, we should change it. Also, please test something along the lines of:
```
R"x(...)x" ... on the same line R"y(
#include "..."
)y"
```
================
Comment at: clang/unittests/Format/SortIncludesTest.cpp:1150
+
+ // Missing |`
+#define X "AMZ029amz{}+!%*=_:;',.<>/?#~-$"
----------------
Can't `|` be tested? Same for `[` and `]`?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115168/new/
https://reviews.llvm.org/D115168
More information about the cfe-commits
mailing list