This is an archive of the discontinued LLVM Phabricator instance.

[clang][parser] Unify rejecting (non) decl stmt with gnu attributes
ClosedPublic

Authored by tbaeder on Apr 6 2021, 3:20 AM.

Details

Summary

I randomly noticed this comment (introduced in a3e01cf822f7415337e5424af3c6f4c94a12c1b9 from @rsmith), which is now incorrect.

It suggests that decl statements and others should be handled the same here.

I'm just posting this since it seems correct (according to the comment from 2013), but I'm not sure if the new diagnostic in the test case is really better than the old one.

If the old one is preferred, I can just reword the comment instead.

Diff Detail

Event Timeline

tbaeder requested review of this revision.Apr 6 2021, 3:20 AM
tbaeder created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptApr 6 2021, 3:20 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

I think the behavior is correct, but I do think the original diagnostic was somewhat better -- an attribute list *can* appear there, if you're lucky. Of course, the old diagnostic isn't great either because adding a ; after the attribute isn't going to improve the situation for the user. So I think I'm actually fine either way, but maybe @rsmith has a preference.

Hey Aaron, it's been a while. Do you have a suggestion on how to proceed if @rsmith has no opinion on it?

aaron.ballman accepted this revision.Apr 16 2021, 9:11 AM

Hey Aaron, it's been a while. Do you have a suggestion on how to proceed if @rsmith has no opinion on it?

I think the behavior in the patch is okay as-is, so LGTM, thank you!

This revision is now accepted and ready to land.Apr 16 2021, 9:11 AM
tbaeder updated this revision to Diff 338459.Apr 19 2021, 2:56 AM