<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/68431>68431</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-format WhitespaceManager crash
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
tiagomacarios
</td>
</tr>
</table>
<pre>
Repro:
file:
```
static constexpr T v[] {
{ AAAAAAAAAAAAAAAAAAAAAAAAA::aaaaaaaaaaaaaaaaaaa, AAAAAAAAAAAAAAAAAAAAAAAAA::aaaaaaaaaaaaaaaaaaaaaaaa, 1, 0.000000000f, "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" },
};
```
.clang-format
```
AccessModifierOffset: -3
AlignAfterOpenBracket: Align
AlignArrayOfStructures: Left
AlignConsecutiveAssignments: Consecutive
AlignConsecutiveDeclarations: true
AlignEscapedNewlinesLeft: false
AlignOperands: true
AlignTrailingComments:
Kind: Always
OverEmptyLines: 2
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: true
AlignConsecutiveShortCaseStatements:
Enabled: true
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: false
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: true
IndentBraces: false
SplitEmptyFunction: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializers : BeforeColon
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 3
ContinuationIndentWidth: 3
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: false
IndentCaseLabels: true
IndentWidth: 3
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true
LambdaBodyIndentation: OuterScope
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
PackConstructorInitializers: Never
PenaltyBreakBeforeFirstCallParameter: 100
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 10000
PointerAlignment: Left
ReflowComments: true
SortIncludes: false
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: Never
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: true
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: true
SpacesInParentheses: true
SpacesInSquareBrackets: true
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
Standard: Latest
TabWidth: 3
UseTab: Never
```
Callstack:
```
> clang-format.exe!HandleAbort(int Sig) Line 419 C++
[External Code]
clang-format.exe!llvm::SmallVectorTemplateCommon<clang::format::WhitespaceManager::Change,void>::operator[](unsigned __int64 idx) Line 298 C++
clang-format.exe!clang::format::WhitespaceManager::getNetWidth<clang::format::WhitespaceManager::CellDescription *>(clang::format::WhitespaceManager::CellDescription * const & Start, clang::format::WhitespaceManager::CellDescription * const & End, unsigned int InitialSpaces) Line 285 C++
clang-format.exe!clang::format::WhitespaceManager::getMaximumNetWidth<clang::format::WhitespaceManager::CellDescription *>(clang::format::WhitespaceManager::CellDescription * const & CellStart, clang::format::WhitespaceManager::CellDescription * const & CellStop, unsigned int InitialSpaces, unsigned int CellCount, unsigned int MaxRowCount) Line 324 C++
clang-format.exe!clang::format::WhitespaceManager::alignArrayInitializersLeftJustified(clang::format::WhitespaceManager::CellDescriptions && CellDescs) Line 1315 C++
clang-format.exe!clang::format::WhitespaceManager::alignArrayInitializers(unsigned int Start, unsigned int End) Line 1222 C++
clang-format.exe!clang::format::WhitespaceManager::alignArrayInitializers() Line 1206 C++
clang-format.exe!clang::format::WhitespaceManager::generateReplacements() Line 113 C++
clang-format.exe!clang::format::`anonymous namespace'::Formatter::analyze(clang::format::TokenAnnotator & Annotator, llvm::SmallVectorImpl<clang::format::AnnotatedLine *> & AnnotatedLines, clang::format::FormatTokenLexer & Tokens) Line 2391 C++
clang-format.exe!clang::format::TokenAnalyzer::process(bool SkipAnnotation) Line 132 C++
clang-format.exe!clang::format::internal::reformat::__l2::<lambda_10>::operator()(const clang::format::Environment & Env) Line 3673 C++
[External Code]
clang-format.exe!clang::format::internal::reformat(const clang::format::FormatStyle & Style, llvm::StringRef Code, llvm::ArrayRef<clang::tooling::Range> Ranges, unsigned int FirstStartColumn, unsigned int NextStartColumn, unsigned int LastStartColumn, llvm::StringRef FileName, clang::format::FormattingAttemptStatus * Status) Line 3688 C++
clang-format.exe!clang::format::reformat(const clang::format::FormatStyle & Style, llvm::StringRef Code, llvm::ArrayRef<clang::tooling::Range> Ranges, llvm::StringRef FileName, clang::format::FormattingAttemptStatus * Status) Line 3731 C++
clang-format.exe!clang::format::format(llvm::StringRef FileName) Line 499 C++
clang-format.exe!main(int argc, const char * * argv) Line 631 C++
[External Code]
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWVtz4jgW_jXKi6tTtkwIPPAAhtRmh4RUyGzXPnUJ-2A0kSWvJCcwv35Lkm_YJj0z2Z6a2hpXh8Y-n879IhmiFE05wAzdLNDN8ooU-iDkTFOSiozERFKhrnYiOc2eIZcChXPkL5Fffu4pg-bR2C__2VuliaaxFwuuNBxz6b14b06Ih24XDuN55rs3v3QZ3uGc9C-Eoz-wql4amA__2q-uvblHGPt_X39f_xcXwthDt0uEo7I4b5coXAwWqvu8jhnh6Ze9kBnRg7h5HINSDyKhewpys98r0Cice1_Cks5oyud7DXKTA19IEr86gCW0MVKS02a_1bKIdSFBGdAa9rqFiQRXEBeavsHctqgMuLbAFmUYv4SYEUk0Fdwu0LJoI1cqJjkkj_DOKAdl5YZzb0-YasM2OUjCkyEOL5JQRnkaiazSqmpnP1GeOJPfyUlVTzdvIFdZrk9rI9HQccWOifc5Y09Ekgw0SLXZt9Tf8Ec4arOopyET79uDkHrBRPyqNny-pTxl8CE2IgrWZAesj-9Y2PJmvXKriYauvStOdgySLotK4ooX2cfCKuRdwWMbsR76nps4dfH3-0af32b9Woj8O1ATs4UE8mqzeAl7yqlR6hl0IfnLKbdLHgW_sOI34BawFxIeCqZNCsFWS8pTdVmTF8hyRnQvqVvoBeVPJH6dy7Soi6RxcUltMqxDliSGr5LkOeVpK7DWnjphztdUVEaU5da--ijBtRSsjpZd0EJZkMmTLqc-qypHzpBdVo8kA5WTGNqoHqvN7peo5VKH7bJyDaqjV4_Vz7yrkue1w-O5kEdEx4cPeDnUyiy77FIHWpNsl5CFSE4NtM3qnifAtY1sJz5ttbY5o9p2pa5f27nV5OyCciJPti1q4dKoyfA2rpYbFUqLrAd4Adnj1E5IIK-m_1jnC3lvSpAw-itI5Rlo6U7BRDlTIsGKjK9pRm2sAuxXz217fpIkzYiVgvAtull591___bOX28cm4_FthR8SOmdswzfcNoyN3HB4AjnQPIYXu0h8pYm2oQ9rr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