[PATCH] D111805: [Driver][NetBSD] Use T reference instead of getToolChain().getTriple().
Frederic Cambus via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 14 07:12:21 PDT 2021
fcambus created this revision.
fcambus added reviewers: krytarowski, mgorny.
Herald added a subscriber: fedor.sergeev.
fcambus requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D111805
Files:
clang/lib/Driver/ToolChains/NetBSD.cpp
Index: clang/lib/Driver/ToolChains/NetBSD.cpp
===================================================================
--- clang/lib/Driver/ToolChains/NetBSD.cpp
+++ clang/lib/Driver/ToolChains/NetBSD.cpp
@@ -32,6 +32,7 @@
const toolchains::NetBSD &ToolChain =
static_cast<const toolchains::NetBSD &>(getToolChain());
const Driver &D = ToolChain.getDriver();
+ const llvm::Triple &T = ToolChain.getTriple();
claimNoWarnArgs(Args);
ArgStringList CmdArgs;
@@ -49,7 +50,7 @@
StringRef MArch, MCPU;
arm::getARMArchCPUFromArgs(Args, MArch, MCPU, /*FromAs*/ true);
std::string Arch =
- arm::getARMTargetCPU(MCPU, MArch, ToolChain.getTriple());
+ arm::getARMTargetCPU(MCPU, MArch, T);
CmdArgs.push_back(Args.MakeArgString("-mcpu=" + Arch));
break;
}
@@ -60,7 +61,7 @@
case llvm::Triple::mips64el: {
StringRef CPUName;
StringRef ABIName;
- mips::getMipsCPUAndABI(Args, ToolChain.getTriple(), CPUName, ABIName);
+ mips::getMipsCPUAndABI(Args, T, CPUName, ABIName);
CmdArgs.push_back("-march");
CmdArgs.push_back(CPUName.data());
@@ -68,7 +69,7 @@
CmdArgs.push_back("-mabi");
CmdArgs.push_back(mips::getGnuCompatibleMipsABIName(ABIName).data());
- if (ToolChain.getTriple().isLittleEndian())
+ if (T.isLittleEndian())
CmdArgs.push_back("-EL");
else
CmdArgs.push_back("-EB");
@@ -80,18 +81,16 @@
case llvm::Triple::sparc:
case llvm::Triple::sparcel: {
CmdArgs.push_back("-32");
- std::string CPU = getCPUName(D, Args, ToolChain.getTriple());
- CmdArgs.push_back(
- sparc::getSparcAsmModeForCPU(CPU, ToolChain.getTriple()));
+ std::string CPU = getCPUName(D, Args, T);
+ CmdArgs.push_back(sparc::getSparcAsmModeForCPU(CPU, T));
AddAssemblerKPIC(ToolChain, Args, CmdArgs);
break;
}
case llvm::Triple::sparcv9: {
CmdArgs.push_back("-64");
- std::string CPU = getCPUName(D, Args, ToolChain.getTriple());
- CmdArgs.push_back(
- sparc::getSparcAsmModeForCPU(CPU, ToolChain.getTriple()));
+ std::string CPU = getCPUName(D, Args, T);
+ CmdArgs.push_back(sparc::getSparcAsmModeForCPU(CPU, T));
AddAssemblerKPIC(ToolChain, Args, CmdArgs);
break;
}
@@ -122,6 +121,8 @@
const toolchains::NetBSD &ToolChain =
static_cast<const toolchains::NetBSD &>(getToolChain());
const Driver &D = ToolChain.getDriver();
+ const llvm::Triple &T = ToolChain.getTriple();
+
ArgStringList CmdArgs;
if (!D.SysRoot.empty())
@@ -156,7 +157,7 @@
case llvm::Triple::arm:
case llvm::Triple::thumb:
CmdArgs.push_back("-m");
- switch (ToolChain.getTriple().getEnvironment()) {
+ switch (T.getEnvironment()) {
case llvm::Triple::EABI:
case llvm::Triple::GNUEABI:
CmdArgs.push_back("armelf_nbsd_eabi");
@@ -174,7 +175,7 @@
case llvm::Triple::thumbeb:
arm::appendBE8LinkFlag(Args, CmdArgs, ToolChain.getEffectiveTriple());
CmdArgs.push_back("-m");
- switch (ToolChain.getTriple().getEnvironment()) {
+ switch (T.getEnvironment()) {
case llvm::Triple::EABI:
case llvm::Triple::GNUEABI:
CmdArgs.push_back("armelfb_nbsd_eabi");
@@ -271,7 +272,7 @@
}
unsigned Major, Minor, Micro;
- ToolChain.getTriple().getOSVersion(Major, Minor, Micro);
+ T.getOSVersion(Major, Minor, Micro);
bool useLibgcc = true;
if (Major >= 7 || Major == 0) {
switch (ToolChain.getArch()) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111805.379709.patch
Type: text/x-patch
Size: 3430 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211014/971b42e0/attachment.bin>
More information about the cfe-commits
mailing list