Skip to content

Commit 3ea0022

Browse files
authored
[Driver][NFC] Make use of auto (llvm#70400)
1 parent 56cadac commit 3ea0022

File tree

7 files changed

+9
-18
lines changed

7 files changed

+9
-18
lines changed

clang/lib/Driver/ToolChains/FreeBSD.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
129129
const InputInfoList &Inputs,
130130
const ArgList &Args,
131131
const char *LinkingOutput) const {
132-
const toolchains::FreeBSD &ToolChain =
133-
static_cast<const toolchains::FreeBSD &>(getToolChain());
132+
const auto &ToolChain = static_cast<const FreeBSD &>(getToolChain());
134133
const Driver &D = ToolChain.getDriver();
135134
const llvm::Triple::ArchType Arch = ToolChain.getArch();
136135
const bool IsPIE =

clang/lib/Driver/ToolChains/Fuchsia.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ void fuchsia::Linker::ConstructJob(Compilation &C, const JobAction &JA,
3434
const InputInfoList &Inputs,
3535
const ArgList &Args,
3636
const char *LinkingOutput) const {
37-
const toolchains::Fuchsia &ToolChain =
38-
static_cast<const toolchains::Fuchsia &>(getToolChain());
37+
const auto &ToolChain = static_cast<const Fuchsia &>(getToolChain());
3938
const Driver &D = ToolChain.getDriver();
4039

4140
const llvm::Triple &Triple = ToolChain.getEffectiveTriple();

clang/lib/Driver/ToolChains/Gnu.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,7 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
376376
// Generic_ELF, so the static_cast might return a reference to a invalid
377377
// instance (see PR45061). Ideally, the Linker constructor needs to take a
378378
// Generic_ELF instead.
379-
const toolchains::Generic_ELF &ToolChain =
380-
static_cast<const toolchains::Generic_ELF &>(getToolChain());
379+
const auto &ToolChain = static_cast<const Generic_ELF &>(getToolChain());
381380
const Driver &D = ToolChain.getDriver();
382381

383382
const llvm::Triple &Triple = getToolChain().getEffectiveTriple();

clang/lib/Driver/ToolChains/Haiku.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ void haiku::Linker::ConstructJob(Compilation &C, const JobAction &JA,
2323
const InputInfoList &Inputs,
2424
const ArgList &Args,
2525
const char *LinkingOutput) const {
26-
const toolchains::Haiku &ToolChain =
27-
static_cast<const toolchains::Haiku &>(getToolChain());
26+
const auto &ToolChain = static_cast<const Haiku &>(getToolChain());
2827
const Driver &D = ToolChain.getDriver();
2928
const llvm::Triple::ArchType Arch = ToolChain.getArch();
3029
const bool Static = Args.hasArg(options::OPT_static);

clang/lib/Driver/ToolChains/NaCl.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ void nacltools::AssemblerARM::ConstructJob(Compilation &C, const JobAction &JA,
3131
const InputInfoList &Inputs,
3232
const ArgList &Args,
3333
const char *LinkingOutput) const {
34-
const toolchains::NaClToolChain &ToolChain =
35-
static_cast<const toolchains::NaClToolChain &>(getToolChain());
34+
const auto &ToolChain = static_cast<const NaClToolChain &>(getToolChain());
3635
InputInfo NaClMacros(types::TY_PP_Asm, ToolChain.GetNaClArmMacrosPath(),
3736
"nacl-arm-macros.s");
3837
InputInfoList NewInputs;
@@ -52,8 +51,7 @@ void nacltools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
5251
const ArgList &Args,
5352
const char *LinkingOutput) const {
5453

55-
const toolchains::NaClToolChain &ToolChain =
56-
static_cast<const toolchains::NaClToolChain &>(getToolChain());
54+
const auto &ToolChain = static_cast<const NaClToolChain &>(getToolChain());
5755
const Driver &D = ToolChain.getDriver();
5856
const llvm::Triple::ArchType Arch = ToolChain.getArch();
5957
const bool IsStatic =

clang/lib/Driver/ToolChains/OpenBSD.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ void openbsd::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
3030
const InputInfoList &Inputs,
3131
const ArgList &Args,
3232
const char *LinkingOutput) const {
33-
const toolchains::OpenBSD &ToolChain =
34-
static_cast<const toolchains::OpenBSD &>(getToolChain());
33+
const auto &ToolChain = static_cast<const OpenBSD &>(getToolChain());
3534
const Driver &D = ToolChain.getDriver();
3635
const llvm::Triple &Triple = ToolChain.getTriple();
3736

@@ -110,8 +109,7 @@ void openbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
110109
const InputInfoList &Inputs,
111110
const ArgList &Args,
112111
const char *LinkingOutput) const {
113-
const toolchains::OpenBSD &ToolChain =
114-
static_cast<const toolchains::OpenBSD &>(getToolChain());
112+
const auto &ToolChain = static_cast<const OpenBSD &>(getToolChain());
115113
const Driver &D = ToolChain.getDriver();
116114
const llvm::Triple::ArchType Arch = ToolChain.getArch();
117115
ArgStringList CmdArgs;

clang/lib/Driver/ToolChains/Solaris.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ void solaris::Linker::ConstructJob(Compilation &C, const JobAction &JA,
126126

127127
if (LinkerIsGnuLd) {
128128
// Set the correct linker emulation for 32- and 64-bit Solaris.
129-
const toolchains::Solaris &ToolChain =
130-
static_cast<const toolchains::Solaris &>(getToolChain());
129+
const auto &ToolChain = static_cast<const Solaris &>(getToolChain());
131130
const llvm::Triple::ArchType Arch = ToolChain.getArch();
132131

133132
switch (Arch) {

0 commit comments

Comments
 (0)