diff options
-rw-r--r-- | clang/examples/clang-interpreter/main.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/examples/clang-interpreter/main.cpp b/clang/examples/clang-interpreter/main.cpp index 6ac142bffdf..db6b0cce4fd 100644 --- a/clang/examples/clang-interpreter/main.cpp +++ b/clang/examples/clang-interpreter/main.cpp @@ -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) { |