diff options
author | Daniel Jasper <djasper@google.com> | 2013-02-18 13:52:06 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-02-18 13:52:06 +0000 |
commit | 82282dc907a04b1931f8f578693b035ad751fd3b (patch) | |
tree | 47446183606d586e1ab1dc2f3b73cd4fdb9f3f25 /lib/Format/Format.cpp | |
parent | 515f65df40624a767bc8763a0b6b678146b8e3c9 (diff) |
Improve indentation of builder type calls.
In builder-type calls, it can be very confusing to just indent
parameters from the start of the line. Instead, indent 4 from the
correct function call.
Before:
aaaaaaaaaaaaaaaaaaa()->aaaaaa(bbbbb)->aaaaaaaaaaaaaaaaaaa( // break
aaaaaaaaaaaaaa);
aaaaaaaaaaaaaaaaaaaaaaa *aaaaaaaaa = aaaaaa->aaaaaaaaaaaa()->aaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
->aaaaaaaaaaaaaaaaa();
After:
aaaaaaaaaaaaaaaaaaa()->aaaaaa(bbbbb)->aaaaaaaaaaaaaaaaaaa( // break
aaaaaaaaaaaaaa);
aaaaaaaaaaaaaaaaaaaaaaa *aaaaaaaaa = aaaaaa->aaaaaaaaaaaa()
->aaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
->aaaaaaaaaaaaaaaaa();
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175444 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/Format.cpp')
-rw-r--r-- | lib/Format/Format.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index e950fe6030..d8ef5cf785 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -549,6 +549,9 @@ private: // If this function has multiple parameters, indent nested calls from // the start of the first parameter. State.Stack.back().LastSpace = State.Column; + else if ((Current.is(tok::period) || Current.is(tok::arrow)) && + Line.Type == LT_BuilderTypeCall && State.ParenLevel == 0) + State.Stack.back().LastSpace = State.Column; } // If we break after an {, we should also break before the corresponding }. |