[lld] r357372 - Replace `typedef A B` with `using B = A`. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 31 17:11:24 PDT 2019


Author: ruiu
Date: Sun Mar 31 17:11:24 2019
New Revision: 357372

URL: http://llvm.org/viewvc/llvm-project?rev=357372&view=rev
Log:
Replace `typedef A B` with `using B = A`. NFC.

I did this using Perl.

Differential Revision: https://reviews.llvm.org/D60003

Modified:
    lld/trunk/COFF/Driver.cpp
    lld/trunk/COFF/MapFile.cpp
    lld/trunk/ELF/CallGraphSort.cpp
    lld/trunk/ELF/InputFiles.h
    lld/trunk/ELF/InputSection.cpp
    lld/trunk/ELF/LinkerScript.h
    lld/trunk/ELF/MapFile.cpp
    lld/trunk/ELF/OutputSections.cpp
    lld/trunk/ELF/Relocations.cpp
    lld/trunk/ELF/Relocations.h
    lld/trunk/ELF/SyntheticSections.cpp
    lld/trunk/ELF/SyntheticSections.h
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=357372&r1=357371&r2=357372&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Sun Mar 31 17:11:24 2019
@@ -96,7 +96,7 @@ static std::string getOutputPath(StringR
 // FIXME: We could open the file in createFutureForFile and avoid needing to
 // return an error here, but for the moment that would cost us a file descriptor
 // (a limited resource on Windows) for the duration that the future is pending.
-typedef std::pair<std::unique_ptr<MemoryBuffer>, std::error_code> MBErrPair;
+using MBErrPair = std::pair<std::unique_ptr<MemoryBuffer>, std::error_code>;
 
 // Create a std::future that opens and maps a file using the best strategy for
 // the host platform.

Modified: lld/trunk/COFF/MapFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/MapFile.cpp?rev=357372&r1=357371&r2=357372&view=diff
==============================================================================
--- lld/trunk/COFF/MapFile.cpp (original)
+++ lld/trunk/COFF/MapFile.cpp Sun Mar 31 17:11:24 2019
@@ -32,8 +32,8 @@ using namespace llvm::object;
 using namespace lld;
 using namespace lld::coff;
 
-typedef DenseMap<const SectionChunk *, SmallVector<DefinedRegular *, 4>>
-    SymbolMapTy;
+using SymbolMapTy =
+    DenseMap<const SectionChunk *, SmallVector<DefinedRegular *, 4>>;
 
 static const std::string Indent8 = "        ";          // 8 spaces
 static const std::string Indent16 = "                "; // 16 spaces

Modified: lld/trunk/ELF/CallGraphSort.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/CallGraphSort.cpp?rev=357372&r1=357371&r2=357372&view=diff
==============================================================================
--- lld/trunk/ELF/CallGraphSort.cpp (original)
+++ lld/trunk/ELF/CallGraphSort.cpp Sun Mar 31 17:11:24 2019
@@ -92,8 +92,8 @@ constexpr int MAX_DENSITY_DEGRADATION =
 constexpr uint64_t MAX_CLUSTER_SIZE = 1024 * 1024;
 } // end anonymous namespace
 
-typedef std::pair<const InputSectionBase *, const InputSectionBase *>
-    SectionPair;
+using SectionPair =
+    std::pair<const InputSectionBase *, const InputSectionBase *>;
 
 // Take the edge list in Config->CallGraphProfile, resolve symbol names to
 // Symbols, and generate a graph between InputSections with the provided

Modified: lld/trunk/ELF/InputFiles.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.h?rev=357372&r1=357371&r2=357372&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.h (original)
+++ lld/trunk/ELF/InputFiles.h Sun Mar 31 17:11:24 2019
@@ -147,10 +147,10 @@ private:
 
 template <typename ELFT> class ELFFileBase : public InputFile {
 public:
-  typedef typename ELFT::Shdr Elf_Shdr;
-  typedef typename ELFT::Sym Elf_Sym;
-  typedef typename ELFT::Word Elf_Word;
-  typedef typename ELFT::SymRange Elf_Sym_Range;
+  using Elf_Shdr = typename ELFT::Shdr;
+  using Elf_Sym = typename ELFT::Sym;
+  using Elf_Word = typename ELFT::Word;
+  using Elf_Sym_Range = typename ELFT::SymRange;
 
   ELFFileBase(Kind K, MemoryBufferRef M);
   static bool classof(const InputFile *F) { return F->isElf(); }
@@ -176,13 +176,13 @@ protected:
 
 // .o file.
 template <class ELFT> class ObjFile : public ELFFileBase<ELFT> {
-  typedef ELFFileBase<ELFT> Base;
-  typedef typename ELFT::Rel Elf_Rel;
-  typedef typename ELFT::Rela Elf_Rela;
-  typedef typename ELFT::Sym Elf_Sym;
-  typedef typename ELFT::Shdr Elf_Shdr;
-  typedef typename ELFT::Word Elf_Word;
-  typedef typename ELFT::CGProfile Elf_CGProfile;
+  using Base = ELFFileBase<ELFT>;
+  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;
 
   StringRef getShtGroupSignature(ArrayRef<Elf_Shdr> Sections,
                                  const Elf_Shdr &Sec);
@@ -321,13 +321,13 @@ public:
 
 // .so file.
 template <class ELFT> class SharedFile : public ELFFileBase<ELFT> {
-  typedef ELFFileBase<ELFT> Base;
-  typedef typename ELFT::Dyn Elf_Dyn;
-  typedef typename ELFT::Shdr Elf_Shdr;
-  typedef typename ELFT::Sym Elf_Sym;
-  typedef typename ELFT::SymRange Elf_Sym_Range;
-  typedef typename ELFT::Verdef Elf_Verdef;
-  typedef typename ELFT::Versym Elf_Versym;
+  using Base = ELFFileBase<ELFT>;
+  using Elf_Dyn = typename ELFT::Dyn;
+  using Elf_Shdr = typename ELFT::Shdr;
+  using Elf_Sym = typename ELFT::Sym;
+  using Elf_Sym_Range = typename ELFT::SymRange;
+  using Elf_Verdef = typename ELFT::Verdef;
+  using Elf_Versym = typename ELFT::Versym;
 
   const Elf_Shdr *VersymSec = nullptr;
   const Elf_Shdr *VerdefSec = nullptr;

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=357372&r1=357371&r2=357372&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Sun Mar 31 17:11:24 2019
@@ -210,8 +210,8 @@ OutputSection *SectionBase::getOutputSec
 // by zlib-compressed data. This function parses a header to initialize
 // `UncompressedSize` member and remove the header from `RawData`.
 void InputSectionBase::parseCompressedHeader() {
-  typedef typename ELF64LE::Chdr Chdr64;
-  typedef typename ELF32LE::Chdr Chdr32;
+  using Chdr64 = typename ELF64LE::Chdr;
+  using Chdr32 = typename ELF32LE::Chdr;
 
   // Old-style header
   if (Name.startswith(".zdebug")) {
@@ -380,7 +380,7 @@ OutputSection *InputSection::getParent()
 // Copy SHT_GROUP section contents. Used only for the -r option.
 template <class ELFT> void InputSection::copyShtGroup(uint8_t *Buf) {
   // ELFT::Word is the 32-bit integral type in the target endianness.
-  typedef typename ELFT::Word u32;
+  using u32 = typename ELFT::Word;
   ArrayRef<u32> From = getDataAs<u32>();
   auto *To = reinterpret_cast<u32 *>(Buf);
 

Modified: lld/trunk/ELF/LinkerScript.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.h?rev=357372&r1=357371&r2=357372&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.h (original)
+++ lld/trunk/ELF/LinkerScript.h Sun Mar 31 17:11:24 2019
@@ -67,7 +67,7 @@ struct ExprValue {
 // This represents an expression in the linker script.
 // ScriptParser::readExpr reads an expression and returns an Expr.
 // Later, we evaluate the expression by calling the function.
-typedef std::function<ExprValue()> Expr;
+using Expr = std::function<ExprValue()>;
 
 // This enum is used to implement linker script SECTIONS command.
 // https://sourceware.org/binutils/docs/ld/SECTIONS.html#SECTIONS

Modified: lld/trunk/ELF/MapFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/MapFile.cpp?rev=357372&r1=357371&r2=357372&view=diff
==============================================================================
--- lld/trunk/ELF/MapFile.cpp (original)
+++ lld/trunk/ELF/MapFile.cpp Sun Mar 31 17:11:24 2019
@@ -37,7 +37,7 @@ using namespace llvm::object;
 using namespace lld;
 using namespace lld::elf;
 
-typedef DenseMap<const SectionBase *, SmallVector<Defined *, 4>> SymbolMapTy;
+using SymbolMapTy = DenseMap<const SectionBase *, SmallVector<Defined *, 4>>;
 
 static const std::string Indent8 = "        ";          // 8 spaces
 static const std::string Indent16 = "                "; // 16 spaces

Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=357372&r1=357371&r2=357372&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Sun Mar 31 17:11:24 2019
@@ -138,7 +138,7 @@ void OutputSection::addSection(InputSect
 
 static void sortByOrder(MutableArrayRef<InputSection *> In,
                         llvm::function_ref<int(InputSectionBase *S)> Order) {
-  typedef std::pair<int, InputSection *> Pair;
+  using Pair = std::pair<int, InputSection *>;
   auto Comp = [](const Pair &A, const Pair &B) { return A.first < B.first; };
 
   std::vector<Pair> V;
@@ -179,7 +179,7 @@ static void fill(uint8_t *Buf, size_t Si
 
 // Compress section contents if this section contains debug info.
 template <class ELFT> void OutputSection::maybeCompress() {
-  typedef typename ELFT::Chdr Elf_Chdr;
+  using Elf_Chdr = typename ELFT::Chdr;
 
   // Compress only DWARF debug sections.
   if (!Config->CompressDebugSections || (Flags & SHF_ALLOC) ||

Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=357372&r1=357371&r2=357372&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Sun Mar 31 17:11:24 2019
@@ -479,7 +479,7 @@ static RelExpr fromPlt(RelExpr Expr) {
 
 // Returns true if a given shared symbol is in a read-only segment in a DSO.
 template <class ELFT> static bool isReadOnly(SharedSymbol &SS) {
-  typedef typename ELFT::Phdr Elf_Phdr;
+  using Elf_Phdr = typename ELFT::Phdr;
 
   // Determine if the symbol is read-only by scanning the DSO's program headers.
   const SharedFile<ELFT> &File = SS.getFile<ELFT>();
@@ -498,7 +498,7 @@ template <class ELFT> static bool isRead
 // Otherwise, they would refer to different places at runtime.
 template <class ELFT>
 static SmallSet<SharedSymbol *, 4> getSymbolsAt(SharedSymbol &SS) {
-  typedef typename ELFT::Sym Elf_Sym;
+  using Elf_Sym = typename ELFT::Sym;
 
   SharedFile<ELFT> &File = SS.getFile<ELFT>();
 

Modified: lld/trunk/ELF/Relocations.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.h?rev=357372&r1=357371&r2=357372&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.h (original)
+++ lld/trunk/ELF/Relocations.h Sun Mar 31 17:11:24 2019
@@ -23,7 +23,7 @@ class OutputSection;
 class SectionBase;
 
 // Represents a relocation type, such as R_X86_64_PC32 or R_ARM_THM_CALL.
-typedef uint32_t RelType;
+using RelType = uint32_t;
 
 // List of target-independent relocation types. Relocations read
 // from files are converted to these types so that the main code

Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=357372&r1=357371&r2=357372&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Sun Mar 31 17:11:24 2019
@@ -2474,8 +2474,8 @@ readPubNamesAndTypes(const LLDDwarfObj<E
 static std::vector<GdbIndexSection::GdbSymbol>
 createSymbols(ArrayRef<std::vector<GdbIndexSection::NameAttrEntry>> NameAttrs,
               const std::vector<GdbIndexSection::GdbChunk> &Chunks) {
-  typedef GdbIndexSection::GdbSymbol GdbSymbol;
-  typedef GdbIndexSection::NameAttrEntry NameAttrEntry;
+  using GdbSymbol = GdbIndexSection::GdbSymbol;
+  using NameAttrEntry = GdbIndexSection::NameAttrEntry;
 
   // For each chunk, compute the number of compilation units preceding it.
   uint32_t CuIdx = 0;
@@ -2669,7 +2669,7 @@ void EhFrameHeader::writeTo(uint8_t *Buf
 // It is sorted by PC.
 void EhFrameHeader::write() {
   uint8_t *Buf = Out::BufferStart + getParent()->Offset + OutSecOff;
-  typedef EhFrameSection::FdeData FdeData;
+  using FdeData = EhFrameSection::FdeData;
 
   std::vector<FdeData> Fdes = In.EhFrame->getFdeData();
 

Modified: lld/trunk/ELF/SyntheticSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.h?rev=357372&r1=357371&r2=357372&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.h (original)
+++ lld/trunk/ELF/SyntheticSections.h Sun Mar 31 17:11:24 2019
@@ -308,7 +308,7 @@ private:
   uint64_t Size = 0;
 
   // Symbol and addend.
-  typedef std::pair<Symbol *, int64_t> GotEntry;
+  using GotEntry = std::pair<Symbol *, int64_t>;
 
   struct FileGot {
     InputFile *File = nullptr;
@@ -443,12 +443,12 @@ private:
 };
 
 template <class ELFT> class DynamicSection final : public SyntheticSection {
-  typedef typename ELFT::Dyn Elf_Dyn;
-  typedef typename ELFT::Rel Elf_Rel;
-  typedef typename ELFT::Rela Elf_Rela;
-  typedef typename ELFT::Relr Elf_Relr;
-  typedef typename ELFT::Shdr Elf_Shdr;
-  typedef typename ELFT::Sym Elf_Sym;
+  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;
 
   // finalizeContents() fills this vector with the section contents.
   std::vector<std::pair<int32_t, std::function<uint64_t()>>> Entries;
@@ -496,8 +496,8 @@ protected:
 
 template <class ELFT>
 class RelocationSection final : public RelocationBaseSection {
-  typedef typename ELFT::Rel Elf_Rel;
-  typedef typename ELFT::Rela Elf_Rela;
+  using Elf_Rel = typename ELFT::Rel;
+  using Elf_Rela = typename ELFT::Rela;
 
 public:
   RelocationSection(StringRef Name, bool Sort);
@@ -509,8 +509,8 @@ private:
 
 template <class ELFT>
 class AndroidPackedRelocationSection final : public RelocationBaseSection {
-  typedef typename ELFT::Rel Elf_Rel;
-  typedef typename ELFT::Rela Elf_Rela;
+  using Elf_Rel = typename ELFT::Rel;
+  using Elf_Rela = typename ELFT::Rela;
 
 public:
   AndroidPackedRelocationSection(StringRef Name);
@@ -544,7 +544,7 @@ public:
 //   https://groups.google.com/forum/#!topic/generic-abi/bX460iggiKg
 // For more details, see the comment in RelrSection::updateAllocSize().
 template <class ELFT> class RelrSection final : public RelrBaseSection {
-  typedef typename ELFT::Relr Elf_Relr;
+  using Elf_Relr = typename ELFT::Relr;
 
 public:
   RelrSection();
@@ -589,7 +589,7 @@ protected:
 
 template <class ELFT>
 class SymbolTableSection final : public SymbolTableBaseSection {
-  typedef typename ELFT::Sym Elf_Sym;
+  using Elf_Sym = typename ELFT::Sym;
 
 public:
   SymbolTableSection(StringTableSection &StrTabSec);
@@ -804,8 +804,8 @@ public:
 // mapping from version identifiers to version names.
 template <class ELFT>
 class VersionNeedSection final : public VersionNeedBaseSection {
-  typedef typename ELFT::Verneed Elf_Verneed;
-  typedef typename ELFT::Vernaux Elf_Vernaux;
+  using Elf_Verneed = typename ELFT::Verneed;
+  using Elf_Vernaux = typename ELFT::Vernaux;
 
   // A vector of shared files that need Elf_Verneed data structures and the
   // string table offsets of their sonames.
@@ -880,7 +880,7 @@ private:
 // .MIPS.abiflags section.
 template <class ELFT>
 class MipsAbiFlagsSection final : public SyntheticSection {
-  typedef llvm::object::Elf_Mips_ABIFlags<ELFT> Elf_Mips_ABIFlags;
+  using Elf_Mips_ABIFlags = llvm::object::Elf_Mips_ABIFlags<ELFT>;
 
 public:
   static MipsAbiFlagsSection *create();
@@ -895,8 +895,8 @@ private:
 
 // .MIPS.options section.
 template <class ELFT> class MipsOptionsSection final : public SyntheticSection {
-  typedef llvm::object::Elf_Mips_Options<ELFT> Elf_Mips_Options;
-  typedef llvm::object::Elf_Mips_RegInfo<ELFT> Elf_Mips_RegInfo;
+  using Elf_Mips_Options = llvm::object::Elf_Mips_Options<ELFT>;
+  using Elf_Mips_RegInfo = llvm::object::Elf_Mips_RegInfo<ELFT>;
 
 public:
   static MipsOptionsSection *create();
@@ -914,7 +914,7 @@ private:
 
 // MIPS .reginfo section.
 template <class ELFT> class MipsReginfoSection final : public SyntheticSection {
-  typedef llvm::object::Elf_Mips_RegInfo<ELFT> Elf_Mips_RegInfo;
+  using Elf_Mips_RegInfo = llvm::object::Elf_Mips_RegInfo<ELFT>;
 
 public:
   static MipsReginfoSection *create();

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=357372&r1=357371&r2=357372&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Sun Mar 31 17:11:24 2019
@@ -40,9 +40,9 @@ namespace {
 template <class ELFT> class Writer {
 public:
   Writer() : Buffer(errorHandler().OutputBuffer) {}
-  typedef typename ELFT::Shdr Elf_Shdr;
-  typedef typename ELFT::Ehdr Elf_Ehdr;
-  typedef typename ELFT::Phdr Elf_Phdr;
+  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-commits mailing list