[Openmp-commits] [openmp] [OpenMP] Fix compile error caused by #74397 (PR #75419)

Shilei Tian via Openmp-commits openmp-commits at lists.llvm.org
Wed Dec 13 17:59:13 PST 2023


https://github.com/shiltian created https://github.com/llvm/llvm-project/pull/75419

This patch fixed the following compile error caused by #74397.

```
openmp/libomptarget/src/PluginManager.cpp: In static member function ‘static llvm::Expected<std::unique_ptr<PluginAdaptorTy> >
PluginAdaptorTy::create(const string&)’:
openmp/libomptarget/src/PluginManager.cpp:50:10: error: could not convert ‘PluginAdaptor’ from ‘std::unique_ptr<PluginAdaptorTy
>’ to ‘llvm::Expected<std::unique_ptr<PluginAdaptorTy> >’
   return PluginAdaptor;                                                                                                                                                                    ^~~~~~~~~~~~~
```


>From e88169b480ddae94a09726d6294b12e48b9cf728 Mon Sep 17 00:00:00 2001
From: Shilei Tian <i at tianshilei.me>
Date: Wed, 13 Dec 2023 20:57:48 -0500
Subject: [PATCH] [OpenMP] Fix compile error caused by #74397
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This patch fixed the following compile error caused by #74397.

```
openmp/libomptarget/src/PluginManager.cpp: In static member function ‘static llvm::Expected<std::unique_ptr<PluginAdaptorTy> >
PluginAdaptorTy::create(const string&)’:
openmp/libomptarget/src/PluginManager.cpp:50:10: error: could not convert ‘PluginAdaptor’ from ‘std::unique_ptr<PluginAdaptorTy
>’ to ‘llvm::Expected<std::unique_ptr<PluginAdaptorTy> >’
   return PluginAdaptor;                                                                                                                                                                    ^~~~~~~~~~~~~
```
---
 openmp/libomptarget/src/PluginManager.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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



More information about the Openmp-commits mailing list