From d457461f848a01aa6ed540fd1f60d045286b676c Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Fri, 11 Aug 2017 16:38:28 +0000 Subject: [PATCH] Orc: PR33769: Don't rely on comparisons with default constructed iterators git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310729 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/lli/OrcLazyJIT.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/lli/OrcLazyJIT.h b/tools/lli/OrcLazyJIT.h index 47a2acc4d7e..6a1a7cc055c 100644 --- a/tools/lli/OrcLazyJIT.h +++ b/tools/lli/OrcLazyJIT.h @@ -15,15 +15,16 @@ #ifndef LLVM_TOOLS_LLI_ORCLAZYJIT_H #define LLVM_TOOLS_LLI_ORCLAZYJIT_H +#include "llvm/ADT/Optional.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/Twine.h" #include "llvm/ExecutionEngine/JITSymbol.h" #include "llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h" #include "llvm/ExecutionEngine/Orc/CompileUtils.h" #include "llvm/ExecutionEngine/Orc/ExecutionUtils.h" -#include "llvm/ExecutionEngine/Orc/IndirectionUtils.h" #include "llvm/ExecutionEngine/Orc/IRCompileLayer.h" #include "llvm/ExecutionEngine/Orc/IRTransformLayer.h" +#include "llvm/ExecutionEngine/Orc/IndirectionUtils.h" #include "llvm/ExecutionEngine/Orc/LambdaResolver.h" #include "llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h" #include "llvm/ExecutionEngine/RTDyldMemoryManager.h" @@ -112,7 +113,7 @@ public: // 1) Search the JIT symbols. // 2) Check for C++ runtime overrides. // 3) Search the host process (LLI)'s symbol table. - if (ModulesHandle == CODLayerT::ModuleHandleT()) { + if (!ModulesHandle) { auto Resolver = orc::createLambdaResolver( [this](const std::string &Name) -> JITSymbol { @@ -135,19 +136,18 @@ public: else return ModulesHandleOrErr.takeError(); - } else - if (auto Err = CODLayer.addExtraModule(ModulesHandle, std::move(M))) - return Err; + } else if (auto Err = CODLayer.addExtraModule(*ModulesHandle, std::move(M))) + return Err; // Run the static constructors, and save the static destructor runner for // execution when the JIT is torn down. orc::CtorDtorRunner CtorRunner(std::move(CtorNames), - ModulesHandle); + *ModulesHandle); if (auto Err = CtorRunner.runViaLayer(CODLayer)) return Err; IRStaticDestructorRunners.emplace_back(std::move(DtorNames), - ModulesHandle); + *ModulesHandle); return Error::success(); } @@ -190,7 +190,7 @@ private: orc::LocalCXXRuntimeOverrides CXXRuntimeOverrides; std::vector> IRStaticDestructorRunners; - CODLayerT::ModuleHandleT ModulesHandle; + llvm::Optional ModulesHandle; }; int runOrcLazyJIT(std::vector> Ms, -- 2.50.1