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 | e53beb2647e2438b903add72cb8c521d9844ecf9 (patch) | |
tree | 5bcb411ad921e42d15b154921866aa306fdc815e /clang/lib/Format/Format.cpp | |
parent | 4c1602b5c983b3e9b53df50c97716e940c70e725 (diff) | |
download | bcm5719-llvm-e53beb2647e2438b903add72cb8c521d9844ecf9.tar.gz bcm5719-llvm-e53beb2647e2438b903add72cb8c521d9844ecf9.zip |
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();
llvm-svn: 175444
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r-- | clang/lib/Format/Format.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index e950fe60302..d8ef5cf785c 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/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 }. |