mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 04:36:07 +00:00
[ORC][MachO] Remove the ExecutionSession& argument to MachOPlatform::Create.
We can get a reference to the ExecutionSession from the ObjectLinkingLayer argument, so there's no need to pass it in separately.
This commit is contained in:
parent
6fbbe152fa
commit
c6d6da4659
@ -133,17 +133,16 @@ public:
|
||||
/// RuntimeAliases function, in which case the client is responsible for
|
||||
/// setting up all aliases (including the required ones).
|
||||
static Expected<std::unique_ptr<MachOPlatform>>
|
||||
Create(ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
|
||||
JITDylib &PlatformJD, std::unique_ptr<DefinitionGenerator> OrcRuntime,
|
||||
Create(ObjectLinkingLayer &ObjLinkingLayer, JITDylib &PlatformJD,
|
||||
std::unique_ptr<DefinitionGenerator> OrcRuntime,
|
||||
HeaderOptions PlatformJDOpts = {},
|
||||
MachOHeaderMUBuilder BuildMachOHeaderMU = buildSimpleMachOHeaderMU,
|
||||
std::optional<SymbolAliasMap> RuntimeAliases = std::nullopt);
|
||||
|
||||
/// Construct using a path to the ORC runtime.
|
||||
static Expected<std::unique_ptr<MachOPlatform>>
|
||||
Create(ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
|
||||
JITDylib &PlatformJD, const char *OrcRuntimePath,
|
||||
HeaderOptions PlatformJDOpts = {},
|
||||
Create(ObjectLinkingLayer &ObjLinkingLayer, JITDylib &PlatformJD,
|
||||
const char *OrcRuntimePath, HeaderOptions PlatformJDOpts = {},
|
||||
MachOHeaderMUBuilder BuildMachOHeaderMU = buildSimpleMachOHeaderMU,
|
||||
std::optional<SymbolAliasMap> RuntimeAliases = std::nullopt);
|
||||
|
||||
|
@ -1198,8 +1198,8 @@ Expected<JITDylibSP> ExecutorNativePlatform::operator()(LLJIT &J) {
|
||||
if (!G)
|
||||
return G.takeError();
|
||||
|
||||
if (auto P = MachOPlatform::Create(ES, *ObjLinkingLayer, PlatformJD,
|
||||
std::move(*G)))
|
||||
if (auto P =
|
||||
MachOPlatform::Create(*ObjLinkingLayer, PlatformJD, std::move(*G)))
|
||||
ES.setPlatform(std::move(*P));
|
||||
else
|
||||
return P.takeError();
|
||||
|
@ -291,11 +291,14 @@ MachOPlatform::HeaderOptions::BuildVersionOpts::fromTriple(const Triple &TT,
|
||||
return MachOPlatform::HeaderOptions::BuildVersionOpts{Platform, MinOS, SDK};
|
||||
}
|
||||
|
||||
Expected<std::unique_ptr<MachOPlatform>> MachOPlatform::Create(
|
||||
ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
|
||||
JITDylib &PlatformJD, std::unique_ptr<DefinitionGenerator> OrcRuntime,
|
||||
HeaderOptions PlatformJDOpts, MachOHeaderMUBuilder BuildMachOHeaderMU,
|
||||
std::optional<SymbolAliasMap> RuntimeAliases) {
|
||||
Expected<std::unique_ptr<MachOPlatform>>
|
||||
MachOPlatform::Create(ObjectLinkingLayer &ObjLinkingLayer, JITDylib &PlatformJD,
|
||||
std::unique_ptr<DefinitionGenerator> OrcRuntime,
|
||||
HeaderOptions PlatformJDOpts,
|
||||
MachOHeaderMUBuilder BuildMachOHeaderMU,
|
||||
std::optional<SymbolAliasMap> RuntimeAliases) {
|
||||
|
||||
auto &ES = ObjLinkingLayer.getExecutionSession();
|
||||
|
||||
// If the target is not supported then bail out immediately.
|
||||
if (!supportedTarget(ES.getTargetTriple()))
|
||||
@ -334,9 +337,8 @@ Expected<std::unique_ptr<MachOPlatform>> MachOPlatform::Create(
|
||||
}
|
||||
|
||||
Expected<std::unique_ptr<MachOPlatform>>
|
||||
MachOPlatform::Create(ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
|
||||
JITDylib &PlatformJD, const char *OrcRuntimePath,
|
||||
HeaderOptions PlatformJDOpts,
|
||||
MachOPlatform::Create(ObjectLinkingLayer &ObjLinkingLayer, JITDylib &PlatformJD,
|
||||
const char *OrcRuntimePath, HeaderOptions PlatformJDOpts,
|
||||
MachOHeaderMUBuilder BuildMachOHeaderMU,
|
||||
std::optional<SymbolAliasMap> RuntimeAliases) {
|
||||
|
||||
@ -346,7 +348,7 @@ MachOPlatform::Create(ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
|
||||
if (!OrcRuntimeArchiveGenerator)
|
||||
return OrcRuntimeArchiveGenerator.takeError();
|
||||
|
||||
return Create(ES, ObjLinkingLayer, PlatformJD,
|
||||
return Create(ObjLinkingLayer, PlatformJD,
|
||||
std::move(*OrcRuntimeArchiveGenerator),
|
||||
std::move(PlatformJDOpts), std::move(BuildMachOHeaderMU),
|
||||
std::move(RuntimeAliases));
|
||||
|
@ -1033,8 +1033,8 @@ Session::Session(std::unique_ptr<ExecutorProcessControl> EPC, Error &Err)
|
||||
PlatformJD->addToLinkOrder(*ProcessSymsJD);
|
||||
|
||||
if (TT.isOSBinFormatMachO()) {
|
||||
if (auto P = MachOPlatform::Create(ES, ObjLayer, *PlatformJD,
|
||||
OrcRuntime.c_str()))
|
||||
if (auto P =
|
||||
MachOPlatform::Create(ObjLayer, *PlatformJD, OrcRuntime.c_str()))
|
||||
ES.setPlatform(std::move(*P));
|
||||
else {
|
||||
Err = P.takeError();
|
||||
|
Loading…
x
Reference in New Issue
Block a user