This is an archive of the discontinued LLVM Phabricator instance.

TableGen: Check the dynamic type of !cast<Rec>(string)
ClosedPublic

Authored by nhaehnle on Mar 14 2018, 8:23 AM.

Details

Summary

The docs already claim that this happens, but so far it hasn't. As a
consequence, existing TableGen files get this wrong a lot, but luckily
the fixes are all reasonably straightforward.

To make this work with all the existing forms of self-references (since
the true type of a record is only built up over time), the lookup of
self-references in !cast is delayed until the final resolving step.

Change-Id: If5923a72a252ba2fbc81a889d59775df0ef31164

Diff Detail

Repository
rL LLVM

Event Timeline

nhaehnle created this revision.Mar 14 2018, 8:23 AM
tra accepted this revision.Mar 14 2018, 11:42 AM
tra added inline comments.
include/llvm/TableGen/Record.h
1795 ↗(On Diff #138366)

I'd remove setFinal() and make isFinal a constructor parameter. Up to you.

This revision is now accepted and ready to land.Mar 14 2018, 11:42 AM
This revision was automatically updated to reflect the committed changes.