[PATCH] D43559: TableGen: fix typeIsConvertibleTo for record types

Nicolai Hähnle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 22 15:32:57 PST 2018


nhaehnle added inline comments.


================
Comment at: test/TableGen/if.td:76-85
+// Check that !if with operands of different subtypes can initialize a
+// supertype variable.
+class E<int dummy> {}
+class E1<int dummy> : E<dummy> {}
+class E2<int dummy> : E<dummy> {}
+
+class EX<int cc, E1 b, E2 c> {
----------------
tra wrote:
> I think there should be some defs and CHECKs to demonstrate and verify what we expect to generate.
> 
> It's actually not obvious for me whether a particular instance of EX is going to end up with.
> I think it will contain only the subset of fields in E from E1/E2.  Or, perhaps, I'm wrong and it will contain full set of records from either E1 or E2, depending on cc.  Either way it would be good to illustrate expected behavior.
I don't think the question about fields makes much sense because x will just reference some other record. Of course an expression x.fieldname will only allow access to fields in E.

Anyway, I'm adding some defs to illustrate this, and I suppose it's a good check anyway to make sure things don't break when resolving b and c.


Repository:
  rL LLVM

https://reviews.llvm.org/D43559





More information about the llvm-commits mailing list