Author: Haojian Wu Date: 2022-06-07T10:47:07+02:00 New Revision: cf88150c48df4e779edb91a8facf838bea3bd1b7
URL: https://github.com/llvm/llvm-project/commit/cf88150c48df4e779edb91a8facf838bea3bd1b7 DIFF: https://github.com/llvm/llvm-project/commit/cf88150c48df4e779edb91a8facf838bea3bd1b7.diff LOG: [pseudo] Fix the incorrect parameters-and-qualifiers rule. The parenthese body should be parameter-declaration-clause, rather than parameter-declaration-list. Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D125479 Added: clang-tools-extra/pseudo/test/cxx/parameter-decl-clause.cpp Modified: clang-tools-extra/pseudo/lib/cxx.bnf clang-tools-extra/pseudo/test/cxx/unsized-array.cpp Removed: ################################################################################ diff --git a/clang-tools-extra/pseudo/lib/cxx.bnf b/clang-tools-extra/pseudo/lib/cxx.bnf index 707844d88239..ec05af94c026 100644 --- a/clang-tools-extra/pseudo/lib/cxx.bnf +++ b/clang-tools-extra/pseudo/lib/cxx.bnf @@ -409,7 +409,7 @@ noptr-declarator := declarator-id 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 := & diff --git a/clang-tools-extra/pseudo/test/cxx/parameter-decl-clause.cpp b/clang-tools-extra/pseudo/test/cxx/parameter-decl-clause.cpp new file mode 100644 index 000000000000..7de65687e1d1 --- /dev/null +++ b/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: └─; := diff --git a/clang-tools-extra/pseudo/test/cxx/unsized-array.cpp b/clang-tools-extra/pseudo/test/cxx/unsized-array.cpp index 16d4da94039c..52179e0e2dd4 100644 --- a/clang-tools-extra/pseudo/test/cxx/unsized-array.cpp +++ b/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] _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits