Skip to content

Commit

Permalink
[flang][nfc] Simplify option forwarding
Browse files Browse the repository at this point in the history
Use `AddAllArgs` to keep the implementation succinct. Also adds missing
'-flang-experimental-hlfir` in "frontend-forwarding.f90"

Differential Revision: https://reviews.llvm.org/D156524
  • Loading branch information
banach-space committed Jul 28, 2023
1 parent cdfb3d9 commit e88ff8a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 3 additions & 4 deletions clang/lib/Driver/ToolChains/Flang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,11 @@ void Flang::addCodegenOptions(const ArgList &Args,
!stackArrays->getOption().matches(options::OPT_fno_stack_arrays))
CmdArgs.push_back("-fstack-arrays");

if (Args.hasArg(options::OPT_flang_experimental_hlfir))
CmdArgs.push_back("-flang-experimental-hlfir");
if (Args.hasArg(options::OPT_flang_experimental_polymorphism))
CmdArgs.push_back("-flang-experimental-polymorphism");
if (shouldLoopVersion(Args))
CmdArgs.push_back("-fversion-loops-for-stride");

Args.AddAllArgs(CmdArgs, {options::OPT_flang_experimental_hlfir,
options::OPT_flang_experimental_polymorphism});
}

void Flang::addPicOptions(const ArgList &Args, ArgStringList &CmdArgs) const {
Expand Down
4 changes: 3 additions & 1 deletion flang/test/Driver/frontend-forwarding.f90
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
! RUN: -fpass-plugin=Bye%pluginext \
! RUN: -fversion-loops-for-stride \
! RUN: -flang-experimental-polymorphism \
! RUN: -flang-experimental-hlfir \
! RUN: -mllvm -print-before-all \
! RUN: -save-temps=obj \
! RUN: -P \
Expand All @@ -36,7 +37,8 @@
! CHECK: "-freciprocal-math"
! CHECK: "-fconvert=little-endian"
! CHECK: "-fpass-plugin=Bye
! CHECK: "-flang-experimental-polymorphism"
! CHECK: "-fversion-loops-for-stride"
! CHECK: "-flang-experimental-polymorphism"
! CHECK: "-flang-experimental-hlfir"
! CHECK: "-mllvm" "-print-before-all"
! CHECK: "-save-temps=obj"

0 comments on commit e88ff8a

Please sign in to comment.