summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/ContinuationIndenter.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-05-13 09:38:25 +0000
committerDaniel Jasper <djasper@google.com>2015-05-13 09:38:25 +0000
commita2a4d9c049e23590b003d726ee8691a6628b8dfb (patch)
treebcc19516c47c3d49dc59bd5a9730f592b9994895 /clang/lib/Format/ContinuationIndenter.cpp
parent4276cb3a50734aaa27b22a34dc6549b474ab46ea (diff)
downloadbcm5719-llvm-a2a4d9c049e23590b003d726ee8691a6628b8dfb.tar.gz
bcm5719-llvm-a2a4d9c049e23590b003d726ee8691a6628b8dfb.zip
clang-format: [ObjC] Make IndentWrappedFunctionNames work with ObjC functions
llvm-svn: 237241
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index 54b8c510d74..17a536d7f68 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -421,7 +421,11 @@ unsigned ContinuationIndenter::addTokenOnNewLine(LineState &State,
State.Stack.back().AlignColons = false;
} else {
State.Stack.back().ColonPos =
- State.Stack.back().Indent + NextNonComment->LongestObjCSelectorName;
+ (Style.IndentWrappedFunctionNames
+ ? std::max(State.Stack.back().Indent,
+ State.FirstIndent + Style.ContinuationIndentWidth)
+ : State.Stack.back().Indent) +
+ NextNonComment->LongestObjCSelectorName;
}
} else if (State.Stack.back().AlignColons &&
State.Stack.back().ColonPos <= NextNonComment->ColumnWidth) {
@@ -572,7 +576,10 @@ unsigned ContinuationIndenter::getNewLineColumn(const LineState &State) {
if (!State.Stack.back().ObjCSelectorNameFound) {
if (NextNonComment->LongestObjCSelectorName == 0)
return State.Stack.back().Indent;
- return State.Stack.back().Indent +
+ return (Style.IndentWrappedFunctionNames
+ ? std::max(State.Stack.back().Indent,
+ State.FirstIndent + Style.ContinuationIndentWidth)
+ : State.Stack.back().Indent) +
NextNonComment->LongestObjCSelectorName -
NextNonComment->ColumnWidth;
}
OpenPOWER on IntegriCloud