[PATCH] D125479: [pseudo] Fix the incorrect parameters-and-qualifiers rule.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 7 01:46:46 PDT 2022
hokein updated this revision to Diff 434733.
hokein added a comment.
pull out a separate test file.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125479/new/
https://reviews.llvm.org/D125479
Files:
clang-tools-extra/pseudo/lib/cxx.bnf
clang-tools-extra/pseudo/test/cxx/parameter-decl-clause.cpp
clang-tools-extra/pseudo/test/cxx/unsized-array.cpp
Index: clang-tools-extra/pseudo/test/cxx/unsized-array.cpp
===================================================================
--- clang-tools-extra/pseudo/test/cxx/unsized-array.cpp
+++ clang-tools-extra/pseudo/test/cxx/unsized-array.cpp
@@ -1,6 +1,6 @@
// RUN: clang-pseudo -grammar=%cxx-bnf-file -source=%s --print-forest | FileCheck %s
void s(int[]);
-// CHECK: parameter-declaration-list~parameter-declaration := decl-specifier-seq abstract-declarator
+// CHECK: parameter-declaration-clause~parameter-declaration := decl-specifier-seq abstract-declarator
// CHECK-NEXT: ├─decl-specifier-seq~INT := tok[3]
// CHECK-NEXT: └─abstract-declarator~noptr-abstract-declarator := [ ]
// CHECK-NEXT: ├─[ := tok[4]
Index: clang-tools-extra/pseudo/test/cxx/parameter-decl-clause.cpp
===================================================================
--- /dev/null
+++ clang-tools-extra/pseudo/test/cxx/parameter-decl-clause.cpp
@@ -0,0 +1,14 @@
+// RUN: clang-pseudo -grammar=%cxx-bnf-file -source=%s --print-forest | FileCheck %s
+void foo2(int, ...);
+// CHECK: translation-unit~simple-declaration := decl-specifier-seq init-declarator-list ;
+// CHECK-NEXT: ├─decl-specifier-seq~VOID :=
+// CHECK-NEXT: ├─init-declarator-list~noptr-declarator := noptr-declarator parameters-and-qualifiers
+// CHECK-NEXT: │ ├─noptr-declarator~IDENTIFIER :=
+// CHECK-NEXT: │ └─parameters-and-qualifiers := ( parameter-declaration-clause )
+// CHECK-NEXT: │ ├─( :=
+// CHECK-NEXT: │ ├─parameter-declaration-clause := parameter-declaration-list , ...
+// CHECK-NEXT: │ │ ├─parameter-declaration-list~INT :=
+// CHECK-NEXT: │ │ ├─, :=
+// CHECK-NEXT: │ │ └─... :=
+// CHECK-NEXT: │ └─) :=
+// CHECK-NEXT: └─; :=
Index: clang-tools-extra/pseudo/lib/cxx.bnf
===================================================================
--- clang-tools-extra/pseudo/lib/cxx.bnf
+++ clang-tools-extra/pseudo/lib/cxx.bnf
@@ -409,7 +409,7 @@
noptr-declarator := noptr-declarator parameters-and-qualifiers
noptr-declarator := noptr-declarator [ constant-expression_opt ]
noptr-declarator := ( ptr-declarator )
-parameters-and-qualifiers := ( parameter-declaration-list_opt ) cv-qualifier-seq_opt ref-qualifier_opt noexcept-specifier_opt
+parameters-and-qualifiers := ( parameter-declaration-clause_opt ) cv-qualifier-seq_opt ref-qualifier_opt noexcept-specifier_opt
trailing-return-type := -> type-id
ptr-operator := * cv-qualifier-seq_opt
ptr-operator := &
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125479.434733.patch
Type: text/x-patch
Size: 2537 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220607/4f21f7e3/attachment.bin>
More information about the cfe-commits
mailing list