[clang-tools-extra] 16eaa52 - [pseudo] Fix the wrong rule ids in ForestTest.

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 25 16:06:03 PDT 2022


Author: Haojian Wu
Date: 2022-03-26T00:05:37+01:00
New Revision: 16eaa5240e30af36a91db387df3c2effff83e742

URL: https://github.com/llvm/llvm-project/commit/16eaa5240e30af36a91db387df3c2effff83e742
DIFF: https://github.com/llvm/llvm-project/commit/16eaa5240e30af36a91db387df3c2effff83e742.diff

LOG: [pseudo] Fix the wrong rule ids in ForestTest.

Added: 
    

Modified: 
    clang-tools-extra/pseudo/unittests/ForestTest.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/pseudo/unittests/ForestTest.cpp b/clang-tools-extra/pseudo/unittests/ForestTest.cpp
index a734a8f7f8616..f382e0748afe2 100644
--- a/clang-tools-extra/pseudo/unittests/ForestTest.cpp
+++ b/clang-tools-extra/pseudo/unittests/ForestTest.cpp
@@ -90,8 +90,8 @@ TEST_F(ForestTest, DumpBasic) {
 TEST_F(ForestTest, DumpAmbiguousAndRefs) {
   build(R"cpp(
     _ := type
-    type := class-type # rule 1
-    type := enum-type # rule 2
+    type := class-type # rule 3
+    type := enum-type # rule 4
     class-type := shared-type
     enum-type := shared-type
     shared-type := IDENTIFIER)cpp");
@@ -106,21 +106,21 @@ TEST_F(ForestTest, DumpAmbiguousAndRefs) {
       symbol("shared-type"), ruleFor("shared-type"), {Terminals.begin()});
   const auto *ClassType = &Arena.createSequence(
       symbol("class-type"), ruleFor("class-type"), {SharedType});
-  const auto *Enumtype = &Arena.createSequence(
+  const auto *EnumType = &Arena.createSequence(
       symbol("enum-type"), ruleFor("enum-type"), {SharedType});
   const auto *Alternative1 =
-      &Arena.createSequence(symbol("type"), /*RuleID=*/1, {ClassType});
+      &Arena.createSequence(symbol("type"), /*RuleID=*/3, {ClassType});
   const auto *Alternative2 =
-      &Arena.createSequence(symbol("type"), /*RuleID=*/2, {Enumtype});
+      &Arena.createSequence(symbol("type"), /*RuleID=*/4, {EnumType});
   const auto *Type =
       &Arena.createAmbiguous(symbol("type"), {Alternative1, Alternative2});
   EXPECT_EQ(Type->dumpRecursive(*G),
             "[  0, end) type := <ambiguous>\n"
-            "[  0, end) ├─class-type := shared-type\n"
+            "[  0, end) ├─type := class-type\n"
             "[  0, end) │ └─class-type := shared-type\n"
             "[  0, end) │   └─shared-type := IDENTIFIER #1\n"
             "[  0, end) │     └─IDENTIFIER := tok[0]\n"
-            "[  0, end) └─enum-type := shared-type\n"
+            "[  0, end) └─type := enum-type\n"
             "[  0, end)   └─enum-type := shared-type\n"
             "[  0, end)     └─shared-type := IDENTIFIER =#1\n"
             "[  0, end)       └─IDENTIFIER := tok[0]\n");


        


More information about the cfe-commits mailing list