summaryrefslogtreecommitdiffstats
path: root/llvm/lib/TableGen/Record.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/TableGen/Record.cpp')
-rw-r--r--llvm/lib/TableGen/Record.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/llvm/lib/TableGen/Record.cpp b/llvm/lib/TableGen/Record.cpp
index 866cda3152f..81c75cd847d 100644
--- a/llvm/lib/TableGen/Record.cpp
+++ b/llvm/lib/TableGen/Record.cpp
@@ -1508,14 +1508,8 @@ Init *VarListElementInit::getBit(unsigned Bit) const {
return VarBitInit::get(const_cast<VarListElementInit*>(this), Bit);
}
-static RecordRecTy *makeDefInitType(Record *Rec) {
- SmallVector<Record *, 4> SuperClasses;
- Rec->getDirectSuperClasses(SuperClasses);
- return RecordRecTy::get(SuperClasses);
-}
-
DefInit::DefInit(Record *D)
- : TypedInit(IK_DefInit, makeDefInitType(D)), Def(D) {}
+ : TypedInit(IK_DefInit, D->getType()), Def(D) {}
DefInit *DefInit::get(Record *R) {
return R->getDefInit();
@@ -1865,7 +1859,14 @@ void Record::checkName() {
// Ensure the record name has string type.
const TypedInit *TypedName = cast<const TypedInit>(Name);
if (!isa<StringRecTy>(TypedName->getType()))
- PrintFatalError(getLoc(), "Record name is not a string!");
+ PrintFatalError(getLoc(), Twine("Record name '") + Name->getAsString() +
+ "' is not a string!");
+}
+
+RecordRecTy *Record::getType() {
+ SmallVector<Record *, 4> DirectSCs;
+ getDirectSuperClasses(DirectSCs);
+ return RecordRecTy::get(DirectSCs);
}
DefInit *Record::getDefInit() {
OpenPOWER on IntegriCloud