diff options
author | Owen Pan <owenpiano@gmail.com> | 2019-04-07 21:05:52 +0000 |
---|---|---|
committer | Owen Pan <owenpiano@gmail.com> | 2019-04-07 21:05:52 +0000 |
commit | e4f95e8e39b639b633347838d8bc7d8f2594df83 (patch) | |
tree | 2e649ec7c6b9f76f6a0cdb44280f34127bd39740 /clang/lib | |
parent | f38b46ffca9b55d476229dce6bca4f3274cffb6d (diff) | |
download | bcm5719-llvm-e4f95e8e39b639b633347838d8bc7d8f2594df83.tar.gz bcm5719-llvm-e4f95e8e39b639b633347838d8bc7d8f2594df83.zip |
[clang-format] Fix bug https://bugs.llvm.org/show_bug.cgi?id=41413
Differential Revision: https://reviews.llvm.org/D60374
llvm-svn: 357877
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Format/ContinuationIndenter.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index 577d96d52c5..6be7f7e1b58 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -945,18 +945,24 @@ unsigned ContinuationIndenter::getNewLineColumn(const LineState &State) { return State.Stack[State.Stack.size() - 2].LastSpace; return State.FirstIndent; } - // Indent a closing parenthesis at the previous level if followed by a semi or - // opening brace. This allows indentations such as: + // Indent a closing parenthesis at the previous level if followed by a semi, + // const, or opening brace. This allows indentations such as: // foo( // a, // ); + // int Foo::getter( + // // + // ) const { + // return foo; + // } // function foo( // a, // ) { // code(); // // } if (Current.is(tok::r_paren) && State.Stack.size() > 1 && - (!Current.Next || Current.Next->isOneOf(tok::semi, tok::l_brace))) + (!Current.Next || + Current.Next->isOneOf(tok::semi, tok::kw_const, tok::l_brace))) return State.Stack[State.Stack.size() - 2].LastSpace; if (NextNonComment->is(TT_TemplateString) && NextNonComment->closesScope()) return State.Stack[State.Stack.size() - 2].LastSpace; |