[clang] 41eeded - Fix the clang interpreter example which was broken by 4fc68b9b7f3e0.

Lang Hames via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 5 02:43:37 PST 2019


Author: Lang Hames
Date: 2019-12-05T02:42:35-08:00
New Revision: 41eeded804310df0719ecbc92a0e14b438213dbf

URL: https://github.com/llvm/llvm-project/commit/41eeded804310df0719ecbc92a0e14b438213dbf
DIFF: https://github.com/llvm/llvm-project/commit/41eeded804310df0719ecbc92a0e14b438213dbf.diff

LOG: Fix the clang interpreter example which was broken by 4fc68b9b7f3e0.

Added: 
    

Modified: 
    clang/examples/clang-interpreter/main.cpp

Removed: 
    


################################################################################
diff  --git a/clang/examples/clang-interpreter/main.cpp b/clang/examples/clang-interpreter/main.cpp
index 6ac142bffdff..db6b0cce4fd1 100644
--- a/clang/examples/clang-interpreter/main.cpp
+++ b/clang/examples/clang-interpreter/main.cpp
@@ -54,6 +54,7 @@ class SimpleJIT {
   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 @@ class SimpleJIT {
       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 @@ class SimpleJIT {
   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) {


        


More information about the cfe-commits mailing list