[PATCH] D115903: [clang-format] Extra spaces surrounding arrow in templated member call in variable decl
MyDeveloperDay via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Dec 18 03:45:47 PST 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG936a67f089ef: [clang-format] Extra spaces surrounding arrow in templated member call in… (authored by MyDeveloperDay).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115903/new/
https://reviews.llvm.org/D115903
Files:
clang/lib/Format/TokenAnnotator.cpp
clang/unittests/Format/FormatTest.cpp
Index: clang/unittests/Format/FormatTest.cpp
===================================================================
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -6780,6 +6780,9 @@
// Not trailing return types.
verifyFormat("void f() { auto a = b->c(); }");
+ verifyFormat("auto a = p->foo();");
+ verifyFormat("int a = p->foo();");
+ verifyFormat("auto lmbd = [] NOEXCEPT -> int { return 0; };");
}
TEST_F(FormatTest, DeductionGuides) {
Index: clang/lib/Format/TokenAnnotator.cpp
===================================================================
--- clang/lib/Format/TokenAnnotator.cpp
+++ clang/lib/Format/TokenAnnotator.cpp
@@ -1679,7 +1679,7 @@
Current.setType(TT_LambdaArrow);
} else if (Current.is(tok::arrow) && AutoFound && Line.MustBeDeclaration &&
Current.NestingLevel == 0 &&
- !Current.Previous->is(tok::kw_operator)) {
+ !Current.Previous->isOneOf(tok::kw_operator, tok::identifier)) {
// not auto operator->() -> xxx;
Current.setType(TT_TrailingReturnArrow);
} else if (Current.is(tok::arrow) && Current.Previous &&
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115903.395280.patch
Type: text/x-patch
Size: 1160 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211218/ff31d4a8/attachment.bin>
More information about the cfe-commits
mailing list