[PATCH] D126991: [pseudo] Fix the member-specification grammar rule.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 7 01:20:02 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0a6a17a4f9fd: [pseudo] Fix the member-specification grammar rule. (authored by hokein).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126991/new/

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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126991.434723.patch
Type: text/x-patch
Size: 1472 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220607/9c5534e1/attachment.bin>


More information about the cfe-commits mailing list