Index: lld/trunk/COFF/Driver.cpp =================================================================== --- lld/trunk/COFF/Driver.cpp +++ lld/trunk/COFF/Driver.cpp @@ -96,7 +96,7 @@ // 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::error_code> MBErrPair; +using MBErrPair = std::pair, std::error_code>; // Create a std::future that opens and maps a file using the best strategy for // the host platform. Index: lld/trunk/COFF/MapFile.cpp =================================================================== --- lld/trunk/COFF/MapFile.cpp +++ lld/trunk/COFF/MapFile.cpp @@ -32,8 +32,8 @@ using namespace lld; using namespace lld::coff; -typedef DenseMap> - SymbolMapTy; +using SymbolMapTy = + DenseMap>; static const std::string Indent8 = " "; // 8 spaces static const std::string Indent16 = " "; // 16 spaces Index: lld/trunk/ELF/CallGraphSort.cpp =================================================================== --- lld/trunk/ELF/CallGraphSort.cpp +++ lld/trunk/ELF/CallGraphSort.cpp @@ -92,8 +92,8 @@ constexpr uint64_t MAX_CLUSTER_SIZE = 1024 * 1024; } // end anonymous namespace -typedef std::pair - SectionPair; +using SectionPair = + std::pair; // Take the edge list in Config->CallGraphProfile, resolve symbol names to // Symbols, and generate a graph between InputSections with the provided Index: lld/trunk/ELF/InputFiles.h =================================================================== --- lld/trunk/ELF/InputFiles.h +++ lld/trunk/ELF/InputFiles.h @@ -147,10 +147,10 @@ template 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 @@ // .o file. template class ObjFile : public ELFFileBase { - typedef ELFFileBase 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; + 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 Sections, const Elf_Shdr &Sec); @@ -321,13 +321,13 @@ // .so file. template class SharedFile : public ELFFileBase { - typedef ELFFileBase 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; + 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; Index: lld/trunk/ELF/InputSection.cpp =================================================================== --- lld/trunk/ELF/InputSection.cpp +++ lld/trunk/ELF/InputSection.cpp @@ -210,8 +210,8 @@ // 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 @@ // Copy SHT_GROUP section contents. Used only for the -r option. template 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 From = getDataAs(); auto *To = reinterpret_cast(Buf); Index: lld/trunk/ELF/LinkerScript.h =================================================================== --- lld/trunk/ELF/LinkerScript.h +++ lld/trunk/ELF/LinkerScript.h @@ -67,7 +67,7 @@ // 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 Expr; +using Expr = std::function; // This enum is used to implement linker script SECTIONS command. // https://sourceware.org/binutils/docs/ld/SECTIONS.html#SECTIONS Index: lld/trunk/ELF/MapFile.cpp =================================================================== --- lld/trunk/ELF/MapFile.cpp +++ lld/trunk/ELF/MapFile.cpp @@ -37,7 +37,7 @@ using namespace lld; using namespace lld::elf; -typedef DenseMap> SymbolMapTy; +using SymbolMapTy = DenseMap>; static const std::string Indent8 = " "; // 8 spaces static const std::string Indent16 = " "; // 16 spaces Index: lld/trunk/ELF/OutputSections.cpp =================================================================== --- lld/trunk/ELF/OutputSections.cpp +++ lld/trunk/ELF/OutputSections.cpp @@ -138,7 +138,7 @@ static void sortByOrder(MutableArrayRef In, llvm::function_ref Order) { - typedef std::pair Pair; + using Pair = std::pair; auto Comp = [](const Pair &A, const Pair &B) { return A.first < B.first; }; std::vector V; @@ -179,7 +179,7 @@ // Compress section contents if this section contains debug info. template 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) || Index: lld/trunk/ELF/Relocations.h =================================================================== --- lld/trunk/ELF/Relocations.h +++ lld/trunk/ELF/Relocations.h @@ -23,7 +23,7 @@ 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 Index: lld/trunk/ELF/Relocations.cpp =================================================================== --- lld/trunk/ELF/Relocations.cpp +++ lld/trunk/ELF/Relocations.cpp @@ -479,7 +479,7 @@ // Returns true if a given shared symbol is in a read-only segment in a DSO. template 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 &File = SS.getFile(); @@ -498,7 +498,7 @@ // Otherwise, they would refer to different places at runtime. template static SmallSet getSymbolsAt(SharedSymbol &SS) { - typedef typename ELFT::Sym Elf_Sym; + using Elf_Sym = typename ELFT::Sym; SharedFile &File = SS.getFile(); Index: lld/trunk/ELF/SyntheticSections.h =================================================================== --- lld/trunk/ELF/SyntheticSections.h +++ lld/trunk/ELF/SyntheticSections.h @@ -308,7 +308,7 @@ uint64_t Size = 0; // Symbol and addend. - typedef std::pair GotEntry; + using GotEntry = std::pair; struct FileGot { InputFile *File = nullptr; @@ -443,12 +443,12 @@ }; template 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>> Entries; @@ -496,8 +496,8 @@ template 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 @@ template 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 @@ // https://groups.google.com/forum/#!topic/generic-abi/bX460iggiKg // For more details, see the comment in RelrSection::updateAllocSize(). template class RelrSection final : public RelrBaseSection { - typedef typename ELFT::Relr Elf_Relr; + using Elf_Relr = typename ELFT::Relr; public: RelrSection(); @@ -589,7 +589,7 @@ template 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 @@ // mapping from version identifiers to version names. template 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 @@ // .MIPS.abiflags section. template class MipsAbiFlagsSection final : public SyntheticSection { - typedef llvm::object::Elf_Mips_ABIFlags Elf_Mips_ABIFlags; + using Elf_Mips_ABIFlags = llvm::object::Elf_Mips_ABIFlags; public: static MipsAbiFlagsSection *create(); @@ -895,8 +895,8 @@ // .MIPS.options section. template class MipsOptionsSection final : public SyntheticSection { - typedef llvm::object::Elf_Mips_Options Elf_Mips_Options; - typedef llvm::object::Elf_Mips_RegInfo Elf_Mips_RegInfo; + using Elf_Mips_Options = llvm::object::Elf_Mips_Options; + using Elf_Mips_RegInfo = llvm::object::Elf_Mips_RegInfo; public: static MipsOptionsSection *create(); @@ -914,7 +914,7 @@ // MIPS .reginfo section. template class MipsReginfoSection final : public SyntheticSection { - typedef llvm::object::Elf_Mips_RegInfo Elf_Mips_RegInfo; + using Elf_Mips_RegInfo = llvm::object::Elf_Mips_RegInfo; public: static MipsReginfoSection *create(); Index: lld/trunk/ELF/SyntheticSections.cpp =================================================================== --- lld/trunk/ELF/SyntheticSections.cpp +++ lld/trunk/ELF/SyntheticSections.cpp @@ -2474,8 +2474,8 @@ static std::vector createSymbols(ArrayRef> NameAttrs, const std::vector &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 @@ // 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 Fdes = In.EhFrame->getFdeData(); Index: lld/trunk/ELF/Writer.cpp =================================================================== --- lld/trunk/ELF/Writer.cpp +++ lld/trunk/ELF/Writer.cpp @@ -40,9 +40,9 @@ template 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();