[clang] [clang-format] Treat empty for/while loops as short loops (PR #70768)
Björn Schäpers via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 1 06:12:16 PDT 2023
================
@@ -3117,9 +3117,16 @@ void UnwrappedLineParser::parseForOrWhileLoop(bool HasParens) {
FormatTok->setFinalizedType(TT_ConditionLParen);
parseParens();
}
- // Event control.
- if (Style.isVerilog())
+
+ if (Style.isVerilog()) {
+ // Event control.
parseVerilogSensitivityList();
+ } else if (Style.AllowShortLoopsOnASingleLine && FormatTok->is(tok::semi) &&
----------------
HazardyKnusperkeks wrote:
Just asking.
But I believe if you use `getPreviousNonComment()` it would be formatted as that.
https://github.com/llvm/llvm-project/pull/70768
More information about the cfe-commits
mailing list