[flang-commits] [clang] [flang] [flang] Add runtimes using --dependent-lib on MSVC targets (PR #72519)
via flang-commits
flang-commits at lists.llvm.org
Thu Nov 16 06:38:12 PST 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff ac4868ea3c495baf5cbcb729e03f95b4425420dc b58c339f7e8fb4cefbe3bad36bb40518beecf864 -- clang/lib/Driver/ToolChains/CommonArgs.cpp clang/lib/Driver/ToolChains/CommonArgs.h clang/lib/Driver/ToolChains/Darwin.cpp clang/lib/Driver/ToolChains/DragonFly.cpp clang/lib/Driver/ToolChains/Flang.cpp clang/lib/Driver/ToolChains/FreeBSD.cpp clang/lib/Driver/ToolChains/Gnu.cpp clang/lib/Driver/ToolChains/Haiku.cpp clang/lib/Driver/ToolChains/MSVC.cpp clang/lib/Driver/ToolChains/MinGW.cpp clang/lib/Driver/ToolChains/NetBSD.cpp clang/lib/Driver/ToolChains/OpenBSD.cpp clang/lib/Driver/ToolChains/Solaris.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Driver/ToolChains/Flang.cpp b/clang/lib/Driver/ToolChains/Flang.cpp
index 84659b20eb..01f07b9228 100644
--- a/clang/lib/Driver/ToolChains/Flang.cpp
+++ b/clang/lib/Driver/ToolChains/Flang.cpp
@@ -204,14 +204,13 @@ void Flang::AddAArch64TargetArgs(const ArgList &Args,
}
}
-static void processVSRuntimeLibrary(const ToolChain &TC,
- const ArgList &Args,
+static void processVSRuntimeLibrary(const ToolChain &TC, const ArgList &Args,
ArgStringList &CmdArgs) {
assert(TC.getTriple().isKnownWindowsMSVCEnvironment() &&
"can only add VS runtime library on Windows!");
if (TC.getTriple().isKnownWindowsMSVCEnvironment()) {
- CmdArgs.push_back(Args.MakeArgString("--dependent-lib=" +
- TC.getCompilerRTBasename(Args, "builtins")));
+ CmdArgs.push_back(Args.MakeArgString(
+ "--dependent-lib=" + TC.getCompilerRTBasename(Args, "builtins")));
}
unsigned RTOptionID = options::OPT__SLASH_MT;
if (auto *rtl = Args.getLastArg(options::OPT_fms_runtime_lib_EQ)) {
@@ -223,40 +222,40 @@ static void processVSRuntimeLibrary(const ToolChain &TC,
.Default(options::OPT__SLASH_MT);
}
switch (RTOptionID) {
- case options::OPT__SLASH_MT:
- CmdArgs.push_back("-D_MT");
- CmdArgs.push_back("--dependent-lib=libcmt");
- CmdArgs.push_back("--dependent-lib=Fortran_main.static.lib");
- CmdArgs.push_back("--dependent-lib=FortranRuntime.static.lib");
- CmdArgs.push_back("--dependent-lib=FortranDecimal.static.lib");
- break;
- case options::OPT__SLASH_MTd:
- CmdArgs.push_back("-D_MT");
- CmdArgs.push_back("-D_DEBUG");
- CmdArgs.push_back("--dependent-lib=libcmtd");
- CmdArgs.push_back("--dependent-lib=Fortran_main.static_dbg.lib");
- CmdArgs.push_back("--dependent-lib=FortranRuntime.static_dbg.lib");
- CmdArgs.push_back("--dependent-lib=FortranDecimal.static_dbg.lib");
- break;
- case options::OPT__SLASH_MD:
- CmdArgs.push_back("-D_MT");
- CmdArgs.push_back("-D_DLL");
- CmdArgs.push_back("--dependent-lib=msvcrt");
- CmdArgs.push_back("--dependent-lib=Fortran_main.dynamic.lib");
- CmdArgs.push_back("--dependent-lib=FortranRuntime.dynamic.lib");
- CmdArgs.push_back("--dependent-lib=FortranDecimal.dynamic.lib");
- break;
- case options::OPT__SLASH_MDd:
- CmdArgs.push_back("-D_MT");
- CmdArgs.push_back("-D_DEBUG");
- CmdArgs.push_back("-D_DLL");
- CmdArgs.push_back("--dependent-lib=msvcrtd");
- CmdArgs.push_back("--dependent-lib=Fortran_main.dynamic_dbg.lib");
- CmdArgs.push_back("--dependent-lib=FortranRuntime.dynamic_dbg.lib");
- CmdArgs.push_back("--dependent-lib=FortranDecimal.dynamic_dbg.lib");
- break;
- }
+ case options::OPT__SLASH_MT:
+ CmdArgs.push_back("-D_MT");
+ CmdArgs.push_back("--dependent-lib=libcmt");
+ CmdArgs.push_back("--dependent-lib=Fortran_main.static.lib");
+ CmdArgs.push_back("--dependent-lib=FortranRuntime.static.lib");
+ CmdArgs.push_back("--dependent-lib=FortranDecimal.static.lib");
+ break;
+ case options::OPT__SLASH_MTd:
+ CmdArgs.push_back("-D_MT");
+ CmdArgs.push_back("-D_DEBUG");
+ CmdArgs.push_back("--dependent-lib=libcmtd");
+ CmdArgs.push_back("--dependent-lib=Fortran_main.static_dbg.lib");
+ CmdArgs.push_back("--dependent-lib=FortranRuntime.static_dbg.lib");
+ CmdArgs.push_back("--dependent-lib=FortranDecimal.static_dbg.lib");
+ break;
+ case options::OPT__SLASH_MD:
+ CmdArgs.push_back("-D_MT");
+ CmdArgs.push_back("-D_DLL");
+ CmdArgs.push_back("--dependent-lib=msvcrt");
+ CmdArgs.push_back("--dependent-lib=Fortran_main.dynamic.lib");
+ CmdArgs.push_back("--dependent-lib=FortranRuntime.dynamic.lib");
+ CmdArgs.push_back("--dependent-lib=FortranDecimal.dynamic.lib");
+ break;
+ case options::OPT__SLASH_MDd:
+ CmdArgs.push_back("-D_MT");
+ CmdArgs.push_back("-D_DEBUG");
+ CmdArgs.push_back("-D_DLL");
+ CmdArgs.push_back("--dependent-lib=msvcrtd");
+ CmdArgs.push_back("--dependent-lib=Fortran_main.dynamic_dbg.lib");
+ CmdArgs.push_back("--dependent-lib=FortranRuntime.dynamic_dbg.lib");
+ CmdArgs.push_back("--dependent-lib=FortranDecimal.dynamic_dbg.lib");
+ break;
}
+}
void Flang::addTargetOptions(const ArgList &Args,
ArgStringList &CmdArgs) const {
``````````
</details>
https://github.com/llvm/llvm-project/pull/72519
More information about the flang-commits
mailing list