[clang] [Driver][MinGW] Always put libc argument last, even if non-standard (PR #149434)
Martin Storsjö via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 28 01:02:49 PDT 2025
================
@@ -85,11 +85,18 @@ void tools::MinGW::Linker::AddLibGCC(const ArgList &Args,
CmdArgs.push_back("-lmoldname");
CmdArgs.push_back("-lmingwex");
- for (auto Lib : Args.getAllArgValues(options::OPT_l))
+ for (auto Lib : Args.getAllArgValues(options::OPT_l)) {
if (StringRef(Lib).starts_with("msvcr") ||
StringRef(Lib).starts_with("ucrt") ||
- StringRef(Lib).starts_with("crtdll"))
+ StringRef(Lib).starts_with("crtdll")) {
+ Lib = (llvm::Twine("-l") + Lib).str();
----------------
mstorsjo wrote:
I'd kinda prefer to declare a new variable instead of reusing `Lib` here. Especially with `Lib` being declared `auto`, its type is not entirely obvious here, so it would feel clearer if we'd declare the new one e.g. explicitly `std::string` here.
https://github.com/llvm/llvm-project/pull/149434
More information about the cfe-commits
mailing list