[TableGen] Let list elements have a trailing comma
Let lists have an trailing comma to allow cleaner diffs e.g:
def : Features<[FeatureA,
FeatureB,
]>;
Reviewed By: hfinkel
Differential Revision: https://reviews.llvm.org/D59247
llvm-svn: 356986
This commit is contained in:
parent
33888ff66b
commit
c85cb2fb5d
@ -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()) {
|
||||
|
||||
@ -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],
|
||||
]>;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user