[clang-tools-extra] 1828c75 - [pseudo] Apply the function-declarator to member functions.
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 12 04:50:31 PDT 2022
Author: Haojian Wu
Date: 2022-08-12T13:49:01+02:00
New Revision: 1828c75d5f4ff657cf977476091fa224c8193e1d
URL: https://github.com/llvm/llvm-project/commit/1828c75d5f4ff657cf977476091fa224c8193e1d
DIFF: https://github.com/llvm/llvm-project/commit/1828c75d5f4ff657cf977476091fa224c8193e1d.diff
LOG: [pseudo] Apply the function-declarator to member functions.
A followup patch of d489b3807f096584175c321ce7f20e9dcd49b1da, but for
member functions, this will eliminate a false parse of member
declaration.
Differential Revision: https://reviews.llvm.org/D131720
Added:
clang-tools-extra/pseudo/test/cxx/declator-member-function.cpp
Modified:
clang-tools-extra/pseudo/lib/cxx/cxx.bnf
Removed:
################################################################################
diff --git a/clang-tools-extra/pseudo/lib/cxx/cxx.bnf b/clang-tools-extra/pseudo/lib/cxx/cxx.bnf
index d5cc0a9d2c857..697e79d609aa2 100644
--- a/clang-tools-extra/pseudo/lib/cxx/cxx.bnf
+++ b/clang-tools-extra/pseudo/lib/cxx/cxx.bnf
@@ -571,9 +571,9 @@ member-declaration := opaque-enum-declaration
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
diff --git a/clang-tools-extra/pseudo/test/cxx/declator-member-function.cpp b/clang-tools-extra/pseudo/test/cxx/declator-member-function.cpp
new file mode 100644
index 0000000000000..58d0ff4ccae9a
--- /dev/null
+++ b/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
+};
More information about the cfe-commits
mailing list