diff options
Diffstat (limited to 'clang/lib/Format')
-rw-r--r-- | clang/lib/Format/ContinuationIndenter.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index 9e6014a6837..7fdc1af09b7 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -594,7 +594,7 @@ unsigned ContinuationIndenter::getNewLineColumn(const LineState &State) { if (NextNonComment->Type == TT_CtorInitializerComma) return State.Stack.back().Indent; if (Previous.is(tok::r_paren) && !Current.isBinaryOperator() && - Current.isNot(tok::colon)) + !Current.isOneOf(tok::colon, tok::comment)) return ContinuationIndent; if (State.Stack.back().Indent == State.FirstIndent && PreviousNonComment && PreviousNonComment->isNot(tok::r_brace)) diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 48ce19e1323..cb945c6161b 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1186,9 +1186,12 @@ private: if (Precedence > prec::Unknown) Start->StartsBinaryExpression = true; if (Current) { - ++Current->Previous->FakeRParens; + FormatToken *Previous = Current->Previous; + if (Previous->is(tok::comment) && Previous->Previous) + Previous = Previous->Previous; + ++Previous->FakeRParens; if (Precedence > prec::Unknown) - Current->Previous->EndsBinaryExpression = true; + Previous->EndsBinaryExpression = true; } } |