summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/ContinuationIndenter.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-05-18 13:47:23 +0000
committerDaniel Jasper <djasper@google.com>2015-05-18 13:47:23 +0000
commit47bbda093917d7e16f59df20ae409c07b4624e30 (patch)
tree79868eb7303cc1df9f8aa5b71aff53dfda86d4da /clang/lib/Format/ContinuationIndenter.cpp
parent055ad9beba8db1c124c329a8359ab16b903d754a (diff)
downloadbcm5719-llvm-47bbda093917d7e16f59df20ae409c07b4624e30.tar.gz
bcm5719-llvm-47bbda093917d7e16f59df20ae409c07b4624e30.zip
clang-format: Improve detection of macros annotating functions.
Before: ASSERT("aaaaaaaaaaaaaaa") << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa << bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb; After: ASSERT("aaaaaaaaaaaaaaa") << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa << bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb; Also cleanup implementation a bit and only mark closing parenthesis of these annotations. llvm-svn: 237567
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index 20626a622f8..623e0869926 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -213,7 +213,7 @@ bool ContinuationIndenter::mustBreak(const LineState &State) {
// different LineFormatter would be used otherwise.
if (Previous.ClosesTemplateDeclaration)
return true;
- if (Previous.is(TT_FunctionAnnotation) && Previous.is(tok::r_paren))
+ if (Previous.is(TT_FunctionAnnotationRParen))
return true;
if (Previous.is(TT_LeadingJavaAnnotation) && Current.isNot(tok::l_paren) &&
Current.isNot(TT_LeadingJavaAnnotation))
@@ -492,9 +492,9 @@ unsigned ContinuationIndenter::addTokenOnNewLine(LineState &State,
!PreviousNonComment->isOneOf(tok::comma, tok::semi) &&
(PreviousNonComment->isNot(TT_TemplateCloser) ||
Current.NestingLevel != 0) &&
- !PreviousNonComment->isOneOf(TT_BinaryOperator, TT_FunctionAnnotation,
- TT_JavaAnnotation,
- TT_LeadingJavaAnnotation) &&
+ !PreviousNonComment->isOneOf(
+ TT_BinaryOperator, TT_FunctionAnnotationRParen, TT_JavaAnnotation,
+ TT_LeadingJavaAnnotation) &&
Current.isNot(TT_BinaryOperator) && !PreviousNonComment->opensScope())
State.Stack.back().BreakBeforeParameter = true;
@@ -574,9 +574,9 @@ unsigned ContinuationIndenter::getNewLineColumn(const LineState &State) {
return State.Stack.back().VariablePos;
if ((PreviousNonComment &&
(PreviousNonComment->ClosesTemplateDeclaration ||
- PreviousNonComment->isOneOf(TT_AttributeParen, TT_FunctionAnnotation,
- TT_JavaAnnotation,
- TT_LeadingJavaAnnotation))) ||
+ PreviousNonComment->isOneOf(
+ TT_AttributeParen, TT_FunctionAnnotationRParen, TT_JavaAnnotation,
+ TT_LeadingJavaAnnotation))) ||
(!Style.IndentWrappedFunctionNames &&
NextNonComment->isOneOf(tok::kw_operator, TT_FunctionDeclarationName)))
return std::max(State.Stack.back().LastSpace, State.Stack.back().Indent);
OpenPOWER on IntegriCloud