hokein created this revision. hokein added a reviewer: sammccall. Herald added a project: All. hokein requested review of this revision. Herald added a subscriber: alextsao1999. Herald added a project: clang-tools-extra.
The grammar rule is not right, doesn't match the standard one. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D126991 Files: clang-tools-extra/pseudo/lib/cxx.bnf clang-tools-extra/pseudo/test/cxx/empty-member-spec.cpp Index: clang-tools-extra/pseudo/test/cxx/empty-member-spec.cpp =================================================================== --- /dev/null +++ clang-tools-extra/pseudo/test/cxx/empty-member-spec.cpp @@ -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] Index: clang-tools-extra/pseudo/lib/cxx.bnf =================================================================== --- clang-tools-extra/pseudo/lib/cxx.bnf +++ clang-tools-extra/pseudo/lib/cxx.bnf @@ -537,7 +537,7 @@ 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
Index: clang-tools-extra/pseudo/test/cxx/empty-member-spec.cpp =================================================================== --- /dev/null +++ clang-tools-extra/pseudo/test/cxx/empty-member-spec.cpp @@ -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] Index: clang-tools-extra/pseudo/lib/cxx.bnf =================================================================== --- clang-tools-extra/pseudo/lib/cxx.bnf +++ clang-tools-extra/pseudo/lib/cxx.bnf @@ -537,7 +537,7 @@ 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
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits