Summary:
https://bugs.llvm.org/show_bug.cgi?id=42417
This revision removes the extra space between the opertor-> and the parens ()
```
class Bug {
auto operator-> () -> int*;
auto operator++(int) -> int;
};
```
Reviewers: klimek, owenpan, byoungyoung, mitchell-stellar
Reviewed By: mitchell-stellar
Subscribers: cfe-commits
Tags: #clang-format, #clang
Differential Revision: https://reviews.llvm.org/D68242
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373746
91177308-0d34-0410-b5e6-
96231b3b80d8
Style.Language == FormatStyle::LK_Java) {
Current.Type = TT_LambdaArrow;
} else if (Current.is(tok::arrow) && AutoFound && Line.MustBeDeclaration &&
- Current.NestingLevel == 0) {
+ Current.NestingLevel == 0 &&
+ !Current.Previous->is(tok::kw_operator)) {
+ // not auto operator->() -> xxx;
Current.Type = TT_TrailingReturnArrow;
TrailingReturnFound = true;
} else if (Current.is(tok::star) ||
TEST_F(FormatTest, TrailingReturnType) {
verifyFormat("auto foo() -> int;\n");
+ // correct trailing return type spacing
+ verifyFormat("auto operator->() -> int;\n");
+ verifyFormat("auto operator++(int) -> int;\n");
+
verifyFormat("struct S {\n"
" auto bar() const -> int;\n"
"};");