[PATCH] D59247: [TableGen] Let list elements have a trailing comma

Javed Absar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 26 04:16:53 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL356986: [TableGen] Let list elements have a trailing comma (authored by javed.absar, committed by ).
Herald added a project: LLVM.

Changed prior to commit:
  https://reviews.llvm.org/D59247?vs=190235&id=192257#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D59247

Files:
  llvm/trunk/lib/TableGen/TGParser.cpp
  llvm/trunk/test/TableGen/ListArgs.td


Index: llvm/trunk/lib/TableGen/TGParser.cpp
===================================================================
--- llvm/trunk/lib/TableGen/TGParser.cpp
+++ llvm/trunk/lib/TableGen/TGParser.cpp
@@ -2283,6 +2283,10 @@
   while (Lex.getCode() == tgtok::comma) {
     Lex.Lex();  // Eat the comma
 
+    // ignore trailing comma for lists
+    if (Lex.getCode() == tgtok::r_square)
+      return;
+
     if (ArgsRec && !EltTy) {
       ArrayRef<Init *> TArgs = ArgsRec->getTemplateArgs();
       if (ArgN >= TArgs.size()) {
Index: llvm/trunk/test/TableGen/ListArgs.td
===================================================================
--- llvm/trunk/test/TableGen/ListArgs.td
+++ llvm/trunk/test/TableGen/ListArgs.td
@@ -10,3 +10,7 @@
 
 def OneB : BBB<[[1,2,3]]>;
 def TwoB : BBB<[[1,2,3],[4,5,6]]>;
+
+def ThreeB: BBB<[[1,2,3],
+                 [4,5,6],
+                ]>;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59247.192257.patch
Type: text/x-patch
Size: 876 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190326/06a1bf79/attachment.bin>


More information about the llvm-commits mailing list