@@ -3754,10 +3754,11 @@ void TokenAnnotator::calculateFormattingInformation(AnnotatedLine &Line) const {
37543754 for (AnnotatedLine *ChildLine : Line.Children )
37553755 calculateFormattingInformation (*ChildLine);
37563756
3757- Line.First ->TotalLength =
3758- Line.First ->IsMultiline ? Style.ColumnLimit
3759- : Line.FirstStartColumn + Line.First ->ColumnWidth ;
3760- FormatToken *Current = Line.First ->Next ;
3757+ auto *First = Line.First ;
3758+ First->TotalLength = First->IsMultiline
3759+ ? Style.ColumnLimit
3760+ : Line.FirstStartColumn + First->ColumnWidth ;
3761+ FormatToken *Current = First->Next ;
37613762 bool InFunctionDecl = Line.MightBeFunctionDecl ;
37623763 bool AlignArrayOfStructures =
37633764 (Style.AlignArrayOfStructures != FormatStyle::AIAS_None &&
@@ -3779,16 +3780,15 @@ void TokenAnnotator::calculateFormattingInformation(AnnotatedLine &Line) const {
37793780 if (const bool IsCtorOrDtor = Tok->is (TT_CtorDtorDeclName);
37803781 IsCtorOrDtor ||
37813782 isFunctionDeclarationName (Style.isCpp (), *Tok, Line, ClosingParen)) {
3782- if (!IsCtorOrDtor) {
3783- LineIsFunctionDeclaration = true ;
3783+ if (!IsCtorOrDtor)
37843784 Tok->setFinalizedType (TT_FunctionDeclarationName);
3785- }
3785+ LineIsFunctionDeclaration = true ;
37863786 SeenName = true ;
37873787 break ;
37883788 }
37893789 }
37903790
3791- if (IsCpp && LineIsFunctionDeclaration &&
3791+ if (IsCpp && ( LineIsFunctionDeclaration || First-> is (TT_CtorDtorDeclName)) &&
37923792 Line.endsWith (tok::semi, tok::r_brace)) {
37933793 auto *Tok = Line.Last ->Previous ;
37943794 while (Tok->isNot (tok::r_brace))
@@ -3811,7 +3811,7 @@ void TokenAnnotator::calculateFormattingInformation(AnnotatedLine &Line) const {
38113811 if (IsCpp) {
38123812 if (!LineIsFunctionDeclaration) {
38133813 // Annotate */&/&& in `operator` function calls as binary operators.
3814- for (const auto *Tok = Line. First ; Tok; Tok = Tok->Next ) {
3814+ for (const auto *Tok = First; Tok; Tok = Tok->Next ) {
38153815 if (Tok->isNot (tok::kw_operator))
38163816 continue ;
38173817 do {
@@ -3948,7 +3948,7 @@ void TokenAnnotator::calculateFormattingInformation(AnnotatedLine &Line) const {
39483948
39493949 calculateUnbreakableTailLengths (Line);
39503950 unsigned IndentLevel = Line.Level ;
3951- for (Current = Line. First ; Current; Current = Current->Next ) {
3951+ for (Current = First; Current; Current = Current->Next ) {
39523952 if (Current->Role )
39533953 Current->Role ->precomputeFormattingInfos (Current);
39543954 if (Current->MatchingParen &&
0 commit comments