[clang] Implement resource binding type prefix mismatch diagnostic infrastructure (PR #97103)

Damyan Pepper via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 14 14:28:48 PDT 2024


================
@@ -38,6 +38,14 @@ Decl *SemaHLSL::ActOnStartBuffer(Scope *BufferScope, bool CBuffer,
   HLSLBufferDecl *Result = HLSLBufferDecl::Create(
       getASTContext(), LexicalParent, CBuffer, KwLoc, Ident, IdentLoc, LBrace);
 
+  auto RC = CBuffer ? llvm::hlsl::ResourceClass::CBuffer
+                    : llvm::hlsl::ResourceClass::SRV;
+  auto RK = CBuffer ? llvm::hlsl::ResourceKind::CBuffer
----------------
damyanp wrote:

ahhhh....so tbuffer's are SRVs!  I remember trying to figure that out before reading the docs and getting very confused.  I don't quite understand that tbuffers are for.

One nit here: it took me a moment to remember that this code treats "not cbuffer" as "tbuffer". Maybe a comment here noting that would help?

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


More information about the cfe-commits mailing list