[PATCH] D128569: Start support for HLSL `RWBuffer`

Chris Bieneman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 24 17:59:30 PDT 2022


beanz created this revision.
beanz added reviewers: Anastasia, spyffe, kuhar, bogner, python3kgae.
Herald added a project: All.
beanz requested review of this revision.
Herald added a project: clang.

Most of the change here is fleshing out the HLSLExternalSemaSource with
builder implementations to build the builtin types. Eventually, I may
move some of this code into tablegen or a more managable declarative
file but I want to get the AST generation logic ready first.

This code adds two new types into the HLSL AST, `hlsl::Resource` and
`hlsl::RWBuffer`. The `Resource` type is just a wrapper around a handle
identifier, and is largely unused in source. It will morph a bit over
time as I work on getting the source compatability correct, but for now
it is a reasonable stand-in. The `RWBuffer` type is not ready for use.
I'm posting this change for review because it adds a lot of
infrastructure code and is testable.

There is one change to clang code outside the HLSL-specific logic here,
which addresses a behavior change introduced a long time ago in
967d438439ac. That change resulted in unintentionally breaking
situations where an incomplete template declaration was provided from
an AST source, and needed to be completed later by the external AST.
That situation doesn't happen in the normal AST importer flow, but can
happen when an AST source provides incomplete declarations of
templates. The solution is to annotate template specializations of
incomplete types with the HasExternalLexicalSource bit from the base
template.

Depends on D128012 <https://reviews.llvm.org/D128012>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D128569

Files:
  clang/include/clang/Basic/Builtins.def
  clang/include/clang/Sema/HLSLExternalSemaSource.h
  clang/lib/AST/DeclTemplate.cpp
  clang/lib/Sema/HLSLExternalSemaSource.cpp
  clang/test/AST/HLSL/RWBuffer-AST.hlsl
  clang/test/AST/HLSL/ResourceStruct.hlsl
  clang/test/SemaHLSL/BuiltIns/RWBuffers.hlsl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128569.439940.patch
Type: text/x-patch
Size: 14908 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220625/05c44991/attachment-0001.bin>


More information about the cfe-commits mailing list