[clang] Fix Twine usage (PR #90728)

via cfe-commits cfe-commits at lists.llvm.org
Wed May 1 05:59:15 PDT 2024


https://github.com/MagentaTreehouse updated https://github.com/llvm/llvm-project/pull/90728

>From 7591c8fb13cfa4a6f4a48f234564e221ed1d4689 Mon Sep 17 00:00:00 2001
From: Mingyi Chen <cmingyi01 at gmail.com>
Date: Wed, 1 May 2024 08:10:27 -0400
Subject: [PATCH 1/3] Fix Twine usage

---
 clang/lib/Driver/ToolChains/HIPUtility.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/HIPUtility.cpp b/clang/lib/Driver/ToolChains/HIPUtility.cpp
index 08c647dfcb6f72..e696d43bb3211b 100644
--- a/clang/lib/Driver/ToolChains/HIPUtility.cpp
+++ b/clang/lib/Driver/ToolChains/HIPUtility.cpp
@@ -106,9 +106,8 @@ class HIPUndefinedFatBinSymbols {
         std::string ID = IA->getId().str();
         if (!ID.empty()) {
           ID = llvm::utohexstr(llvm::MD5Hash(ID), /*LowerCase=*/true);
-          FatBinSymbols.insert(Twine(FatBinPrefix + "_" + ID).str());
-          GPUBinHandleSymbols.insert(
-              Twine(GPUBinHandlePrefix + "_" + ID).str());
+          FatBinSymbols.insert((Twine(FatBinPrefix) + '_' + ID).str());
+          GPUBinHandleSymbols.insert((Twine(GPUBinHandlePrefix) + '_' + ID).str());
           continue;
         }
         if (IA->getInputArg().getNumValues() == 0)

>From cba0d5735350668edb912e3c35507ca4bf1e90d3 Mon Sep 17 00:00:00 2001
From: Mingyi Chen <cmingyi01 at gmail.com>
Date: Wed, 1 May 2024 08:33:39 -0400
Subject: [PATCH 2/3] Fix formatting

---
 clang/lib/Driver/ToolChains/HIPUtility.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/HIPUtility.cpp b/clang/lib/Driver/ToolChains/HIPUtility.cpp
index e696d43bb3211b..e535b9f2f3502b 100644
--- a/clang/lib/Driver/ToolChains/HIPUtility.cpp
+++ b/clang/lib/Driver/ToolChains/HIPUtility.cpp
@@ -107,7 +107,8 @@ class HIPUndefinedFatBinSymbols {
         if (!ID.empty()) {
           ID = llvm::utohexstr(llvm::MD5Hash(ID), /*LowerCase=*/true);
           FatBinSymbols.insert((Twine(FatBinPrefix) + '_' + ID).str());
-          GPUBinHandleSymbols.insert((Twine(GPUBinHandlePrefix) + '_' + ID).str());
+          GPUBinHandleSymbols.insert(
+              (Twine(GPUBinHandlePrefix) + '_' + ID).str());
           continue;
         }
         if (IA->getInputArg().getNumValues() == 0)

>From 7c66c539cfd5cab79499cc397e54ce7ff0559e37 Mon Sep 17 00:00:00 2001
From: Mingyi Chen <cmingyi01 at gmail.com>
Date: Wed, 1 May 2024 08:49:35 -0400
Subject: [PATCH 3/3] Explicitly construct from char

---
 clang/lib/Driver/ToolChains/HIPUtility.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/HIPUtility.cpp b/clang/lib/Driver/ToolChains/HIPUtility.cpp
index e535b9f2f3502b..0a1783835bb1b0 100644
--- a/clang/lib/Driver/ToolChains/HIPUtility.cpp
+++ b/clang/lib/Driver/ToolChains/HIPUtility.cpp
@@ -106,9 +106,9 @@ class HIPUndefinedFatBinSymbols {
         std::string ID = IA->getId().str();
         if (!ID.empty()) {
           ID = llvm::utohexstr(llvm::MD5Hash(ID), /*LowerCase=*/true);
-          FatBinSymbols.insert((Twine(FatBinPrefix) + '_' + ID).str());
+          FatBinSymbols.insert((FatBinPrefix + Twine('_') + ID).str());
           GPUBinHandleSymbols.insert(
-              (Twine(GPUBinHandlePrefix) + '_' + ID).str());
+              (GPUBinHandlePrefix + Twine('_') + ID).str());
           continue;
         }
         if (IA->getInputArg().getNumValues() == 0)



More information about the cfe-commits mailing list