diff options
author | Daniel Jasper <djasper@google.com> | 2014-10-31 18:23:49 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2014-10-31 18:23:49 +0000 |
commit | e9ab42df0cf305b8ff1f363cc5acd680f954ec16 (patch) | |
tree | 9a62b60733fd48805056fb171797c549390345af /clang/lib/Format/ContinuationIndenter.cpp | |
parent | 396f80a1eac514b717a4a43a313ffaadde6f7cb0 (diff) | |
download | bcm5719-llvm-e9ab42df0cf305b8ff1f363cc5acd680f954ec16.tar.gz bcm5719-llvm-e9ab42df0cf305b8ff1f363cc5acd680f954ec16.zip |
clang-format: [Java] Improve line breaks around annotations.
Before:
@SomeAnnotation("With some really looooooooooooooong text") private static final
long something = 0L;
void SomeFunction(@Nullable
String something) {}
After:
@SomeAnnotation("With some really looooooooooooooong text")
private static final long something = 0L;
void SomeFunction(@Nullable String something) {}
llvm-svn: 220984
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r-- | clang/lib/Format/ContinuationIndenter.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index 0920137870a..b6dd9bdcf8b 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -464,6 +464,7 @@ unsigned ContinuationIndenter::addTokenOnNewLine(LineState &State, PreviousNonComment->Type != TT_TemplateCloser && PreviousNonComment->Type != TT_BinaryOperator && PreviousNonComment->Type != TT_JavaAnnotation && + PreviousNonComment->Type != TT_LeadingJavaAnnotation && Current.Type != TT_BinaryOperator && !PreviousNonComment->opensScope()) State.Stack.back().BreakBeforeParameter = true; @@ -538,9 +539,11 @@ unsigned ContinuationIndenter::getNewLineColumn(const LineState &State) { return State.Stack.back().QuestionColumn; if (Previous.is(tok::comma) && State.Stack.back().VariablePos != 0) return State.Stack.back().VariablePos; - if ((PreviousNonComment && (PreviousNonComment->ClosesTemplateDeclaration || - PreviousNonComment->Type == TT_AttributeParen || - PreviousNonComment->Type == TT_JavaAnnotation)) || + if ((PreviousNonComment && + (PreviousNonComment->ClosesTemplateDeclaration || + PreviousNonComment->Type == TT_AttributeParen || + PreviousNonComment->Type == TT_JavaAnnotation || + PreviousNonComment->Type == TT_LeadingJavaAnnotation)) || (!Style.IndentWrappedFunctionNames && (NextNonComment->is(tok::kw_operator) || NextNonComment->Type == TT_FunctionDeclarationName))) |