Skip to content

Commit 0a4a43c

Browse files
committed
[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.
1 parent fd90261 commit 0a4a43c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3984,7 +3984,8 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
39843984

39853985
bool UseNewOffloadingDriver =
39863986
C.isOffloadingHostKind(Action::OFK_OpenMP) &&
3987-
!Args.hasArg(options::OPT_fno_openmp_new_driver);
3987+
Args.hasFlag(options::OPT_fopenmp_new_driver,
3988+
options::OPT_fno_openmp_new_driver, true);
39883989

39893990
for (auto &I : Inputs) {
39903991
types::ID InputType = I.first;

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4675,7 +4675,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
46754675
if (IsUsingLTO) {
46764676
// Only AMDGPU supports device-side LTO.
46774677
if (IsDeviceOffloadAction &&
4678-
Args.hasArg(options::OPT_fno_openmp_new_driver) &&
4678+
!Args.hasFlag(options::OPT_fopenmp_new_driver,
4679+
options::OPT_fno_openmp_new_driver, true) &&
46794680
!Triple.isAMDGPU()) {
46804681
D.Diag(diag::err_drv_unsupported_opt_for_target)
46814682
<< Args.getLastArg(options::OPT_foffload_lto,

0 commit comments

Comments
 (0)