forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang-format] Fix a bug that wraps before function arguments
Fixes a long-standing bug that erroneously placed function arguments on a new line despite all arguments being able to fit on the same line. The original diff that introduced the bug implemented behaviour that pushed the first argument to a function onto a new line under certain circumstances relating passing lambdas as arguments. This behaviour was implemented in TokenAnnotator::mustBreakBefore() which meant the code lacked the necessary context to figure out whether subsequent arguments might be able to all fit on one line. As such, I've moved the implementation to ContinuationIndenter and, instead of forcing a line break at the first argument in all cases, we now allow the OptimizingLineFormatter to consider placing the first argument on the same line as the function call but don't allow further line breaks in this case. The end result is that either the first argument must go on a new line (as before) or all arguments must be put on the current line. Closes llvm#44486. Differential Revision: https://reviews.llvm.org/D156259
- Loading branch information
Showing
4 changed files
with
57 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters