зеркало из https://github.com/microsoft/clang-1.git
When breaking at function calls, indent from function name.
Otherwise (when indenting from the wrapped -> or .), this looks like a confusing indent. Before: aaaaaaa // .aaaaaaa( // aaaaaaa); After: aaaaaaa // .aaaaaaa( // aaaaaaa); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181595 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
daaa468cdd
Коммит
04abbb2125
|
@ -496,6 +496,8 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
State.Stack.back().LastSpace = State.Column;
|
State.Stack.back().LastSpace = State.Column;
|
||||||
|
if (Current.isOneOf(tok::arrow, tok::period))
|
||||||
|
State.Stack.back().LastSpace += Current.FormatTok.TokenLength;
|
||||||
State.StartOfLineLevel = State.ParenLevel;
|
State.StartOfLineLevel = State.ParenLevel;
|
||||||
|
|
||||||
// Any break on this level means that the parent level has been broken
|
// Any break on this level means that the parent level has been broken
|
||||||
|
@ -599,7 +601,8 @@ private:
|
||||||
if (Current.isOneOf(tok::period, tok::arrow) &&
|
if (Current.isOneOf(tok::period, tok::arrow) &&
|
||||||
Line.Type == LT_BuilderTypeCall && State.ParenLevel == 0)
|
Line.Type == LT_BuilderTypeCall && State.ParenLevel == 0)
|
||||||
State.Stack.back().StartOfFunctionCall =
|
State.Stack.back().StartOfFunctionCall =
|
||||||
Current.LastInChainOfCalls ? 0 : State.Column;
|
Current.LastInChainOfCalls ? 0 : State.Column +
|
||||||
|
Current.FormatTok.TokenLength;
|
||||||
if (Current.Type == TT_CtorInitializerColon) {
|
if (Current.Type == TT_CtorInitializerColon) {
|
||||||
State.Stack.back().Indent = State.Column + 2;
|
State.Stack.back().Indent = State.Column + 2;
|
||||||
if (Style.ConstructorInitializerAllOnOneLineOrOnePerLine)
|
if (Style.ConstructorInitializerAllOnOneLineOrOnePerLine)
|
||||||
|
|
|
@ -1976,7 +1976,7 @@ TEST_F(FormatTest, FormatsBuilderPattern) {
|
||||||
verifyFormat(
|
verifyFormat(
|
||||||
"aaaaaaaaaaaaaaaaaaaaaaa *aaaaaaaaa = aaaaaa->aaaaaaaaaaaa()\n"
|
"aaaaaaaaaaaaaaaaaaaaaaa *aaaaaaaaa = aaaaaa->aaaaaaaaaaaa()\n"
|
||||||
" ->aaaaaaaaaaaaaaaa(\n"
|
" ->aaaaaaaaaaaaaaaa(\n"
|
||||||
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)\n"
|
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)\n"
|
||||||
" ->aaaaaaaaaaaaaaaaa();");
|
" ->aaaaaaaaaaaaaaaaa();");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2296,8 +2296,8 @@ TEST_F(FormatTest, WrapsAtFunctionCallsIfNecessary) {
|
||||||
"aaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n"
|
"aaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n"
|
||||||
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)\n"
|
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)\n"
|
||||||
" .aaaaaaaaaaaaaaa(\n"
|
" .aaaaaaaaaaaaaaa(\n"
|
||||||
" aa(aaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaa,\n"
|
" aa(aaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaa,\n"
|
||||||
" aaaaaaaaaaaaaaaaaaaaaaaaaaa));");
|
" aaaaaaaaaaaaaaaaaaaaaaaaaaa));");
|
||||||
verifyFormat("if (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
|
verifyFormat("if (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
|
||||||
" .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
|
" .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
|
||||||
" .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
|
" .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
|
||||||
|
|
Загрузка…
Ссылка в новой задаче