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

via llvm-commits llvm-commits at lists.llvm.org
Tue May 6 10:29:49 PDT 2025


Author: Shafik Yaghmour
Date: 2025-05-06T10:29:45-07:00
New Revision: c956ed06dc1c1b340d0c589c472c438b9220b36d

URL: https://github.com/llvm/llvm-project/commit/c956ed06dc1c1b340d0c589c472c438b9220b36d
DIFF: https://github.com/llvm/llvm-project/commit/c956ed06dc1c1b340d0c589c472c438b9220b36d.diff

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

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.

Added: 
    

Modified: 
    llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
index 6126cd4403b69..7c1b64677a011 100644
--- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -8378,9 +8378,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 {


        


More information about the llvm-commits mailing list