[clang] [clang-format] Don't confuse initializer equal signs in for loops (PR #77712)
Gedare Bloom via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 10 17:53:01 PST 2024
================
@@ -703,7 +703,9 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun,
if (Current.is(tok::equal) &&
(State.Line->First->is(tok::kw_for) || Current.NestingLevel == 0) &&
- CurrentState.VariablePos == 0) {
+ CurrentState.VariablePos == 0 &&
+ (!Previous.Previous ||
+ Previous.Previous->isNot(TT_DesignatedInitializerPeriod))) {
----------------
gedare wrote:
Might need to search further back if the element being initialized is an array.
` struct { int x[2]; } a[] = { [0].x = {1,1}, [1].x[0] = 42};`
https://github.com/llvm/llvm-project/pull/77712
More information about the cfe-commits
mailing list