[clang-Format] Fix indentation of member call after block
Summary:
before patch:
> echo "test() {([]() -> {int b = 32;return 3;}).as("");});" | clang-format -style=Google
```
test() {
([]() -> {
int b = 32;
return 3;
})
.as();
});
```
after patch:
> echo "test() {([]() -> {int b = 32;return 3;}).as("");});" | clang-format -style=Google
```
test() {
([]() -> {
int b = 32;
return 3;
}).as();
});
```
Patch by Anders Karlsson (ank)!
Reviewers: klimek
Reviewed By: klimek
Subscribers: danilaml, acoomans, klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D45719
llvm-svn: 342363
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index f035aa7..c9c9645 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -403,7 +403,9 @@
// }.bind(...));
// FIXME: We should find a more generic solution to this problem.
!(State.Column <= NewLineColumn &&
- Style.Language == FormatStyle::LK_JavaScript))
+ Style.Language == FormatStyle::LK_JavaScript) &&
+ !(Previous.closesScopeAfterBlock() &&
+ State.Column <= NewLineColumn))
return true;
// If the template declaration spans multiple lines, force wrap before the