This is an archive of the discontinued LLVM Phabricator instance.

[TableGen] Improve error message for semicolon after braced body
ClosedPublic

Authored by Paul-C-Anagnostopoulos on Jan 11 2021, 6:52 AM.

Details

Summary

This revision improves the error message resulting from a braced body followed by a semicolon, in defs, classes, and multiclasses.

def foo {

...

};

https://bugs.llvm.org/show_bug.cgi?id=48706

Diff Detail

Event Timeline

Paul-C-Anagnostopoulos requested review of this revision.Jan 11 2021, 6:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 11 2021, 6:52 AM

Can we write tests for this?

llvm/lib/TableGen/TGParser.cpp
2839

I don't think there should be a comma between two choices.

2856

I think "A class or def body should not end with a semicolon" reads better to me.

3446

Similar here.

I will write tests for these errors.

llvm/lib/TableGen/TGParser.cpp
2839

Here "to start body" only applies to the second choice, so the comma disambiguates the sentence. Let me actually rewrite it so it's clear.

2856

Agreed.

I incorporated Craig's suggestions.

I will add a new test on Tuesday.

What am I waiting for? Here is a test of this new message.

craig.topper added inline comments.Jan 11 2021, 4:02 PM
llvm/test/TableGen/spurious-semi.td
23

I thought we change the error message to say "should not"?

I fixed the broken test. Thanks for catching this, Craig.

lattner accepted this revision.Jan 11 2021, 9:53 PM

Looks great, thanks Paul!

This revision is now accepted and ready to land.Jan 11 2021, 9:53 PM