This is an archive of the discontinued LLVM Phabricator instance.

TableGen: add !isa operation
ClosedPublic

Authored by nhaehnle on Mar 5 2018, 12:17 PM.

Details

Summary

Change-Id: Iddb724c3ae706d82933a2d82c91d07e0e36b30e3

Diff Detail

Event Timeline

nhaehnle created this revision.Mar 5 2018, 12:17 PM
tra added inline comments.Mar 5 2018, 5:54 PM
docs/TableGen/LangIntro.rst
213–216

I've found this confusing. Why would anyone expect a string argument to !isa<>() to be magically cast to a record? I would after this comment, though. :-) IMO the first line of the description alone is sufficient.

lib/TableGen/Record.cpp
1235–1238

Why not use FoldingSet we use everywhere else?

I can't tell whether we're in danger of pointer reuse here, though if we are we'd need both CheckType and Expr to be freed, reallocated and passed to this function simultaneously in order to trigger a problem. Still...

lib/TableGen/TGParser.cpp
958

Did you mean "in !isa operator" ?

nhaehnle updated this revision to Diff 137342.Mar 7 2018, 2:43 AM
nhaehnle marked 2 inline comments as done.

Use folding set, change docs, and improve parser error messages

nhaehnle added inline comments.Mar 7 2018, 2:44 AM
docs/TableGen/LangIntro.rst
213–216

Done.

lib/TableGen/Record.cpp
1235–1238

Changed to use FoldingSet.

Yes, the pointer reuse thing is indeed a theoretical problem, but it's pretty pervasive for all objects that can directly or indirectly reference a Record. This should really be cleaned up at some point.

lib/TableGen/TGParser.cpp
958

The dangers of copy & paste :)

Fixed.

tra accepted this revision.Mar 7 2018, 10:09 AM
This revision is now accepted and ready to land.Mar 7 2018, 10:09 AM
This revision was automatically updated to reflect the committed changes.