[PATCH] D122699: [HLSL] Add Semantic syntax, and SV_GroupIndex

Chris Bieneman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 30 06:33:53 PDT 2022


beanz added a comment.

Will try to update today. Thank you!



================
Comment at: clang/lib/Parse/ParseDecl.cpp:6965-6966
     // Parse GNU attributes, if present.
     MaybeParseGNUAttributes(ParmDeclarator);
+    MaybeParseHLSLSemantics(DS.getAttributes());
 
----------------
aaron.ballman wrote:
> This means the order is very specific -- should this be using `MaybeParseAttributes()` so that the syntaxes can be intermingled?
> 
> This reminds me, I don't see a change to `ParseAttrKindMask`, but perhaps we want that for both the microsoft and HLSL semantic attributes?
This is kinda 6 one way half dozen the other. GNU attribute syntax isn't supported in HLSL, I just haven't gotten around to disabling it yet.

If you have a preferred implementation I'm happy to go whatever way you suggest.

The HLSL language doesn't support Semantics or Microsoft-style attributes in all that many places in code. MS attributes are only used on functions, and semantics are restricted to input/output data (which is a little more complicated than it sounds, but basically is function parameters, returns, global variables and struct members).


================
Comment at: clang/lib/Parse/ParseHLSL.cpp:30-33
+  if (AttrKind == ParsedAttr::UnknownAttribute ||
+      AttrKind == ParsedAttr::IgnoredAttribute) {
+    ConsumeToken();
+    return;
----------------
aaron.ballman wrote:
> I think we should issue a diagnostic about ignoring an unused attribute here.
+1


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122699/new/

https://reviews.llvm.org/D122699



More information about the cfe-commits mailing list