[clang] [Driver][NFC] Make use of auto (PR #70400)
Brad Smith via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 26 18:19:19 PDT 2023
https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/70400
None
>From d0429f2f1e9cacaa5c9d9997b9cb1f60aed6bd8b Mon Sep 17 00:00:00 2001
From: Brad Smith <brad at comstyle.com>
Date: Thu, 26 Oct 2023 19:50:37 -0400
Subject: [PATCH] [Driver][NFC] Make use of auto
---
clang/lib/Driver/ToolChains/FreeBSD.cpp | 3 +--
clang/lib/Driver/ToolChains/Fuchsia.cpp | 3 +--
clang/lib/Driver/ToolChains/Gnu.cpp | 3 +--
clang/lib/Driver/ToolChains/Haiku.cpp | 3 +--
clang/lib/Driver/ToolChains/NaCl.cpp | 6 ++----
clang/lib/Driver/ToolChains/OpenBSD.cpp | 6 ++----
clang/lib/Driver/ToolChains/Solaris.cpp | 3 +--
7 files changed, 9 insertions(+), 18 deletions(-)
diff --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp b/clang/lib/Driver/ToolChains/FreeBSD.cpp
index f4c2f70e73576f6..054f57c21ee6ba0 100644
--- a/clang/lib/Driver/ToolChains/FreeBSD.cpp
+++ b/clang/lib/Driver/ToolChains/FreeBSD.cpp
@@ -129,8 +129,7 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
- const toolchains::FreeBSD &ToolChain =
- static_cast<const toolchains::FreeBSD &>(getToolChain());
+ const auto &ToolChain = static_cast<const FreeBSD &>(getToolChain());
const Driver &D = ToolChain.getDriver();
const llvm::Triple::ArchType Arch = ToolChain.getArch();
const bool IsPIE =
diff --git a/clang/lib/Driver/ToolChains/Fuchsia.cpp b/clang/lib/Driver/ToolChains/Fuchsia.cpp
index 300a57afd37afd9..00de63c15522973 100644
--- a/clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ b/clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -34,8 +34,7 @@ void fuchsia::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
- const toolchains::Fuchsia &ToolChain =
- static_cast<const toolchains::Fuchsia &>(getToolChain());
+ const auto &ToolChain = static_cast<const Fuchsia &>(getToolChain());
const Driver &D = ToolChain.getDriver();
const llvm::Triple &Triple = ToolChain.getEffectiveTriple();
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index a98dfa02fc717a5..2515f85432d7542 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -376,8 +376,7 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
// Generic_ELF, so the static_cast might return a reference to a invalid
// instance (see PR45061). Ideally, the Linker constructor needs to take a
// Generic_ELF instead.
- const toolchains::Generic_ELF &ToolChain =
- static_cast<const toolchains::Generic_ELF &>(getToolChain());
+ const auto &ToolChain = static_cast<const Generic_ELF &>(getToolChain());
const Driver &D = ToolChain.getDriver();
const llvm::Triple &Triple = getToolChain().getEffectiveTriple();
diff --git a/clang/lib/Driver/ToolChains/Haiku.cpp b/clang/lib/Driver/ToolChains/Haiku.cpp
index 9f56a0ea5d612d0..4212dd8de293b06 100644
--- a/clang/lib/Driver/ToolChains/Haiku.cpp
+++ b/clang/lib/Driver/ToolChains/Haiku.cpp
@@ -23,8 +23,7 @@ void haiku::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
- const toolchains::Haiku &ToolChain =
- static_cast<const toolchains::Haiku &>(getToolChain());
+ const auto &ToolChain = static_cast<const Haiku &>(getToolChain());
const Driver &D = ToolChain.getDriver();
const llvm::Triple::ArchType Arch = ToolChain.getArch();
const bool Static = Args.hasArg(options::OPT_static);
diff --git a/clang/lib/Driver/ToolChains/NaCl.cpp b/clang/lib/Driver/ToolChains/NaCl.cpp
index 5be08c42b528733..22f038e5152ff23 100644
--- a/clang/lib/Driver/ToolChains/NaCl.cpp
+++ b/clang/lib/Driver/ToolChains/NaCl.cpp
@@ -31,8 +31,7 @@ void nacltools::AssemblerARM::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
- const toolchains::NaClToolChain &ToolChain =
- static_cast<const toolchains::NaClToolChain &>(getToolChain());
+ const auto &ToolChain = static_cast<const NaClToolChain &>(getToolChain());
InputInfo NaClMacros(types::TY_PP_Asm, ToolChain.GetNaClArmMacrosPath(),
"nacl-arm-macros.s");
InputInfoList NewInputs;
@@ -52,8 +51,7 @@ void nacltools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const ArgList &Args,
const char *LinkingOutput) const {
- const toolchains::NaClToolChain &ToolChain =
- static_cast<const toolchains::NaClToolChain &>(getToolChain());
+ const auto &ToolChain = static_cast<const NaClToolChain &>(getToolChain());
const Driver &D = ToolChain.getDriver();
const llvm::Triple::ArchType Arch = ToolChain.getArch();
const bool IsStatic =
diff --git a/clang/lib/Driver/ToolChains/OpenBSD.cpp b/clang/lib/Driver/ToolChains/OpenBSD.cpp
index cefbdff20ead93f..8df6dae3dd6ba6b 100644
--- a/clang/lib/Driver/ToolChains/OpenBSD.cpp
+++ b/clang/lib/Driver/ToolChains/OpenBSD.cpp
@@ -30,8 +30,7 @@ void openbsd::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
- const toolchains::OpenBSD &ToolChain =
- static_cast<const toolchains::OpenBSD &>(getToolChain());
+ const auto &ToolChain = static_cast<const OpenBSD &>(getToolChain());
const Driver &D = ToolChain.getDriver();
const llvm::Triple &Triple = ToolChain.getTriple();
@@ -110,8 +109,7 @@ void openbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
- const toolchains::OpenBSD &ToolChain =
- static_cast<const toolchains::OpenBSD &>(getToolChain());
+ const auto &ToolChain = static_cast<const OpenBSD &>(getToolChain());
const Driver &D = ToolChain.getDriver();
const llvm::Triple::ArchType Arch = ToolChain.getArch();
ArgStringList CmdArgs;
diff --git a/clang/lib/Driver/ToolChains/Solaris.cpp b/clang/lib/Driver/ToolChains/Solaris.cpp
index 2b1ac5a7f475c5a..3d5a710842eca44 100644
--- a/clang/lib/Driver/ToolChains/Solaris.cpp
+++ b/clang/lib/Driver/ToolChains/Solaris.cpp
@@ -126,8 +126,7 @@ void solaris::Linker::ConstructJob(Compilation &C, const JobAction &JA,
if (LinkerIsGnuLd) {
// Set the correct linker emulation for 32- and 64-bit Solaris.
- const toolchains::Solaris &ToolChain =
- static_cast<const toolchains::Solaris &>(getToolChain());
+ const auto &ToolChain = static_cast<const Solaris &>(getToolChain());
const llvm::Triple::ArchType Arch = ToolChain.getArch();
switch (Arch) {
More information about the cfe-commits
mailing list