ClangDriver.hpp
1 #pragma once
2 #include <JitCpp/JitPlatform.hpp>
3 #include <JitCpp/JitUtils.hpp>
4 
5 #include <clang/Frontend/TextDiagnosticBuffer.h>
6 
7 #include <optional>
8 #include <string>
9 #include <vector>
10 
11 namespace Jit
12 {
14 {
15 public:
16  ClangCC1Driver() = default;
17  ~ClangCC1Driver();
18 
19  static std::optional<QDir> bitcodeDatabase();
20 
21  llvm::Expected<std::unique_ptr<llvm::Module>> compileTranslationUnit(
22  const std::string& cppCode, const std::vector<std::string>& flags,
23  CompilerOptions opts, llvm::LLVMContext& context);
24 
25 private:
27  static std::vector<std::string> getClangCC1Args(CompilerOptions opts);
28 
30  static llvm::Error compileCppToBitcodeFile(const std::vector<std::string>& args);
31 
32  std::vector<std::function<void()>> m_deleters;
33 };
34 
35 }
Definition: ClangDriver.hpp:14
Definition: JitOptions.hpp:7