================ @@ -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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits