[clang] b683709 - [clang-format] Fix a possible crash in `AlignAfterOpenBracket: BlockIndent`
Owen Pan via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 6 17:46:09 PST 2023
Author: Owen Pan
Date: 2023-12-06T17:40:41-08:00
New Revision: b683709ea6eec7d0a388bd50c571774c9b9ffdb7
URL: https://github.com/llvm/llvm-project/commit/b683709ea6eec7d0a388bd50c571774c9b9ffdb7
DIFF: https://github.com/llvm/llvm-project/commit/b683709ea6eec7d0a388bd50c571774c9b9ffdb7.diff
LOG: [clang-format] Fix a possible crash in `AlignAfterOpenBracket: BlockIndent`
Added:
Modified:
clang/lib/Format/ContinuationIndenter.cpp
Removed:
################################################################################
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index cb7dc5f3dd9ba..9e4e939503dfe 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -1259,7 +1259,7 @@ unsigned ContinuationIndenter::getNewLineColumn(const LineState &State) {
}
if (Style.AlignAfterOpenBracket == FormatStyle::BAS_BlockIndent &&
(Current.is(tok::r_paren) ||
- (Current.is(tok::r_brace) &&
+ (Current.is(tok::r_brace) && Current.MatchingParen &&
Current.MatchingParen->is(BK_BracedInit))) &&
State.Stack.size() > 1) {
return State.Stack[State.Stack.size() - 2].LastSpace;
More information about the cfe-commits
mailing list