clang-format: Fix indentation in multi-line placement new.

Before:
  auto aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa =
      new (aaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaa))
      typename aaaaaaaaaaaaaaaaaaaaaaaa();

After:
  auto aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa =
      new (aaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaa))
          typename aaaaaaaaaaaaaaaaaaaaaaaa();

llvm-svn: 214964
This commit is contained in:
Daniel Jasper 2014-08-06 13:14:58 +00:00
parent 568da0990e
commit 316ab38ed8
2 changed files with 6 additions and 0 deletions

View File

@ -561,6 +561,9 @@ unsigned ContinuationIndenter::getNewLineColumn(const LineState &State) {
return State.FirstIndent + Style.ConstructorInitializerIndentWidth;
if (NextNonComment->Type == TT_CtorInitializerComma)
return State.Stack.back().Indent;
if (Previous.is(tok::r_paren) && !Current.isBinaryOperator() &&
Current.isNot(tok::colon))
return ContinuationIndent;
if (State.Stack.back().Indent == State.FirstIndent && PreviousNonComment &&
PreviousNonComment->isNot(tok::r_brace))
// Ensure that we fall back to the continuation indent width instead of

View File

@ -4729,6 +4729,9 @@ TEST_F(FormatTest, UnderstandsNewAndDelete) {
"}");
verifyFormat("new (aaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaa))\n"
" typename aaaaaaaaaaaaaaaaaaaaaaaa();");
verifyFormat("auto aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa =\n"
" new (aaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaa))\n"
" typename aaaaaaaaaaaaaaaaaaaaaaaa();");
}
TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) {