From a24e11fd951d3396ccbb469b2c5dc707dc4196a6 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Tue, 2 Sep 2025 13:04:13 -0700 Subject: [clang] Delay checking of `-fopenmp-host-ir-file-path` (#150124) This PR is part of an effort to remove file system usage from the command line parsing code. The reason for that is that it's impossible to do file system access correctly without a configured VFS, and the VFS can only be configured after the command line is parsed. I don't want to intertwine command line parsing and VFS configuration, so I decided to perform the file system access after the command line is parsed and the VFS is configured - ideally right before the file system entity is used for the first time. This patch delays opening the OpenMP host IR file until codegen. --- clang/lib/CodeGen/CodeGenModule.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 323823c..f1ddaa8 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -582,6 +582,11 @@ void CodeGenModule::createOpenCLRuntime() { } void CodeGenModule::createOpenMPRuntime() { + if (!LangOpts.OMPHostIRFile.empty() && + !llvm::sys::fs::exists(LangOpts.OMPHostIRFile)) + Diags.Report(diag::err_omp_host_ir_file_not_found) + << LangOpts.OMPHostIRFile; + // Select a specialized code generation class based on the target, if any. // If it does not exist use the default implementation. switch (getTriple().getArch()) { -- cgit v1.1