[llvm] [Offload] Store kernel name in GenericKernelTy (PR #142799)
Joseph Huber via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 2 05:50:58 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:
For that I'd just make a variant that returns a string ref with the correct size, if it's a private variable it's reasonable to hide some details from users. You can use a `std::string` if you want, up to you.
https://github.com/llvm/llvm-project/pull/142799
More information about the llvm-commits
mailing list