summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/TableGen/TGParser.cpp4
-rw-r--r--llvm/test/TableGen/ListArgs.td4
2 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/TableGen/TGParser.cpp b/llvm/lib/TableGen/TGParser.cpp
index 3fc2e53f208..f9486d4469d 100644
--- a/llvm/lib/TableGen/TGParser.cpp
+++ b/llvm/lib/TableGen/TGParser.cpp
@@ -2283,6 +2283,10 @@ void TGParser::ParseValueList(SmallVectorImpl<Init*> &Result, Record *CurRec,
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()) {
diff --git a/llvm/test/TableGen/ListArgs.td b/llvm/test/TableGen/ListArgs.td
index 8714112d137..4d2713a1cab 100644
--- a/llvm/test/TableGen/ListArgs.td
+++ b/llvm/test/TableGen/ListArgs.td
@@ -10,3 +10,7 @@ class BBB<list<list<int>> vals> : BB<vals>;
def OneB : BBB<[[1,2,3]]>;
def TwoB : BBB<[[1,2,3],[4,5,6]]>;
+
+def ThreeB: BBB<[[1,2,3],
+ [4,5,6],
+ ]>;
OpenPOWER on IntegriCloud