OSDN Git Service

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)
commit01724121ace4b1e150eeab9db56407f4cb59f101
treec76987c7e73c536684bb7cea8f2d2d57f7413593
parentc34350228efca57b30d146d4880ac5cd67995433
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325884 91177308-0d34-0410-b5e6-96231b3b80d8
lib/TableGen/Record.cpp
lib/TableGen/TGParser.cpp
test/TableGen/if-type.td [new file with mode: 0644]
test/TableGen/if.td