[PATCH] D126998: [pseudo] Fix the type-parameter rule.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 3 13:02:51 PDT 2022


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 IDENTIFIER should be optional.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D126998

Files:
  clang-tools-extra/pseudo/lib/cxx.bnf
  clang-tools-extra/pseudo/test/cxx/template-noid-type-parameter.cpp


Index: clang-tools-extra/pseudo/test/cxx/template-noid-type-parameter.cpp
===================================================================
--- /dev/null
+++ clang-tools-extra/pseudo/test/cxx/template-noid-type-parameter.cpp
@@ -0,0 +1,3 @@
+// RUN: clang-pseudo -grammar=%cxx-bnf-file -source=%s --print-forest | FileCheck %s
+template <typename> struct MatchParents;
+// CHECK: template-parameter-list~TYPENAME := tok[2]
Index: clang-tools-extra/pseudo/lib/cxx.bnf
===================================================================
--- clang-tools-extra/pseudo/lib/cxx.bnf
+++ clang-tools-extra/pseudo/lib/cxx.bnf
@@ -645,7 +645,7 @@
 constraint-logical-and-expression := constraint-logical-and-expression && primary-expression
 template-parameter := type-parameter
 template-parameter := parameter-declaration
-type-parameter := type-parameter-key ..._opt IDENTIFIER
+type-parameter := type-parameter-key ..._opt IDENTIFIER_opt
 type-parameter := type-parameter-key IDENTIFIER_opt = type-id
 type-parameter := type-constraint ..._opt IDENTIFIER_opt
 type-parameter := type-constraint IDENTIFIER_opt = type-id


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126998.434120.patch
Type: text/x-patch
Size: 1115 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220603/830ceb13/attachment.bin>


More information about the cfe-commits mailing list