const DataLayout &DL = getDataLayout();
auto &JD = ES.createJITDylib("main");
- JD.setGenerator(DynamicLibrarySearchGenerator::Load("/path/to/lib"
+ JD.addGenerator(DynamicLibrarySearchGenerator::Load("/path/to/lib"
DL.getGlobalPrefix()));
// IR added to JD can now link against all symbols exported by the library
// Use GetForCurrentProcess with a predicate function that checks the
// allowed list.
- JD.setGenerator(
+ JD.addGenerator(
DynamicLibrarySearchGenerator::GetForCurrentProcess(
DL.getGlobalPrefix(),
[&](const SymbolStringPtr &S) { return AllowList.count(S); }));
CompileLayer(ES, ObjectLayer, ConcurrentIRCompiler(std::move(JTMB))),
DL(std::move(DL)), Mangle(ES, this->DL),
Ctx(std::make_unique<LLVMContext>()) {
- ES.getMainJITDylib().setGenerator(
- cantFail(DynamicLibrarySearchGenerator::GetForCurrentProcess(DL)));
+ ES.getMainJITDylib().addGenerator(
+ cantFail(DynamicLibrarySearchGenerator::GetForCurrentProcess(DL.getGlobalPrefix())));
}
Our class begins with six member variables: An ExecutionSession member, ``ES``,
TransformLayer(ES, CompileLayer, optimizeModule),
DL(std::move(DL)), Mangle(ES, this->DL),
Ctx(std::make_unique<LLVMContext>()) {
- ES.getMainJITDylib().setGenerator(
- cantFail(DynamicLibrarySearchGenerator::GetForCurrentProcess(DL)));
+ ES.getMainJITDylib().addGenerator(
+ cantFail(DynamicLibrarySearchGenerator::GetForCurrentProcess(DL.getGlobalPrefix())));
}
Our extended KaleidoscopeJIT class starts out the same as it did in Chapter 1,