summaryrefslogtreecommitdiffstats
path: root/llvm/lib/TableGen/TGParser.cpp
diff options
context:
space:
mode:
authorNicolai Haehnle <nhaehnle@gmail.com>2018-03-14 11:00:33 +0000
committerNicolai Haehnle <nhaehnle@gmail.com>2018-03-14 11:00:33 +0000
commitef60a26817c68539125242b1b3cbf91fb850b657 (patch)
tree29591c18415f415a984df96cf31f9acabfd9df40 /llvm/lib/TableGen/TGParser.cpp
parent6c118656380f5ee8827e73fb6e4fc5aa0950dee4 (diff)
downloadbcm5719-llvm-ef60a26817c68539125242b1b3cbf91fb850b657.tar.gz
bcm5719-llvm-ef60a26817c68539125242b1b3cbf91fb850b657.zip
TableGen: Allow ? in lists
This makes using !dag more convenient in some cases. Change-Id: I0a8c35e15ccd1ecec778fd1c8d64eee38d74517c Differential revision: https://reviews.llvm.org/D44111 llvm-svn: 327493
Diffstat (limited to 'llvm/lib/TableGen/TGParser.cpp')
-rw-r--r--llvm/lib/TableGen/TGParser.cpp20
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();
}
}
OpenPOWER on IntegriCloud