[PATCH] D130299: [clang-format] FIX: Misannotation 'auto' as trailing return type in lambdas
Aleksandr Platonov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 27 12:25:41 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG17fb879764dc: [clang-format] FIX: Misannotation 'auto' as trailing return type in lambdas (authored by denis-fatkulin, committed by ArcsinX).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130299/new/
https://reviews.llvm.org/D130299
Files:
clang/lib/Format/UnwrappedLineParser.cpp
clang/unittests/Format/TokenAnnotatorTest.cpp
Index: clang/unittests/Format/TokenAnnotatorTest.cpp
===================================================================
--- clang/unittests/Format/TokenAnnotatorTest.cpp
+++ clang/unittests/Format/TokenAnnotatorTest.cpp
@@ -747,6 +747,21 @@
ASSERT_EQ(Tokens.size(), 8u) << Tokens;
EXPECT_TOKEN(Tokens[0], tok::l_square, TT_LambdaLSquare);
EXPECT_TOKEN(Tokens[5], tok::l_brace, TT_LambdaLBrace);
+
+ Tokens = annotate("[]() -> auto {}");
+ ASSERT_EQ(Tokens.size(), 9u) << Tokens;
+ EXPECT_TOKEN(Tokens[4], tok::arrow, TT_LambdaArrow);
+ EXPECT_TOKEN(Tokens[6], tok::l_brace, TT_LambdaLBrace);
+
+ Tokens = annotate("[]() -> auto & {}");
+ ASSERT_EQ(Tokens.size(), 10u) << Tokens;
+ EXPECT_TOKEN(Tokens[4], tok::arrow, TT_LambdaArrow);
+ EXPECT_TOKEN(Tokens[7], tok::l_brace, TT_LambdaLBrace);
+
+ Tokens = annotate("[]() -> auto * {}");
+ ASSERT_EQ(Tokens.size(), 10u) << Tokens;
+ EXPECT_TOKEN(Tokens[4], tok::arrow, TT_LambdaArrow);
+ EXPECT_TOKEN(Tokens[7], tok::l_brace, TT_LambdaLBrace);
}
} // namespace
Index: clang/lib/Format/UnwrappedLineParser.cpp
===================================================================
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -2108,6 +2108,7 @@
case tok::l_square:
parseSquare();
break;
+ case tok::kw_auto:
case tok::kw_class:
case tok::kw_template:
case tok::kw_typename:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130299.448128.patch
Type: text/x-patch
Size: 1429 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220727/0259ebbc/attachment.bin>
More information about the cfe-commits
mailing list