[llvm] r310729 - Orc: PR33769: Don't rely on comparisons with default constructed iterators
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 11 09:38:28 PDT 2017
Author: dblaikie
Date: Fri Aug 11 09:38:28 2017
New Revision: 310729
URL: http://llvm.org/viewvc/llvm-project?rev=310729&view=rev
Log:
Orc: PR33769: Don't rely on comparisons with default constructed iterators
Modified:
llvm/trunk/tools/lli/OrcLazyJIT.h
Modified: llvm/trunk/tools/lli/OrcLazyJIT.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/OrcLazyJIT.h?rev=310729&r1=310728&r2=310729&view=diff
==============================================================================
--- llvm/trunk/tools/lli/OrcLazyJIT.h (original)
+++ llvm/trunk/tools/lli/OrcLazyJIT.h Fri Aug 11 09:38:28 2017
@@ -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<CODLayerT> 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<orc::CtorDtorRunner<CODLayerT>> IRStaticDestructorRunners;
- CODLayerT::ModuleHandleT ModulesHandle;
+ llvm::Optional<CODLayerT::ModuleHandleT> ModulesHandle;
};
int runOrcLazyJIT(std::vector<std::unique_ptr<Module>> Ms,
More information about the llvm-commits
mailing list