This is an archive of the discontinued LLVM Phabricator instance.

[Clang][Parser] Accept GNU attributes preceding C++ style attributes on templates
ClosedPublic

Authored by eandrews on May 31 2023, 1:42 PM.

Details

Summary

Clang was rejecting valid code where GNU style attributes preceded C++ style attributes in template declarations as follows:

template<int a>
__attribute__((deprecated("oh no!"))) [[deprecated("oh no!")]] void foo();

This PR fixes the bug.

Diff Detail

Event Timeline

eandrews created this revision.May 31 2023, 1:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 31 2023, 1:42 PM
eandrews requested review of this revision.May 31 2023, 1:42 PM
eandrews edited the summary of this revision. (Show Details)
compnerd accepted this revision.May 31 2023, 7:26 PM

Could you add a test case for the inverted order of attributes on a template as well? I don't think that there is a test case for that.

This revision is now accepted and ready to land.May 31 2023, 7:26 PM
eandrews updated this revision to Diff 527382.Jun 1 2023, 6:04 AM

Thanks for the review! I added a couple more tests.

This needs a release note, otherwise LGTM!

eandrews updated this revision to Diff 527406.Jun 1 2023, 7:09 AM

Thanks for the review! I've added a release note.

erichkeane accepted this revision.Jun 1 2023, 7:15 AM

1 suggestion, otherwise LGTM.

clang/docs/ReleaseNotes.rst
416 ↗(On Diff #527406)
eandrews added inline comments.Jun 1 2023, 8:27 AM
clang/docs/ReleaseNotes.rst
416 ↗(On Diff #527406)

I'll make this change when I commit the patch. Thanks!

Herald added a project: Restricted Project. · View Herald TranscriptJun 2 2023, 8:11 AM