[llvm] [Offload] Print Image location rather than casting it (PR #160309)

Ross Brunton via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 23 07:21:39 PDT 2025


https://github.com/RossBrunton created https://github.com/llvm/llvm-project/pull/160309

This squishes a warning where the runtime tries to bind a StringRef to
a `%p`.


>From 893325e6019d69ba01f2026702e0e8d964509ea6 Mon Sep 17 00:00:00 2001
From: Ross Brunton <bruntonross at protonmail.com>
Date: Tue, 23 Sep 2025 15:20:11 +0100
Subject: [PATCH] [Offload] Print Image location rather than casting it

This squishes a warning where the runtime tries to bind a StringRef to
a `%p`.
---
 offload/plugins-nextgen/common/src/PluginInterface.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/offload/plugins-nextgen/common/src/PluginInterface.cpp b/offload/plugins-nextgen/common/src/PluginInterface.cpp
index 30b5db782370d..53449d3fda992 100644
--- a/offload/plugins-nextgen/common/src/PluginInterface.cpp
+++ b/offload/plugins-nextgen/common/src/PluginInterface.cpp
@@ -1714,7 +1714,7 @@ int32_t GenericPluginTy::is_initialized() const { return Initialized; }
 int32_t GenericPluginTy::isPluginCompatible(StringRef Image) {
   auto HandleError = [&](Error Err) -> bool {
     [[maybe_unused]] std::string ErrStr = toString(std::move(Err));
-    DP("Failure to check validity of image %p: %s", Image, ErrStr.c_str());
+    DP("Failure to check validity of image %p: %s", Image.data(), ErrStr.c_str());
     return false;
   };
   switch (identify_magic(Image)) {
@@ -1742,7 +1742,7 @@ int32_t GenericPluginTy::isPluginCompatible(StringRef Image) {
 int32_t GenericPluginTy::isDeviceCompatible(int32_t DeviceId, StringRef Image) {
   auto HandleError = [&](Error Err) -> bool {
     [[maybe_unused]] std::string ErrStr = toString(std::move(Err));
-    DP("Failure to check validity of image %p: %s", Image, ErrStr.c_str());
+    DP("Failure to check validity of image %p: %s", Image.data(), ErrStr.c_str());
     return false;
   };
   switch (identify_magic(Image)) {



More information about the llvm-commits mailing list