[PATCH] D129883: [HLSL] Support cbuffer/tbuffer for hlsl.

Xiang Li via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 15 17:28:02 PDT 2022


python3kgae marked 2 inline comments as done.
python3kgae added inline comments.


================
Comment at: clang/test/SemaHLSL/cbuffer_tbuffer.hlsl:1
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -ast-dump -o - %s | FileCheck %s
+
----------------
beanz wrote:
> This looks like it should be an AST test, not SEMA.
> 
> We should also have parser tests for malformed parse cases:
> 
> ```
> cbuffer { ... };
> cbuffer missing_definition;
> int cbuffer; // using a keyword as a variable name
> cbuffer; // lots wrong here...
> cbuffer missing_semicolon { int woo; }
> ```
> 
> It looks like this patch doesn't handle making the buffer variables constant. Having not looked at that I don't know how big of a change that is, so it might be okay as a subsequent patch, but we'll need that support to handle cases like:
> 
> ```
> cbuffer cb{
> int x;
> };
> 
> [numthreads(1,1,1)]
> void main(int GI : SV_GROUPINDEX) {
>   x = GI; // error: buffer content is const
> }
> ```
Marking constant variables const better be done when supporting global constant buffer. Will add it in another patch.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129883



More information about the cfe-commits mailing list