[clang] [Driver][NFC] Make use of auto (PR #70400)

2023-10-26 Thread Brad Smith via cfe-commits

https://github.com/brad0 closed https://github.com/llvm/llvm-project/pull/70400
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Driver][NFC] Make use of auto (PR #70400)

2023-10-26 Thread Fangrui Song via cfe-commits

https://github.com/MaskRay approved this pull request.


https://github.com/llvm/llvm-project/pull/70400
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Driver][NFC] Make use of auto (PR #70400)

2023-10-26 Thread Brad Smith via cfe-commits

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 
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(getToolChain());
+  const auto &ToolChain = static_cast(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(getToolChain());
+  const auto &ToolChain = static_cast(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(getToolChain());
+  const auto &ToolChain = static_cast(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(getToolChain());
+  const auto &ToolChain = static_cast(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(getToolChain());
+  const auto &ToolChain = static_cast(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(getToolChain());
+  const auto &ToolChain = static_cast(getToolChain());
   const Driver &D = ToolChain.getDri