summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/ContinuationIndenter.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-11-08 02:08:01 +0000
committerDaniel Jasper <djasper@google.com>2013-11-08 02:08:01 +0000
commitb302f9a0fb8596c49899cbe5ad0c736b580a5753 (patch)
treeaa28a83d3f0ffd79e5b91c124b49f4492ce36351 /clang/lib/Format/ContinuationIndenter.cpp
parentc8f7fd10a943e647a2e1e0b03ece70f021a9516d (diff)
downloadbcm5719-llvm-b302f9a0fb8596c49899cbe5ad0c736b580a5753.tar.gz
bcm5719-llvm-b302f9a0fb8596c49899cbe5ad0c736b580a5753.zip
clang-format: Properly indent ObjC calls wrapped before first selector
Before: [self // break a:a aa:aa aaaaa:aaa]; After: [self // break a:a aa:aa aaaaa:aaa]; llvm-svn: 194241
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index 442f9fa8505..d075c7482d0 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -375,7 +375,11 @@ unsigned ContinuationIndenter::addTokenOnNewLine(LineState &State,
State.Line->StartsDefinition))) {
State.Column = State.Stack.back().Indent;
} else if (Current.Type == TT_ObjCSelectorName) {
- if (State.Stack.back().ColonPos > Current.ColumnWidth) {
+ if (State.Stack.back().ColonPos == 0) {
+ State.Stack.back().ColonPos =
+ State.Stack.back().Indent + Current.LongestObjCSelectorName;
+ State.Column = State.Stack.back().ColonPos - Current.ColumnWidth;
+ } else if (State.Stack.back().ColonPos > Current.ColumnWidth) {
State.Column = State.Stack.back().ColonPos - Current.ColumnWidth;
} else {
State.Column = State.Stack.back().Indent;
OpenPOWER on IntegriCloud