[llvm] [Offload] Store kernel name in GenericKernelTy (PR #142799)
Ross Brunton via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 1 06:38:25 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();
----------------
RossBrunton wrote:
When SmallString copies it into its internal buffer, it only copies strlen bytes, which excludes the null terminator.
https://github.com/llvm/llvm-project/pull/142799
More information about the llvm-commits
mailing list