diff options
author | Haojian Wu <hokein.wu@gmail.com> | 2022-08-10 15:41:36 +0200 |
---|---|---|
committer | Haojian Wu <hokein.wu@gmail.com> | 2022-08-12 13:49:01 +0200 |
commit | 1828c75d5f4ff657cf977476091fa224c8193e1d (patch) | |
tree | 47189c019dc0939a90ce8ae2408d67719e3e5c88 /clang-tools-extra/pseudo | |
parent | a1a1a78ac8cf837e4c05152c9715f399b33bfb59 (diff) | |
download | llvm-1828c75d5f4ff657cf977476091fa224c8193e1d.tar.gz |
[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
Diffstat (limited to 'clang-tools-extra/pseudo')
-rw-r--r-- | clang-tools-extra/pseudo/lib/cxx/cxx.bnf | 6 | ||||
-rw-r--r-- | clang-tools-extra/pseudo/test/cxx/declator-member-function.cpp | 9 |
2 files changed, 12 insertions, 3 deletions
diff --git a/clang-tools-extra/pseudo/lib/cxx/cxx.bnf b/clang-tools-extra/pseudo/lib/cxx/cxx.bnf index d5cc0a9d2c85..697e79d609aa 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 000000000000..58d0ff4ccae9 --- /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 +}; |