From 174e954e370e4f2ae82fea3f959e843bc05e3046 Mon Sep 17 00:00:00 2001 From: Andrzej Warzynski Date: Fri, 14 Oct 2022 16:12:44 +0000 Subject: [PATCH] [flang][nfc] Rename `AddOtherOptions` as `ForwardOptions` The updated name better reflects what this hook is intended for. Reviewed By: tarunprabhu Differential Revision: https://reviews.llvm.org/D130078 --- clang/lib/Driver/ToolChains/Flang.cpp | 14 +++++++------- clang/lib/Driver/ToolChains/Flang.h | 11 +++++------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Flang.cpp b/clang/lib/Driver/ToolChains/Flang.cpp index d7ac459..964f0e2 100644 --- a/clang/lib/Driver/ToolChains/Flang.cpp +++ b/clang/lib/Driver/ToolChains/Flang.cpp @@ -27,7 +27,7 @@ static void addDashXForInput(const ArgList &Args, const InputInfo &Input, CmdArgs.push_back(types::getTypeName(Input.getType())); } -void Flang::AddFortranDialectOptions(const ArgList &Args, +void Flang::addFortranDialectOptions(const ArgList &Args, ArgStringList &CmdArgs) const { Args.AddAllArgs( CmdArgs, {options::OPT_ffixed_form, options::OPT_ffree_form, @@ -44,14 +44,14 @@ void Flang::AddFortranDialectOptions(const ArgList &Args, options::OPT_fno_automatic}); } -void Flang::AddPreprocessingOptions(const ArgList &Args, +void Flang::addPreprocessingOptions(const ArgList &Args, ArgStringList &CmdArgs) const { Args.AddAllArgs(CmdArgs, {options::OPT_P, options::OPT_D, options::OPT_U, options::OPT_I, options::OPT_cpp, options::OPT_nocpp}); } -void Flang::AddOtherOptions(const ArgList &Args, ArgStringList &CmdArgs) const { +void Flang::forwardOptions(const ArgList &Args, ArgStringList &CmdArgs) const { Args.AddAllArgs(CmdArgs, {options::OPT_module_dir, options::OPT_fdebug_module_writer, options::OPT_fintrinsic_modules_path, options::OPT_pedantic, @@ -127,9 +127,9 @@ void Flang::ConstructJob(Compilation &C, const JobAction &JA, // Add preprocessing options like -I, -D, etc. if we are using the // preprocessor (i.e. skip when dealing with e.g. binary files). if (types::getPreprocessedType(InputType) != types::TY_INVALID) - AddPreprocessingOptions(Args, CmdArgs); + addPreprocessingOptions(Args, CmdArgs); - AddFortranDialectOptions(Args, CmdArgs); + addFortranDialectOptions(Args, CmdArgs); // Color diagnostics are parsed by the driver directly from argv and later // re-parsed to construct this job; claim any possible color diagnostic here @@ -142,8 +142,8 @@ void Flang::ConstructJob(Compilation &C, const JobAction &JA, // -fPIC and related options. AddPicOptions(Args, CmdArgs); - // Add other compile options - AddOtherOptions(Args, CmdArgs); + // Handle options which are simply forwarded to -fc1. + forwardOptions(Args, CmdArgs); // Forward -Xflang arguments to -fc1 Args.AddAllArgValues(CmdArgs, options::OPT_Xflang); diff --git a/clang/lib/Driver/ToolChains/Flang.h b/clang/lib/Driver/ToolChains/Flang.h index c5ac147..4d8e2e8 100644 --- a/clang/lib/Driver/ToolChains/Flang.h +++ b/clang/lib/Driver/ToolChains/Flang.h @@ -29,7 +29,7 @@ private: /// /// \param [in] Args The list of input driver arguments /// \param [out] CmdArgs The list of output command arguments - void AddFortranDialectOptions(const llvm::opt::ArgList &Args, + void addFortranDialectOptions(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const; /// Extract preprocessing options from the driver arguments and add them to @@ -37,7 +37,7 @@ private: /// /// \param [in] Args The list of input driver arguments /// \param [out] CmdArgs The list of output command arguments - void AddPreprocessingOptions(const llvm::opt::ArgList &Args, + void addPreprocessingOptions(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const; /// Extract PIC options from the driver arguments and add them to @@ -48,13 +48,12 @@ private: void AddPicOptions(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const; - /// Extract other compilation options from the driver arguments and add them - /// to the command arguments. + /// This method will effectively copy options from \a Args into \a CmdArgs. /// /// \param [in] Args The list of input driver arguments /// \param [out] CmdArgs The list of output command arguments - void AddOtherOptions(const llvm::opt::ArgList &Args, - llvm::opt::ArgStringList &CmdArgs) const; + void forwardOptions(const llvm::opt::ArgList &Args, + llvm::opt::ArgStringList &CmdArgs) const; public: Flang(const ToolChain &TC); -- 2.7.4