[pseudo] Fix the member-specification grammar rule.

The grammar rule is not right, doesn't match the standard one.

Differential Revision: https://reviews.llvm.org/D126991
This commit is contained in:
Haojian Wu 2022-06-03 21:02:25 +02:00
parent e4f47c8e05
commit 0a6a17a4f9
2 changed files with 14 additions and 1 deletions

View File

@ -537,7 +537,7 @@ class-key := CLASS
class-key := STRUCT
class-key := UNION
member-specification := member-declaration member-specification_opt
member-specification := access-specifier : member-declaration member-specification_opt
member-specification := access-specifier : member-specification_opt
member-declaration := decl-specifier-seq_opt member-declarator-list_opt ;
member-declaration := function-definition
member-declaration := using-declaration

View File

@ -0,0 +1,13 @@
// RUN: clang-pseudo -grammar=%cxx-bnf-file -source=%s --print-forest | FileCheck %s
class Foo {
public:
};
// CHECK: decl-specifier-seq~class-specifier := class-head { member-specification }
// CHECK-NEXT: ├─class-head := class-key class-head-name
// CHECK-NEXT: │ ├─class-key~CLASS := tok[0]
// CHECK-NEXT: │ └─class-head-name~IDENTIFIER := tok[1]
// CHECK-NEXT: ├─{ := tok[2]
// CHECK-NEXT: ├─member-specification := access-specifier :
// CHECK-NEXT: │ ├─access-specifier~PUBLIC := tok[3]
// CHECK-NEXT: │ └─: := tok[4]
// CHECK-NEXT: └─} := tok[5]