aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorJan Svoboda <jan_svoboda@apple.com>2021-02-01 12:36:43 +0100
committerJan Svoboda <jan_svoboda@apple.com>2021-02-01 12:50:48 +0100
commiteefa8a9ff859153c510e740b33a9e721e42b88c5 (patch)
treecee85b2263d94db1e476cac95365a0b5b20c84cb /clang/lib/Frontend/CompilerInvocation.cpp
parent11e74e512d64ae2a2531156b6f0dde211b1ae19d (diff)
downloadllvm-eefa8a9ff859153c510e740b33a9e721e42b88c5.zip
llvm-eefa8a9ff859153c510e740b33a9e721e42b88c5.tar.gz
llvm-eefa8a9ff859153c510e740b33a9e721e42b88c5.tar.bz2
Revert "[clang][cli] Port OpenMP-related LangOpts to marshalling system"
This reverts commit 9ad94c12 It turns out that to correctly generate command line flags for LangOptions::OpenMP and LangOptions::OpenMPSimd, we need the flexibility of C++.
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index d602715ba..2f712ed 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -494,12 +494,6 @@ static void FixupInvocation(CompilerInvocation &Invocation,
<< A->getSpelling() << T.getTriple();
}
- // Report if OpenMP host file does not exist.
- if (!LangOpts.OMPHostIRFile.empty() &&
- !llvm::sys::fs::exists(LangOpts.OMPHostIRFile))
- Diags.Report(diag::err_drv_omp_host_ir_file_not_found)
- << LangOpts.OMPHostIRFile;
-
if (!CodeGenOpts.ProfileRemappingFile.empty() && CodeGenOpts.LegacyPassManager)
Diags.Report(diag::err_drv_argument_only_allowed_with)
<< Args.getLastArg(OPT_fprofile_remapping_file_EQ)->getAsString(Args)
@@ -2437,6 +2431,13 @@ void CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args,
bool IsSimdSpecified =
Args.hasFlag(options::OPT_fopenmp_simd, options::OPT_fno_openmp_simd,
/*Default=*/false);
+ Opts.OpenMPSimd = !Opts.OpenMP && IsSimdSpecified;
+ Opts.OpenMPUseTLS =
+ Opts.OpenMP && !Args.hasArg(options::OPT_fnoopenmp_use_tls);
+ Opts.OpenMPIsDevice =
+ Opts.OpenMP && Args.hasArg(options::OPT_fopenmp_is_device);
+ Opts.OpenMPIRBuilder =
+ Opts.OpenMP && Args.hasArg(options::OPT_fopenmp_enable_irbuilder);
bool IsTargetSpecified =
Opts.OpenMPIsDevice || Args.hasArg(options::OPT_fopenmp_targets_EQ);
@@ -2510,6 +2511,15 @@ void CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args,
}
}
+ // Get OpenMP host file path if any and report if a non existent file is
+ // found
+ if (Arg *A = Args.getLastArg(options::OPT_fopenmp_host_ir_file_path)) {
+ Opts.OMPHostIRFile = A->getValue();
+ if (!llvm::sys::fs::exists(Opts.OMPHostIRFile))
+ Diags.Report(diag::err_drv_omp_host_ir_file_not_found)
+ << Opts.OMPHostIRFile;
+ }
+
// Set CUDA mode for OpenMP target NVPTX/AMDGCN if specified in options
Opts.OpenMPCUDAMode = Opts.OpenMPIsDevice && (T.isNVPTX() || T.isAMDGCN()) &&
Args.hasArg(options::OPT_fopenmp_cuda_mode);