[PATCH] D114151: [clang-format] [C++20] [Module] clang-format couldn't recognize partitions
Owen Pan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 23 19:08:10 PST 2021
owenpan added inline comments.
================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1057
+ nextToken();
+ do {
+ if (FormatTok->is(tok::colon)) {
----------------
A `while (!eof())` or `while (FormatTok->isNot(tok::eof)` would be safer here just in case the last line is `import` followed by eof.
================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1064-1065
+ nextToken();
+ while (FormatTok && FormatTok->isNot(tok::semi) &&
+ FormatTok->isNot(tok::greater)) {
+ // Mark tokens up to the trailing line comments as implicit string
----------------
Possible infinite loop here as well. Maybe change it to `while (!FormatTok->isOneOf(tok::greater, tok::semi, tok::eof) {`?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114151/new/
https://reviews.llvm.org/D114151
More information about the cfe-commits
mailing list