Skip to content

Commit d457461

Browse files
committed
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
1 parent 09c4df1 commit d457461

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tools/lli/OrcLazyJIT.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@
1515
#ifndef LLVM_TOOLS_LLI_ORCLAZYJIT_H
1616
#define LLVM_TOOLS_LLI_ORCLAZYJIT_H
1717

18+
#include "llvm/ADT/Optional.h"
1819
#include "llvm/ADT/STLExtras.h"
1920
#include "llvm/ADT/Twine.h"
2021
#include "llvm/ExecutionEngine/JITSymbol.h"
2122
#include "llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h"
2223
#include "llvm/ExecutionEngine/Orc/CompileUtils.h"
2324
#include "llvm/ExecutionEngine/Orc/ExecutionUtils.h"
24-
#include "llvm/ExecutionEngine/Orc/IndirectionUtils.h"
2525
#include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
2626
#include "llvm/ExecutionEngine/Orc/IRTransformLayer.h"
27+
#include "llvm/ExecutionEngine/Orc/IndirectionUtils.h"
2728
#include "llvm/ExecutionEngine/Orc/LambdaResolver.h"
2829
#include "llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h"
2930
#include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
@@ -112,7 +113,7 @@ class OrcLazyJIT {
112113
// 1) Search the JIT symbols.
113114
// 2) Check for C++ runtime overrides.
114115
// 3) Search the host process (LLI)'s symbol table.
115-
if (ModulesHandle == CODLayerT::ModuleHandleT()) {
116+
if (!ModulesHandle) {
116117
auto Resolver =
117118
orc::createLambdaResolver(
118119
[this](const std::string &Name) -> JITSymbol {
@@ -135,19 +136,18 @@ class OrcLazyJIT {
135136
else
136137
return ModulesHandleOrErr.takeError();
137138

138-
} else
139-
if (auto Err = CODLayer.addExtraModule(ModulesHandle, std::move(M)))
140-
return Err;
139+
} else if (auto Err = CODLayer.addExtraModule(*ModulesHandle, std::move(M)))
140+
return Err;
141141

142142
// Run the static constructors, and save the static destructor runner for
143143
// execution when the JIT is torn down.
144144
orc::CtorDtorRunner<CODLayerT> CtorRunner(std::move(CtorNames),
145-
ModulesHandle);
145+
*ModulesHandle);
146146
if (auto Err = CtorRunner.runViaLayer(CODLayer))
147147
return Err;
148148

149149
IRStaticDestructorRunners.emplace_back(std::move(DtorNames),
150-
ModulesHandle);
150+
*ModulesHandle);
151151

152152
return Error::success();
153153
}
@@ -190,7 +190,7 @@ class OrcLazyJIT {
190190

191191
orc::LocalCXXRuntimeOverrides CXXRuntimeOverrides;
192192
std::vector<orc::CtorDtorRunner<CODLayerT>> IRStaticDestructorRunners;
193-
CODLayerT::ModuleHandleT ModulesHandle;
193+
llvm::Optional<CODLayerT::ModuleHandleT> ModulesHandle;
194194
};
195195

196196
int runOrcLazyJIT(std::vector<std::unique_ptr<Module>> Ms,

0 commit comments

Comments
 (0)