Skip to content

[clang-format][NFC] Enable RemoveSemicolon for clang-format style #82735

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion clang/lib/Format/Format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1591,7 +1591,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) {
LLVMStyle.PenaltyBreakScopeResolution = 500;
LLVMStyle.PenaltyBreakString = 1000;
LLVMStyle.PenaltyBreakTemplateDeclaration = prec::Relational;
LLVMStyle.PenaltyExcessCharacter = 1000000;
LLVMStyle.PenaltyExcessCharacter = 1'000'000;
LLVMStyle.PenaltyIndentedWhitespace = 0;
LLVMStyle.PenaltyReturnTypeOnItsOwnLine = 60;

Expand Down Expand Up @@ -1914,9 +1914,12 @@ FormatStyle getClangFormatStyle() {
FormatStyle Style = getLLVMStyle();
Style.InsertBraces = true;
Style.InsertNewlineAtEOF = true;
Style.IntegerLiteralSeparator.Decimal = 3;
Style.IntegerLiteralSeparator.DecimalMinDigits = 5;
Style.LineEnding = FormatStyle::LE_LF;
Style.RemoveBracesLLVM = true;
Style.RemoveParentheses = FormatStyle::RPS_ReturnStatement;
Style.RemoveSemicolon = true;
return Style;
}

Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Format/FormatToken.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ unsigned CommaSeparatedList::formatAfterToken(LineState &State,
// bin-packed. Add a severe penalty to this so that column layouts are
// preferred if possible.
if (!Format)
return 10000;
return 10'000;

// Format the entire list.
unsigned Penalty = 0;
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Format/UnwrappedLineFormatter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,7 @@ class OptimizingLineFormatter : public LineFormatter {
// While not empty, take first element and follow edges.
while (!Queue.empty()) {
// Quit if we still haven't found a solution by now.
if (Count > 25000000)
if (Count > 25'000'000)
return 0;

Penalty = Queue.top().first.first;
Expand All @@ -1235,7 +1235,7 @@ class OptimizingLineFormatter : public LineFormatter {

// Cut off the analysis of certain solutions if the analysis gets too
// complex. See description of IgnoreStackForComparison.
if (Count > 50000)
if (Count > 50'000)
Node->State.IgnoreStackForComparison = true;

if (!Seen.insert(&Node->State).second) {
Expand Down
2 changes: 1 addition & 1 deletion clang/unittests/Format/FormatTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21669,7 +21669,7 @@ TEST_F(FormatTest, BreakPenaltyAfterCastLParen) {
" int)aaaaaaaaaaaaaaaaaaaaaaaa);",

Style);
Style.PenaltyBreakOpenParenthesis = 100000;
Style.PenaltyBreakOpenParenthesis = 100'000;
verifyFormat("foo((int)\n"
" aaaaaaaaaaaaaaaaaaaaaaaa);",
"foo((\n"
Expand Down