Revert "TableGen: Fix typeIsConvertibleTo for record types"
This reverts r325884.
Clang's TableGen has dependencies on the exact ordering of superclasses.
Revert this change fully for now to fix the build.
Change-Id: Ib297f5571cc7809f00838702ad7ab53d47335b26
llvm-svn: 325891
diff --git a/llvm/lib/TableGen/TGParser.cpp b/llvm/lib/TableGen/TGParser.cpp
index 4dd05fd..10345b9 100644
--- a/llvm/lib/TableGen/TGParser.cpp
+++ b/llvm/lib/TableGen/TGParser.cpp
@@ -198,8 +198,6 @@
// Since everything went well, we can now set the "superclass" list for the
// current record.
- CurRec->addSuperClass(SC, SubClass.RefRange);
-
ArrayRef<std::pair<Record *, SMRange>> SCs = SC->getSuperClasses();
for (const auto &SCPair : SCs) {
if (CurRec->isSubClassOf(SCPair.first))
@@ -207,6 +205,11 @@
"Already subclass of '" + SCPair.first->getName() + "'!\n");
CurRec->addSuperClass(SCPair.first, SCPair.second);
}
+
+ if (CurRec->isSubClassOf(SC))
+ return Error(SubClass.RefRange.Start,
+ "Already subclass of '" + SC->getName() + "'!\n");
+ CurRec->addSuperClass(SC, SubClass.RefRange);
return false;
}
@@ -1064,10 +1067,12 @@
return nullptr;
}
- Type = resolveTypes(MHSTy, RHSTy);
- if (!Type) {
- TokError(Twine("inconsistent types '") + MHSTy->getAsString() +
- "' and '" + RHSTy->getAsString() + "' for !if");
+ if (MHSTy->typeIsConvertibleTo(RHSTy)) {
+ Type = RHSTy;
+ } else if (RHSTy->typeIsConvertibleTo(MHSTy)) {
+ Type = MHSTy;
+ } else {
+ TokError("inconsistent types for !if");
return nullptr;
}
break;