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

Ross Brunton via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 2 03:24:39 PDT 2025


================
@@ -296,7 +296,13 @@ 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, &Name[strlen(Name) + 1]), PreferredNumThreads(0),
+        MaxNumThreads(0) {
+    // The null terminator from the input string was also copied to ensure that
+    // Name.data() will always be null terminated. Pop the last character to
+    // ensure that Name.size is accurate.
+    this->Name.pop_back();
+  }
----------------
RossBrunton wrote:

It does, and that's clearer. Thanks.

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


More information about the llvm-commits mailing list