2 #include <JitCpp/ClangDriver.hpp>
6 #include <llvm/ExecutionEngine/Orc/ExecutionUtils.h>
7 #include <llvm/ExecutionEngine/Orc/LLJIT.h>
8 #include <llvm/ExecutionEngine/Orc/ThreadSafeModule.h>
14 using ModulePtr_t = std::unique_ptr<llvm::Module>;
21 const std::string& cppCode,
const std::vector<std::string>& flags,
24 template <
class Signature_t>
25 llvm::Expected<std::function<Signature_t>> getFunction(std::string name)
29 auto EntrySym = JIT.lookup(name);
31 return EntrySym.takeError();
34 #if LLVM_VERSION_MAJOR <= 14
35 auto* Entry = (Signature_t*)EntrySym->getAddress();
37 auto* Entry = (Signature_t*)(*EntrySym).getValue();
39 return std::function<Signature_t>(Entry);
42 const QString& errors()
const noexcept
49 std::unique_ptr<llvm::orc::LLJIT> m_jit;
51 llvm::orc::MangleAndInterner m_mangler;
52 llvm::orc::LocalCXXRuntimeOverrides m_overrides;
Definition: ClangDriver.hpp:14
Definition: Compiler.hpp:13
Definition: JitOptions.hpp:7