This is an archive of the discontinued LLVM Phabricator instance.

[TableGen] Fix two bugs in 'defm' when a complex 'assert' is involved
ClosedPublic

Authored by Paul-C-Anagnostopoulos on Apr 30 2021, 6:38 AM.

Details

Summary

This patch fixes two bugs that arise when a 'defm' inherits from a multiclass and also from a class with assertions. I discovered them while adding assertions to the Clang TableGen files.

I'm not sure whether this warrants a Phabricator review, but it certainly can't hurt.

Diff Detail

Event Timeline

Paul-C-Anagnostopoulos requested review of this revision.Apr 30 2021, 6:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 30 2021, 6:38 AM
jansvoboda11 accepted this revision.Apr 30 2021, 6:54 AM

LGTM.

llvm/test/TableGen/assert.td
197

I'd expect TableGen to report only the first assertion failure and abort immediately. What's the logic behind the current behavior?

This revision is now accepted and ready to land.Apr 30 2021, 6:54 AM
llvm/test/TableGen/assert.td
197

Assertion failures are not fatal, so that other errors in the .td files can be reported at the same time.

This revision was landed with ongoing or failed builds.Apr 30 2021, 8:33 AM
This revision was automatically updated to reflect the committed changes.
jansvoboda11 added inline comments.May 3 2021, 12:06 AM
llvm/test/TableGen/assert.td
197

What if the assertion failure is the only error in the .td file? Will TableGen exit with a non-zero code?

llvm/test/TableGen/assert.td
197

Yes. Both errors and fatal errors increment the error count, which is used to determine the exit code.