diff options
| author | Nicolai Haehnle <nhaehnle@gmail.com> | 2018-02-23 11:31:49 +0000 |
|---|---|---|
| committer | Nicolai Haehnle <nhaehnle@gmail.com> | 2018-02-23 11:31:49 +0000 |
| commit | c10570f7c6ab7424edbc6e6e7c8b7cb69730d991 (patch) | |
| tree | 6c849f3af0f14905b9a7dceeb0329caf7a8abcee /llvm/lib/TableGen/TGParser.cpp | |
| parent | a4cde9d2e22308381cefeda7e8e8ccd4a48fc19d (diff) | |
| download | bcm5719-llvm-c10570f7c6ab7424edbc6e6e7c8b7cb69730d991.tar.gz bcm5719-llvm-c10570f7c6ab7424edbc6e6e7c8b7cb69730d991.zip | |
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
Diffstat (limited to 'llvm/lib/TableGen/TGParser.cpp')
| -rw-r--r-- | llvm/lib/TableGen/TGParser.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/llvm/lib/TableGen/TGParser.cpp b/llvm/lib/TableGen/TGParser.cpp index 4dd05fd3297..10345b99706 100644 --- a/llvm/lib/TableGen/TGParser.cpp +++ b/llvm/lib/TableGen/TGParser.cpp @@ -198,8 +198,6 @@ bool TGParser::AddSubClass(Record *CurRec, SubClassReference &SubClass) { // 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 @@ bool TGParser::AddSubClass(Record *CurRec, SubClassReference &SubClass) { "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 @@ Init *TGParser::ParseOperation(Record *CurRec, RecTy *ItemType) { 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; |

