[clang] [HLSL] Support packoffset attribute in AST (PR #89836)

Chris B via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 29 08:15:56 PDT 2024


================
@@ -7314,6 +7314,41 @@ static void handleHLSLSV_DispatchThreadIDAttr(Sema &S, Decl *D,
   D->addAttr(::new (S.Context) HLSLSV_DispatchThreadIDAttr(S.Context, AL));
 }
 
+static void handleHLSLPackOffsetAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
+  if (!isa<VarDecl>(D) || !isa<HLSLBufferDecl>(D->getDeclContext())) {
+    S.Diag(AL.getLoc(), diag::err_hlsl_attr_invalid_ast_node)
+        << AL << "cbuffer constant";
----------------
llvm-beanz wrote:

Maybe:
```suggestion
        << AL << "cbuffer member variable";
```

"cbuffer constant" is less clear to me because the variable declaration isn't actually marked constant in the source, it is just implicitly constant because it is in a cbuffer.

https://github.com/llvm/llvm-project/pull/89836


More information about the cfe-commits mailing list