================
@@ -81,6 +99,40 @@ static llvm::cl::opt<bool> 
OptHostSupportsJit("host-supports-jit",
 static llvm::cl::list<std::string> OptInputs(llvm::cl::Positional,
                                              llvm::cl::desc("[code to run]"));
 
+static std::string getCompilerRTPath() {
+  clang::DiagnosticOptions DiagOpts;
+  llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs> DiagID(
+      new clang::DiagnosticIDs());
+
+  clang::IgnoringDiagConsumer DiagConsumer;
+  clang::DiagnosticsEngine Diags(DiagID, DiagOpts, &DiagConsumer, false);
+  std::vector<const char *> Args = {"clang", "--version"};
+  clang::driver::Driver D("clang", llvm::sys::getProcessTriple(), Diags);
+  D.setCheckInputsExist(false);
+
+  std::unique_ptr<clang::driver::Compilation> C(D.BuildCompilation(Args));
+  if (!C) {
+    return "";
+  }
+
+  const clang::driver::ToolChain &TC = C->getDefaultToolChain();
+  std::optional<std::string> CompilerRTPath = TC.getCompilerRTPath();
+
+  return CompilerRTPath ? *CompilerRTPath : "";
+}
+
+static std::string getOrcRuntimePath() {
----------------
vgvassilev wrote:

Let's sink that logic in `IncrementalCompilerBuilder::create`. That would 
simplify things.

https://github.com/llvm/llvm-project/pull/155140
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to