[clang] [clang-format] Don't skip stringizing when determining brace kind (PR #73886)

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 29 18:01:17 PST 2023


================
@@ -1851,6 +1851,22 @@ TEST_F(TokenAnnotatorTest, UnderstandsTrailingReturnArrow) {
   EXPECT_TOKEN(Tokens[13], tok::arrow, TT_Unknown);
 }
 
+TEST_F(TokenAnnotatorTest, UnderstandHashInMacro) {
+  auto Tokens = annotate("#define Foo(Bar) \\\n"
+                         "  { \\\n"
+                         "    #Bar \\\n"
+                         "  }\n");
+  ASSERT_EQ(Tokens.size(), 11u) << Tokens;
+  EXPECT_BRACE_KIND(Tokens[6], BK_Block);
+  EXPECT_BRACE_KIND(Tokens[9], BK_Block);
+
+  Tokens = annotate("#define Foo(Bar) \\\n"
+                    "  { #Bar }\n");
----------------
owenca wrote:

Ditto.

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


More information about the cfe-commits mailing list