[clang] [clang-format] Fix requires misannotation with comma (PR #65908)

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 10 13:18:33 PDT 2023


================
@@ -1016,6 +1016,14 @@ TEST_F(TokenAnnotatorTest, UnderstandsRequiresClausesAndConcepts) {
   ASSERT_EQ(Tokens.size(), 22u) << Tokens;
   EXPECT_TOKEN(Tokens[4], tok::kw_requires, TT_RequiresClause);
   EXPECT_TOKEN(Tokens[10], tok::ampamp, TT_PointerOrReference);
+
+  Tokens = annotate("void f() & requires(true) {}");
+  EXPECT_EQ(Tokens.size(), 12u) << Tokens;
+  EXPECT_TOKEN(Tokens[4], tok::amp, TT_PointerOrReference);
+
+  Tokens = annotate("void f() & requires(C<true, true>) {}");
+  EXPECT_EQ(Tokens.size(), 17u) << Tokens;
+  EXPECT_TOKEN(Tokens[4], tok::amp, TT_PointerOrReference);
 }
----------------
HazardyKnusperkeks wrote:

Just to be sure, can you add a test with a requires expression like
``` c++
requires(C<true, true> c) {
{ c.foo(); }
}
```

https://github.com/llvm/llvm-project/pull/65908


More information about the cfe-commits mailing list