summaryrefslogtreecommitdiff
path: root/utils/TableGen/Record.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/TableGen/Record.cpp')
-rw-r--r--utils/TableGen/Record.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/utils/TableGen/Record.cpp b/utils/TableGen/Record.cpp
index 94e0cb472f..bbcdbe7da3 100644
--- a/utils/TableGen/Record.cpp
+++ b/utils/TableGen/Record.cpp
@@ -337,6 +337,13 @@ Init *ListInit::convertInitListSlice(const std::vector<unsigned> &Elements) {
return new ListInit(Vals);
}
+Record *ListInit::getElementAsRecord(unsigned i) const {
+ assert(i < Values.size() && "List element index out of range!");
+ DefInit *DI = dynamic_cast<DefInit*>(Values[i]);
+ if (DI == 0) throw "Expected record in list!";
+ return DI->getDef();
+}
+
Init *ListInit::resolveReferences(Record &R, const RecordVal *RV) {
std::vector<Init*> Resolved;
Resolved.reserve(getSize());