[clang] 0a4a43c - [OpenMP] Properly handle the `-f/-fno` veraints for the new driver
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 27 06:59:03 PDT 2022
Author: Joseph Huber
Date: 2022-04-27T09:58:55-04:00
New Revision: 0a4a43cf138b929b5280dbe4fcf5f219ca18ae43
URL: https://github.com/llvm/llvm-project/commit/0a4a43cf138b929b5280dbe4fcf5f219ca18ae43
DIFF: https://github.com/llvm/llvm-project/commit/0a4a43cf138b929b5280dbe4fcf5f219ca18ae43.diff
LOG: [OpenMP] Properly handle the `-f/-fno` veraints for the new driver
Summary:
We provide the `-f(no-)openmp-new-driver` option to allow users to use
the old or new driver. Previously this wasn't handled in the expected
way and only `-fno-openmp-new-driver` was checked. This patch fixes that
by using the `hasFlag` method as is standard.
Added:
Modified:
clang/lib/Driver/Driver.cpp
clang/lib/Driver/ToolChains/Clang.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 2bb6680cf596..487e2e1e0b3f 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -3984,7 +3984,8 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
bool UseNewOffloadingDriver =
C.isOffloadingHostKind(Action::OFK_OpenMP) &&
- !Args.hasArg(options::OPT_fno_openmp_new_driver);
+ Args.hasFlag(options::OPT_fopenmp_new_driver,
+ options::OPT_fno_openmp_new_driver, true);
for (auto &I : Inputs) {
types::ID InputType = I.first;
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 6e4eadd3ab0e..01380f9e1985 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -4675,7 +4675,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (IsUsingLTO) {
// Only AMDGPU supports device-side LTO.
if (IsDeviceOffloadAction &&
- Args.hasArg(options::OPT_fno_openmp_new_driver) &&
+ !Args.hasFlag(options::OPT_fopenmp_new_driver,
+ options::OPT_fno_openmp_new_driver, true) &&
!Triple.isAMDGPU()) {
D.Diag(diag::err_drv_unsupported_opt_for_target)
<< Args.getLastArg(options::OPT_foffload_lto,
More information about the cfe-commits
mailing list