diff options
author | Nicolai Haehnle <nhaehnle@gmail.com> | 2018-03-14 11:00:33 +0000 |
---|---|---|
committer | Nicolai Haehnle <nhaehnle@gmail.com> | 2018-03-14 11:00:33 +0000 |
commit | 8eba69184a890bdf47bde3e9894c6982c87ee82f (patch) | |
tree | a9fa0fa7d3a829ded3569f73bc74ebba0e5a9f7f /llvm/lib/TableGen | |
parent | e3e02fa66dbb1e66b211159be46256ee39f51d69 (diff) |
TableGen: Allow ? in lists
This makes using !dag more convenient in some cases.
Change-Id: I0a8c35e15ccd1ecec778fd1c8d64eee38d74517c
Differential revision: https://reviews.llvm.org/D44111
Diffstat (limited to 'llvm/lib/TableGen')
-rw-r--r-- | llvm/lib/TableGen/TGParser.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/llvm/lib/TableGen/TGParser.cpp b/llvm/lib/TableGen/TGParser.cpp index 629320975a6..0dd4da416d9 100644 --- a/llvm/lib/TableGen/TGParser.cpp +++ b/llvm/lib/TableGen/TGParser.cpp @@ -1676,18 +1676,16 @@ Init *TGParser::ParseSimpleValue(Record *CurRec, RecTy *ItemType, RecTy *EltTy = nullptr; for (Init *V : Vals) { TypedInit *TArg = dyn_cast<TypedInit>(V); - if (!TArg) { - TokError("Untyped list element"); - return nullptr; - } - if (EltTy) { - EltTy = resolveTypes(EltTy, TArg->getType()); - if (!EltTy) { - TokError("Incompatible types in list elements"); - return nullptr; + if (TArg) { + if (EltTy) { + EltTy = resolveTypes(EltTy, TArg->getType()); + if (!EltTy) { + TokError("Incompatible types in list elements"); + return nullptr; + } + } else { + EltTy = TArg->getType(); } - } else { - EltTy = TArg->getType(); } } |