summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/TokenAnnotator.cpp
diff options
context:
space:
mode:
authorPaul Hoad <mydeveloperday@gmail.com>2019-10-04 13:24:15 +0000
committerPaul Hoad <mydeveloperday@gmail.com>2019-10-04 13:24:15 +0000
commita37a6dcd04b0c0a0f9eea93ba0a5070a5421a29a (patch)
treee7eccc788226f1f16f210a3569b081fecd1cc5d3 /clang/lib/Format/TokenAnnotator.cpp
parent434d59250e3822a141fb5070ae0432f31da77734 (diff)
downloadbcm5719-llvm-a37a6dcd04b0c0a0f9eea93ba0a5070a5421a29a.tar.gz
bcm5719-llvm-a37a6dcd04b0c0a0f9eea93ba0a5070a5421a29a.zip
[clang-format] [PR42417] clang-format inserts a space after '->' for operator->() overloading
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 llvm-svn: 373746
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.cpp')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index e6dfffd9733..50e3d056b83 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -1393,7 +1393,9 @@ private:
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) ||
OpenPOWER on IntegriCloud