================ @@ -890,6 +890,10 @@ CodeGenModule::EmitCXXGlobalInitFunc() { ModuleInits.push_back(Fn); } + if (getLangOpts().HLSL && getHLSLRuntime().needsResourceBindingInitFn()) { + CXXGlobalInits.push_back(getHLSLRuntime().createResourceBindingInitFn()); + } ---------------- llvm-beanz wrote:
You probably haven't seen this, but I filed an issue yesterday about how we were connecting initializers in the wrong place (https://github.com/llvm/llvm-project/issues/120636). This is definitely better. I do wonder if we should be generating one binding function for all bindings (which would require collecting them and generating them late), or if we should be generating an initializer per binding and appending them to the `CXXGlobalInits` list as we process each binding. While the later produces more functions that need to be inlined, I'm inclined to prefer it because it is simpler and aligns more with a traditional RAII-model for resource initialization. The issue I filed is probably redundant since you're still reworking all of this. https://github.com/llvm/llvm-project/pull/119755 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits