[llvm] [Offload] Store kernel name in GenericKernelTy (PR #142799)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 2 05:02:57 PDT 2025


================
@@ -256,7 +256,12 @@ class DeviceImageTy {
 struct GenericKernelTy {
   /// Construct a kernel with a name and a execution mode.
   GenericKernelTy(const char *Name)
-      : Name(Name), PreferredNumThreads(0), MaxNumThreads(0) {}
+      : Name(Name), PreferredNumThreads(0), MaxNumThreads(0) {
+    // Ensure that the name is null terminated so getName() can just return the
+    // pointer
+    this->Name.push_back('\0');
+    this->Name.pop_back();
----------------
jhuber6 wrote:

Honestly I'm not sure if we need to bother popping back the null terminator, we don't expose the size at all.

https://github.com/llvm/llvm-project/pull/142799


More information about the llvm-commits mailing list