forked from OSchip/llvm-project
[clang-format] handle trailing comments in function definition detection
A follow-up to
f6bc614546
where we handle the case where the semicolon is followed by a trailing
comment.
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D107907
This commit is contained in:
parent
645f5890ec
commit
0fc27ef196
|
@ -2482,7 +2482,7 @@ static bool isFunctionDeclarationName(const FormatToken &Current,
|
|||
// return i + 1;
|
||||
// }
|
||||
if (Next->Next && Next->Next->is(tok::identifier) &&
|
||||
Line.Last->isNot(tok::semi))
|
||||
!Line.endsWith(tok::semi))
|
||||
return true;
|
||||
for (const FormatToken *Tok = Next->Next; Tok && Tok != Next->MatchingParen;
|
||||
Tok = Tok->Next) {
|
||||
|
|
|
@ -8252,6 +8252,9 @@ TEST_F(FormatTest, ReturnTypeBreakingStyle) {
|
|||
verifyFormat("Tttttttttttttttttttttttt ppppppppppppppp\n"
|
||||
" ABSL_GUARDED_BY(mutex) = {};",
|
||||
getGoogleStyleWithColumns(40));
|
||||
verifyFormat("Tttttttttttttttttttttttt ppppppppppppppp\n"
|
||||
" ABSL_GUARDED_BY(mutex); // comment",
|
||||
getGoogleStyleWithColumns(40));
|
||||
|
||||
Style = getGNUStyle();
|
||||
|
||||
|
|
Loading…
Reference in New Issue