TableGen: Fix typeIsConvertibleTo for record types
authorNicolai Haehnle <nhaehnle@gmail.com>
Fri, 23 Feb 2018 10:46:13 +0000 (10:46 +0000)
committerNicolai Haehnle <nhaehnle@gmail.com>
Fri, 23 Feb 2018 10:46:13 +0000 (10:46 +0000)
commitaecb68b54990fd888aebe7a9f6189b1ab00abfc6
tree99ebbcab680e20e83e95e5d9876a38cae374fe45
parent0243aaf42c6c766ea64868b67357dc761ea95b99
TableGen: Fix typeIsConvertibleTo for record types

Summary:
Only check whether the left-hand side type is a subclass (or equal to)
the right-hand side type.

This requires a further fix in handling !if expressions and in type
resolution.

Furthermore, reverse the order of superclasses so that resolveTypes will
find a least common ancestor at least in simple cases.

Add a test that used to be accepted without flagging the obvious type
error.

Change-Id: Ib366db1a4e6a079f1a0851e469b402cddae76714

Reviewers: arsenm, craig.topper, tra, MartinO

Subscribers: wdng, llvm-commits

Differential Revision: https://reviews.llvm.org/D43559

llvm-svn: 325884
llvm/lib/TableGen/Record.cpp
llvm/lib/TableGen/TGParser.cpp
llvm/test/TableGen/if-type.td [new file with mode: 0644]
llvm/test/TableGen/if.td