[all-commits] [llvm/llvm-project] 6e56d0: Start support for HLSL `RWBuffer`

Chris B via All-commits all-commits at lists.llvm.org
Thu Jul 28 06:57:52 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6e56d0dbe3c89d3cd5730a57b9049b74e0bf605f
  Author: Chris Bieneman <chris.bieneman at me.com>
  Date:   2022-07-28 (Thu, 28 Jul 2022)

  Changed paths:
    M clang/include/clang/Sema/HLSLExternalSemaSource.h
    M clang/lib/AST/DeclTemplate.cpp
    M clang/lib/Sema/HLSLExternalSemaSource.cpp
    A clang/test/AST/HLSL/RWBuffer-AST.hlsl
    A clang/test/AST/HLSL/ResourceStruct.hlsl
    A clang/test/SemaHLSL/BuiltIns/RWBuffers.hlsl

  Log Message:
  Start support for HLSL `RWBuffer`

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

Depends on D128012.

Differential Revision: https://reviews.llvm.org/D128569

More information about the All-commits mailing list