[clang] [HLSL][NFC] Add assert to verify the implicit binding resource attribute exists (PR #156094)

Helena Kotas via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 29 13:11:24 PDT 2025


https://github.com/hekota created https://github.com/llvm/llvm-project/pull/156094

None

>From 8823f63a2ea5dbb471de9d0535585cb4f923f45a Mon Sep 17 00:00:00 2001
From: Helena Kotas <hekotas at microsoft.com>
Date: Fri, 29 Aug 2025 13:10:18 -0700
Subject: [PATCH] [HLSL] Add assert to verify the resource binding attr exists

---
 clang/lib/CodeGen/CGHLSLRuntime.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp b/clang/lib/CodeGen/CGHLSLRuntime.cpp
index 12ece217ba563..d0be339f2a671 100644
--- a/clang/lib/CodeGen/CGHLSLRuntime.cpp
+++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp
@@ -180,6 +180,7 @@ static void createResourceCtorArgs(CodeGenModule &CGM, CXXConstructorDecl *CD,
 
   } else {
     // implicit binding
+    assert(RBA && "missing implicit binding attribute");
     auto *OrderID =
         llvm::ConstantInt::get(CGM.IntTy, RBA->getImplicitBindingOrderID());
     Args.add(RValue::get(Space), AST.UnsignedIntTy);



More information about the cfe-commits mailing list