Fix the clang interpreter example which was broken by 4fc68b9b7f.

This commit is contained in:
Lang Hames 2019-12-05 02:41:40 -08:00
parent 57f8a998ce
commit 41eeded804
1 changed files with 4 additions and 3 deletions

View File

@ -54,6 +54,7 @@ private:
std::unique_ptr<TargetMachine> TM;
const DataLayout DL;
MangleAndInterner Mangle{ES, DL};
JITDylib &MainJD{ES.createJITDylib("<main>")};
RTDyldObjectLinkingLayer ObjectLayer{ES, createMemMgr};
IRCompileLayer CompileLayer{ES, ObjectLayer, SimpleCompiler(*TM)};
@ -66,7 +67,7 @@ private:
std::unique_ptr<DynamicLibrarySearchGenerator> ProcessSymbolsGenerator)
: TM(std::move(TM)), DL(std::move(DL)) {
llvm::sys::DynamicLibrary::LoadLibraryPermanently(nullptr);
ES.getMainJITDylib().addGenerator(std::move(ProcessSymbolsGenerator));
MainJD.addGenerator(std::move(ProcessSymbolsGenerator));
}
public:
@ -95,11 +96,11 @@ public:
const TargetMachine &getTargetMachine() const { return *TM; }
Error addModule(ThreadSafeModule M) {
return CompileLayer.add(ES.getMainJITDylib(), std::move(M));
return CompileLayer.add(MainJD, std::move(M));
}
Expected<JITEvaluatedSymbol> findSymbol(const StringRef &Name) {
return ES.lookup({&ES.getMainJITDylib()}, Mangle(Name));
return ES.lookup({&MainJD}, Mangle(Name));
}
Expected<JITTargetAddress> getSymbolAddress(const StringRef &Name) {