[PATCH] D125137: [clang-format] Don't remove braces if a 1-statement body would wrap
Björn Schäpers via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat May 7 03:50:27 PDT 2022
HazardyKnusperkeks added inline comments.
================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:465
+
+bool UnwrappedLineParser::mightFitOnOneLine() const {
+ const auto ColumnLimit = Style.ColumnLimit;
----------------
A bit explanation what it means that something //might// fit in one line would be nice.
================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:479
+ if (!LastToken->isOneOf(tok::semi, tok::comment))
+ return true;
+
----------------
Especially this one is not clear to me, why do we return true here?
================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:481
+
+ SmallVector<FormatToken *> SavedTokens;
+ for (const auto &Token : PreviousLine.Tokens) {
----------------
Is a FormatToken "big", or expensive to copy? If not I'd save them directly, otherwise I'd prefer a unique_ptr.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125137/new/
https://reviews.llvm.org/D125137
More information about the cfe-commits
mailing list