[libcxx-commits] [lld] [libc] [clang-tools-extra] [clang] [lldb] [llvm] [libcxx] [compiler-rt] [openmp] [flang] Gcc 75 libomptarget type convert (PR #75562)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Dec 14 22:04:29 PST 2023


https://github.com/SunilKuravinakop created https://github.com/llvm/llvm-project/pull/75562

When building with gcc-7.5 we get the error:
`nochange/openmp/libomptarget/src/PluginManager.cpp: In static member function 'static llvm::Expected<std::unique_ptr<PluginAdaptorTy> > PluginAdaptorTy::create(const string&)':
`
To overcome this an std::move has been added to convert from 
`std::unique_ptr<PluginAdaptorTy> to Expected<std::unique_ptr<PluginAdaptorTy>>`
This problem does not occur in higher versions of the compiler like gcc-12.2

>From 07d34ffbeff6563839695bf5c374b75cf3fe3d6d Mon Sep 17 00:00:00 2001
From: Sunil Kuravinakop <kuravina at pe28vega.us.cray.com>
Date: Thu, 14 Dec 2023 04:09:12 -0600
Subject: [PATCH] Adding an std::move to convert from
 std::unique_ptr<PluginAdaptorTy> to
 Expected<std::unique_ptr<PluginAdaptorTy>>.   Changes to be committed:  
 modified:   openmp/libomptarget/src/PluginManager.cpp

---
 openmp/libomptarget/src/PluginManager.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/openmp/libomptarget/src/PluginManager.cpp b/openmp/libomptarget/src/PluginManager.cpp
index 17787284441c55..c336eac7ab22f8 100644
--- a/openmp/libomptarget/src/PluginManager.cpp
+++ b/openmp/libomptarget/src/PluginManager.cpp
@@ -47,7 +47,9 @@ PluginAdaptorTy::create(const std::string &Name) {
       new PluginAdaptorTy(Name, std::move(LibraryHandler)));
   if (auto Err = PluginAdaptor->init())
     return Err;
-  return PluginAdaptor;
+  Expected<std::unique_ptr<PluginAdaptorTy>> ExpPluginAdaptor(
+      std::move(PluginAdaptor));
+  return ExpPluginAdaptor;
 }
 
 PluginAdaptorTy::PluginAdaptorTy(const std::string &Name,



More information about the libcxx-commits mailing list