[clang] [HLSL] Collect explicit resource binding information (PR #111203)
Damyan Pepper via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 16 14:08:27 PDT 2024
================
@@ -110,6 +110,19 @@ DeclBindingInfo *ResourceBindings::addDeclBindingInfo(const VarDecl *VD,
ResourceClass ResClass) {
assert(getDeclBindingInfo(VD, ResClass) == nullptr &&
"DeclBindingInfo already added");
+#ifndef NDEBUG
+ // Verify that existing bindings for this decl are stored sequentially
+ // and at the end of the BindingsList
+ auto I = DeclToBindingListIndex.find(VD);
+ if (I != DeclToBindingListIndex.end()) {
+ for (unsigned Index = I->getSecond(); Index < BindingsList.size(); ++Index)
+ assert(BindingsList[Index].Decl == VD);
+ }
+#endif
----------------
damyanp wrote:
I was thinking that `assert(!hasBindingInfoForDecl(VD) || BindingsList.back().Decl == VD);` would cover most bases?
https://github.com/llvm/llvm-project/pull/111203
More information about the cfe-commits
mailing list