[llvm] f3e297d - Fix build with gcc 7.5 by adding a "redundant move"

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 18 07:22:22 PDT 2020


Author: Mehdi Amini
Date: 2020-03-18T14:22:10Z
New Revision: f3e297d90fc326758ba9043abcdb1d7c5fa0373d

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

LOG: Fix build with gcc 7.5 by adding a "redundant move"

The constructor of Expected<T> expects as T&&, but gcc-7.5 does not
infer an rvalue in this context apparently.

Added: 
    

Modified: 
    llvm/examples/OrcV2Examples/LLJITWithLazyReexports/LLJITWithLazyReexports.cpp
    llvm/examples/ThinLtoJIT/ThinLtoJIT.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/examples/OrcV2Examples/LLJITWithLazyReexports/LLJITWithLazyReexports.cpp b/llvm/examples/OrcV2Examples/LLJITWithLazyReexports/LLJITWithLazyReexports.cpp
index 99c3aead224e..b75d5610f9e6 100644
--- a/llvm/examples/OrcV2Examples/LLJITWithLazyReexports/LLJITWithLazyReexports.cpp
+++ b/llvm/examples/OrcV2Examples/LLJITWithLazyReexports/LLJITWithLazyReexports.cpp
@@ -107,7 +107,7 @@ int main(int argc, char *argv[]) {
       [](ThreadSafeModule TSM,
          const MaterializationResponsibility &R) -> Expected<ThreadSafeModule> {
         TSM.withModuleDo([](Module &M) { dbgs() << "---Compiling---\n" << M; });
-        return TSM;
+        return std::move(TSM); // Not a redundant move: fix build on gcc-7.5
       });
 
   // (3) Create stubs and call-through managers:

diff  --git a/llvm/examples/ThinLtoJIT/ThinLtoJIT.cpp b/llvm/examples/ThinLtoJIT/ThinLtoJIT.cpp
index 7442fbd3c0a5..6bd8f6144db1 100644
--- a/llvm/examples/ThinLtoJIT/ThinLtoJIT.cpp
+++ b/llvm/examples/ThinLtoJIT/ThinLtoJIT.cpp
@@ -191,7 +191,7 @@ Expected<ThreadSafeModule> ThinLtoJIT::setupMainModule(StringRef MainFunction) {
   }
 
   if (auto TSM = GlobalIndex->parseModuleFromFile(*M))
-    return TSM;
+    return std::move(TSM); // Not a redundant move: fix build on gcc-7.5
 
   return createStringError(inconvertibleErrorCode(),
                            "Failed to parse main module");


        


More information about the llvm-commits mailing list