aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorJan Svoboda <jan_svoboda@apple.com>2025-09-02 13:04:13 -0700
committerGitHub <noreply@github.com>2025-09-02 13:04:13 -0700
commita24e11fd951d3396ccbb469b2c5dc707dc4196a6 (patch)
tree37bb9ca7a91eb22977d5282ab8d3cbe265159b25 /clang/lib/CodeGen/CodeGenModule.cpp
parent1a4d0c6dfe9d717215890650a42a53d4ec9bfd8f (diff)
downloadllvm-a24e11fd951d3396ccbb469b2c5dc707dc4196a6.zip
llvm-a24e11fd951d3396ccbb469b2c5dc707dc4196a6.tar.gz
llvm-a24e11fd951d3396ccbb469b2c5dc707dc4196a6.tar.bz2
[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.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp5
1 files changed, 5 insertions, 0 deletions
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()) {