[llvm] [OpenMP][NFC] Use temporary instead of local to take advantage of move semantics (PR #138582)

via llvm-commits llvm-commits at lists.llvm.org
Mon May 5 13:44:35 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-openmp

Author: Shafik Yaghmour (shafik)

<details>
<summary>Changes</summary>

Static analysis flagged `MapnamesName` because we could move it into `createOffloadMapnames`. I just replaced the local with a direct call to `createPlatformSpecificName` at the function argument location.

---
Full diff: https://github.com/llvm/llvm-project/pull/138582.diff


1 Files Affected:

- (modified) llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp (+2-3) 


``````````diff
diff --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
index be05f01c94603..468a4da9ac13a 100644
--- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -8397,9 +8397,8 @@ Error OpenMPIRBuilder::emitOffloadingArrays(
 
   // The information types are only built if provided.
   if (!CombinedInfo.Names.empty()) {
-    std::string MapnamesName = createPlatformSpecificName({"offload_mapnames"});
-    auto *MapNamesArrayGbl =
-        createOffloadMapnames(CombinedInfo.Names, MapnamesName);
+    auto *MapNamesArrayGbl = createOffloadMapnames(
+        CombinedInfo.Names, createPlatformSpecificName({"offload_mapnames"}));
     Info.RTArgs.MapNamesArray = MapNamesArrayGbl;
     Info.EmitDebug = true;
   } else {

``````````

</details>


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


More information about the llvm-commits mailing list