This is an archive of the discontinued LLVM Phabricator instance.

[HLSL] Add HLSLResource attribute
ClosedPublic

Authored by beanz on Jul 18 2022, 8:15 AM.

Details

Summary

HLSL Resource objects will have restrictions on use and codegen
requirements. This patch is fairly minimal just adding the attribute
with no spellings since it will only be attached by the
HLSLExternalSemaSource.

Depends on D130017.

Diff Detail

Event Timeline

beanz created this revision.Jul 18 2022, 8:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 18 2022, 8:15 AM
beanz requested review of this revision.Jul 18 2022, 8:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 18 2022, 8:15 AM
beanz edited the summary of this revision. (Show Details)Jul 18 2022, 8:17 AM
aaron.ballman accepted this revision.Jul 26 2022, 9:46 AM

LGTM aside from a documentation question.

clang/include/clang/Basic/AttrDocs.td
6473–6475 ↗(On Diff #445518)

Because the attribute cannot be written by the user, it seems like we shouldn't bother documenting this attribute at all. WDYT? If you agree, you can mark the attribute as Undocumented in Attr.td.

This revision is now accepted and ready to land.Jul 26 2022, 9:46 AM
beanz added inline comments.Jul 27 2022, 8:17 AM
clang/include/clang/Basic/AttrDocs.td
6473–6475 ↗(On Diff #445518)

Yea... I am kinda split mind on this myself, and I think the tl;dr is that this is the wrong place to document this.

The existing HLSL compiler and HLSL language are woefully short on documentation, so I'm trying to at least make a best-effort at documenting things as I implement them in clang. Since the AttrDocs are really intended to be user-facing documentation this is probably the wrong place to document it.

I'll pull this out and maybe separately create a folder under clang's docs directory for HLSL-related documentation so that it lives with the more project-centric docs. Does that make sense?

aaron.ballman added inline comments.Jul 27 2022, 9:15 AM
clang/include/clang/Basic/AttrDocs.td
6473–6475 ↗(On Diff #445518)

I'll pull this out and maybe separately create a folder under clang's docs directory for HLSL-related documentation so that it lives with the more project-centric docs. Does that make sense?

I'm fine with that approach. FWIW, I've struggled with this a bit as well. We want all new attributes to be documented, and it's a sometimes super fuzzy line between "this is an implementation detail" and "users can use this with wild abandon". However, in this case, because the attribute has no spelling, it's pretty clearly an implementation detail. So putting that into the "using clang as a library" or other internal documentation.

bogner accepted this revision.Jul 27 2022, 11:59 AM
This revision was landed with ongoing or failed builds.Jul 28 2022, 7:14 PM
This revision was automatically updated to reflect the committed changes.