[PATCH] D131720: [pseudo] Apply the function-declarator to member functions.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 11 13:50:53 PDT 2022
hokein created this revision.
hokein added a reviewer: kadircet.
Herald added a project: All.
hokein requested review of this revision.
Herald added a subscriber: alextsao1999.
Herald added a project: clang-tools-extra.
A followup patch of d489b3807f096584175c321ce7f20e9dcd49b1da <https://reviews.llvm.org/rGd489b3807f096584175c321ce7f20e9dcd49b1da>, but for
member functions, this will eliminate a false parse of member
declaration.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D131720
Files:
clang-tools-extra/pseudo/lib/cxx/cxx.bnf
clang-tools-extra/pseudo/test/cxx/declator-member-function.cpp
Index: clang-tools-extra/pseudo/test/cxx/declator-member-function.cpp
===================================================================
--- /dev/null
+++ clang-tools-extra/pseudo/test/cxx/declator-member-function.cpp
@@ -0,0 +1,9 @@
+// RUN: clang-pseudo -grammar=cxx -source=%s --print-forest | FileCheck %s
+
+// Similiar to declarator-function.cpp, but for member functions.
+class Foo {
+ void foo() {};
+// CHECK-NOT: member-declarator := declarator brace-or-equal-initializer
+// CHECK: member-declaration~function-definition := decl-specifier-seq function-declarator function-body
+// CHECK-NOT: member-declarator := declarator brace-or-equal-initializer
+};
Index: clang-tools-extra/pseudo/lib/cxx/cxx.bnf
===================================================================
--- clang-tools-extra/pseudo/lib/cxx/cxx.bnf
+++ clang-tools-extra/pseudo/lib/cxx/cxx.bnf
@@ -570,9 +570,9 @@
member-declaration := empty-declaration
member-declarator-list := member-declarator
member-declarator-list := member-declarator-list , member-declarator
-member-declarator := declarator virt-specifier-seq_opt pure-specifier_opt
-member-declarator := declarator requires-clause
-member-declarator := declarator brace-or-equal-initializer
+member-declarator := function-declarator virt-specifier-seq_opt pure-specifier_opt
+member-declarator := function-declarator requires-clause
+member-declarator := non-function-declarator brace-or-equal-initializer_opt
member-declarator := IDENTIFIER_opt : constant-expression brace-or-equal-initializer_opt
virt-specifier-seq := virt-specifier
virt-specifier-seq := virt-specifier-seq virt-specifier
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131720.451972.patch
Type: text/x-patch
Size: 1639 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220811/b971b012/attachment-0001.bin>
More information about the cfe-commits
mailing list