aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Format/ContinuationIndenter.cpp
diff options
context:
space:
mode:
authorGedare Bloom <gedare@rtems.org>2024-09-22 15:31:19 -0600
committerGitHub <noreply@github.com>2024-09-22 14:31:19 -0700
commitdf935ff4eca91013553edbf3ca1d45b568f6709f (patch)
tree74bb3214035ab825337e6439485e36d24cc6670d /clang/lib/Format/ContinuationIndenter.cpp
parent53266f73f037bd20bcbbd7852fd0c6a7703b4c38 (diff)
downloadllvm-df935ff4eca91013553edbf3ca1d45b568f6709f.zip
llvm-df935ff4eca91013553edbf3ca1d45b568f6709f.tar.gz
llvm-df935ff4eca91013553edbf3ca1d45b568f6709f.tar.bz2
[clang-format] Fix regression with BlockIndent of Braced Initializers (#108717)
Fixes #73584.
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index 4e9ae41..4df8dc8 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -348,6 +348,13 @@ bool ContinuationIndenter::canBreak(const LineState &State) {
}
}
+ // Don't allow breaking before a closing brace of a block-indented braced list
+ // initializer if there isn't already a break.
+ if (Current.is(tok::r_brace) && Current.MatchingParen &&
+ Current.isBlockIndentedInitRBrace(Style)) {
+ return CurrentState.BreakBeforeClosingBrace;
+ }
+
// If binary operators are moved to the next line (including commas for some
// styles of constructor initializers), that's always ok.
if (!Current.isOneOf(TT_BinaryOperator, tok::comma) &&