[llvm-branch-commits] [lld] ed146d6 - [LLD][ELF] - Use LLVM_ELF_IMPORT_TYPES_ELFT instead of multiple types definitions. NFCI.
Georgii Rymar via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Dec 28 23:58:43 PST 2020
Author: Georgii Rymar
Date: 2020-12-29T10:50:07+03:00
New Revision: ed146d6291ce510ef954d350e2ca5a107890c2d2
URL: https://github.com/llvm/llvm-project/commit/ed146d6291ce510ef954d350e2ca5a107890c2d2
DIFF: https://github.com/llvm/llvm-project/commit/ed146d6291ce510ef954d350e2ca5a107890c2d2.diff
LOG: [LLD][ELF] - Use LLVM_ELF_IMPORT_TYPES_ELFT instead of multiple types definitions. NFCI.
We can reduce the number of "using" declarations.
`LLVM_ELF_IMPORT_TYPES_ELFT` was extended in D93801.
Differential revision: https://reviews.llvm.org/D93856
Added:
Modified:
lld/ELF/InputFiles.h
lld/ELF/SyntheticSections.h
lld/ELF/Writer.cpp
Removed:
################################################################################
diff --git a/lld/ELF/InputFiles.h b/lld/ELF/InputFiles.h
index 7ffe4c29cb87..cdd6b5c2ce99 100644
--- a/lld/ELF/InputFiles.h
+++ b/lld/ELF/InputFiles.h
@@ -189,12 +189,7 @@ class ELFFileBase : public InputFile {
// .o file.
template <class ELFT> class ObjFile : public ELFFileBase {
- using Elf_Rel = typename ELFT::Rel;
- using Elf_Rela = typename ELFT::Rela;
- using Elf_Sym = typename ELFT::Sym;
- using Elf_Shdr = typename ELFT::Shdr;
- using Elf_Word = typename ELFT::Word;
- using Elf_CGProfile = typename ELFT::CGProfile;
+ LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)
public:
static bool classof(const InputFile *f) { return f->kind() == ObjKind; }
diff --git a/lld/ELF/SyntheticSections.h b/lld/ELF/SyntheticSections.h
index 8943596179c1..c20386cc20da 100644
--- a/lld/ELF/SyntheticSections.h
+++ b/lld/ELF/SyntheticSections.h
@@ -461,12 +461,7 @@ class DynamicReloc {
};
template <class ELFT> class DynamicSection final : public SyntheticSection {
- using Elf_Dyn = typename ELFT::Dyn;
- using Elf_Rel = typename ELFT::Rel;
- using Elf_Rela = typename ELFT::Rela;
- using Elf_Relr = typename ELFT::Relr;
- using Elf_Shdr = typename ELFT::Shdr;
- using Elf_Sym = typename ELFT::Sym;
+ LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)
// finalizeContents() fills this vector with the section contents.
std::vector<std::pair<int32_t, std::function<uint64_t()>>> entries;
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 98139b56b29b..0397dae8f891 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -45,10 +45,9 @@ namespace {
// The writer writes a SymbolTable result to a file.
template <class ELFT> class Writer {
public:
+ LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)
+
Writer() : buffer(errorHandler().outputBuffer) {}
- using Elf_Shdr = typename ELFT::Shdr;
- using Elf_Ehdr = typename ELFT::Ehdr;
- using Elf_Phdr = typename ELFT::Phdr;
void run();
More information about the llvm-branch-commits
mailing list