[llvm-branch-commits] [clang] [CIR][CUDA] Handle CUDA module constructor and destructor emission. (PR #188673)
David Rivera via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Mar 29 11:13:31 PDT 2026
================
@@ -1792,8 +1797,122 @@ void LoweringPreparePass::buildCUDAModuleCtor() {
gpuBinHandle.setInitialValueAttr(builder.getConstNullPtrAttr(voidPtrPtrTy));
gpuBinHandle.setPrivate();
- // TODO: ctor/dtor/register_globals
- assert(!cir::MissingFeatures::globalRegistration());
+ // Declare this function:
+ // void **__{cuda|hip}RegisterFatBinary(void *);
+
+ std::string regFuncName =
----------------
RiverDave wrote:
The thing here is that `addUnderscoredPrefix` returns an `std::string` by value. The ADT docs imply that StringRef does not own its data so in a statement like this:
`StringRef foo = addUnderscoredPrefix(...);`
foo would point to a dangling reference after that statement as it has no owner.
https://github.com/llvm/llvm-project/pull/188673
More information about the llvm-branch-commits
mailing list