1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00

[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:
Javed Absar 2019-03-26 11:16:01 +00:00
parent 889150360c
commit 9f4bee30b0
2 changed files with 8 additions and 0 deletions

View File

@ -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()) {

View File

@ -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],
]>;