Skip to content
Merged
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
4 changes: 3 additions & 1 deletion clang/lib/Format/UnwrappedLineFormatter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,10 @@ class LineJoiner {
return 0;
const auto N = MergedLines + LinesToBeMerged;
// Check if there is even a line after the inner result.
if (std::distance(I, E) <= N)
if (auto Distance = std::distance(I, E);
static_cast<decltype(N)>(Distance) <= N) {
return 0;
}
// Check that the line after the inner result starts with a closing brace
// which we are permitted to merge into one line.
if (I[N]->First->is(TT_NamespaceRBrace) &&
Expand Down