mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-04 12:15:46 +00:00
clang-format: Fix trailing const (etc.) with Allman brace style.
Before: void someLongFunction(int someLongParameter) const { } After: void someLongFunction( int someLongParameter) const { } This fixes llvm.org/PR19912. llvm-svn: 210010
This commit is contained in:
parent
2fcc427741
commit
e3f907fded
@ -1329,8 +1329,8 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
|
||||
return 150;
|
||||
}
|
||||
|
||||
if (Right.Type == TT_TrailingAnnotation && Right.Next &&
|
||||
Right.Next->isNot(tok::l_paren)) {
|
||||
if (Right.Type == TT_TrailingAnnotation &&
|
||||
(!Right.Next || Right.Next->isNot(tok::l_paren))) {
|
||||
// Generally, breaking before a trailing annotation is bad unless it is
|
||||
// function-like. It seems to be especially preferable to keep standard
|
||||
// annotations (i.e. "const", "final" and "override") on the same line.
|
||||
|
@ -3469,6 +3469,13 @@ TEST_F(FormatTest, BreaksFunctionDeclarationsWithTrailingTokens) {
|
||||
" int parameter) const override {}",
|
||||
Style);
|
||||
|
||||
Style.BreakBeforeBraces = FormatStyle::BS_Allman;
|
||||
verifyFormat("void someLongFunction(\n"
|
||||
" int someLongParameter) const\n"
|
||||
"{\n"
|
||||
"}",
|
||||
Style);
|
||||
|
||||
// Unless these are unknown annotations.
|
||||
verifyFormat("void SomeFunction(aaaaaaaaaa aaaaaaaaaaaaaaa,\n"
|
||||
" aaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)\n"
|
||||
|
Loading…
Reference in New Issue
Block a user