[PATCH] D120401: [clang-format][NFC] Rename test and remove comments

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 23 03:51:12 PST 2022


HazardyKnusperkeks created this revision.
HazardyKnusperkeks added reviewers: owenpan, MyDeveloperDay, curdeius.
HazardyKnusperkeks added a project: clang-format.
HazardyKnusperkeks requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Why put "InMacros" in the name? We test other things to, and I will add more, withut macros.

Also all our tests are regression tests.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120401

Files:
  clang/unittests/Format/TokenAnnotatorTest.cpp


Index: clang/unittests/Format/TokenAnnotatorTest.cpp
===================================================================
--- clang/unittests/Format/TokenAnnotatorTest.cpp
+++ clang/unittests/Format/TokenAnnotatorTest.cpp
@@ -44,9 +44,7 @@
     EXPECT_TOKEN_TYPE(FormatTok, Type);                                        \
   } while (false)
 
-TEST_F(TokenAnnotatorTest, UnderstandsUsesOfStarAndAmpInMacroDefinition) {
-  // This is a regression test for mis-parsing the & after decltype as a binary
-  // operator instead of a reference (when inside a macro definition).
+TEST_F(TokenAnnotatorTest, UnderstandsUsesOfStarAndAmp) {
   auto Tokens = annotate("auto x = [](const decltype(x) &ptr) {};");
   EXPECT_EQ(Tokens.size(), 18u) << Tokens;
   EXPECT_TOKEN(Tokens[7], tok::kw_decltype, TT_Unknown);
@@ -54,13 +52,12 @@
   EXPECT_TOKEN(Tokens[9], tok::identifier, TT_Unknown);
   EXPECT_TOKEN(Tokens[10], tok::r_paren, TT_TypeDeclarationParen);
   EXPECT_TOKEN(Tokens[11], tok::amp, TT_PointerOrReference);
-  // Same again with * instead of &:
+
   Tokens = annotate("auto x = [](const decltype(x) *ptr) {};");
   EXPECT_EQ(Tokens.size(), 18u) << Tokens;
   EXPECT_TOKEN(Tokens[10], tok::r_paren, TT_TypeDeclarationParen);
   EXPECT_TOKEN(Tokens[11], tok::star, TT_PointerOrReference);
 
-  // Also check that we parse correctly within a macro definition:
   Tokens = annotate("#define lambda [](const decltype(x) &ptr) {}");
   EXPECT_EQ(Tokens.size(), 17u) << Tokens;
   EXPECT_TOKEN(Tokens[7], tok::kw_decltype, TT_Unknown);
@@ -68,7 +65,7 @@
   EXPECT_TOKEN(Tokens[9], tok::identifier, TT_Unknown);
   EXPECT_TOKEN(Tokens[10], tok::r_paren, TT_TypeDeclarationParen);
   EXPECT_TOKEN(Tokens[11], tok::amp, TT_PointerOrReference);
-  // Same again with * instead of &:
+
   Tokens = annotate("#define lambda [](const decltype(x) *ptr) {}");
   EXPECT_EQ(Tokens.size(), 17u) << Tokens;
   EXPECT_TOKEN(Tokens[10], tok::r_paren, TT_TypeDeclarationParen);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120401.410769.patch
Type: text/x-patch
Size: 1958 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220223/0bab1443/attachment.bin>


More information about the cfe-commits mailing list