From 47bbda093917d7e16f59df20ae409c07b4624e30 Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Mon, 18 May 2015 13:47:23 +0000 Subject: 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 --- clang/lib/Format/ContinuationIndenter.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'clang/lib/Format/ContinuationIndenter.cpp') 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); -- cgit v1.2.3