[MC] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).

llvm-svn: 301485
This commit is contained in:
Eugene Zelenko 2017-04-26 22:31:39 +00:00
parent 4f013bb3b2
commit 7975b99fe6
19 changed files with 78 additions and 69 deletions

View File

@ -42,7 +42,7 @@ struct ConstantPoolEntry {
// A class to keep track of assembler-generated constant pools that are use to
// implement the ldr-pseudo.
class ConstantPool {
typedef SmallVector<ConstantPoolEntry, 4> EntryVecTy;
using EntryVecTy = SmallVector<ConstantPoolEntry, 4>;
EntryVecTy Entries;
DenseMap<int64_t, const MCSymbolRefExpr *> CachedEntries;
@ -80,7 +80,7 @@ class AssemblerConstantPools {
// sections in a stable order to ensure that we have print the
// constant pools in a deterministic order when printing an assembly
// file.
typedef MapVector<MCSection *, ConstantPool> ConstantPoolMapTy;
using ConstantPoolMapTy = MapVector<MCSection *, ConstantPool>;
ConstantPoolMapTy ConstantPools;
public:

View File

@ -1,4 +1,4 @@
//===-- llvm/MC/LaneBitmask.h -----------------------------------*- C++ -*-===//
//===- llvm/MC/LaneBitmask.h ------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@ -30,14 +30,16 @@
#ifndef LLVM_MC_LANEBITMASK_H
#define LLVM_MC_LANEBITMASK_H
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/Printable.h"
#include "llvm/Support/raw_ostream.h"
namespace llvm {
struct LaneBitmask {
// When changing the underlying type, change the format string as well.
typedef unsigned Type;
using Type = unsigned;
enum : unsigned { BitWidth = 8*sizeof(Type) };
constexpr static const char *const FormatStr = "%08X";
@ -84,6 +86,7 @@ namespace llvm {
OS << format(LaneBitmask::FormatStr, LaneMask.getAsInteger());
});
}
}
} // end namespace llvm
#endif // LLVM_MC_LANEBITMASK_H

View File

@ -60,36 +60,36 @@ class MCAssembler {
friend class MCAsmLayout;
public:
typedef std::vector<MCSection *> SectionListType;
typedef std::vector<const MCSymbol *> SymbolDataListType;
using SectionListType = std::vector<MCSection *>;
using SymbolDataListType = std::vector<const MCSymbol *>;
typedef pointee_iterator<SectionListType::const_iterator> const_iterator;
typedef pointee_iterator<SectionListType::iterator> iterator;
using const_iterator = pointee_iterator<SectionListType::const_iterator>;
using iterator = pointee_iterator<SectionListType::iterator>;
typedef pointee_iterator<SymbolDataListType::const_iterator>
const_symbol_iterator;
typedef pointee_iterator<SymbolDataListType::iterator> symbol_iterator;
using const_symbol_iterator =
pointee_iterator<SymbolDataListType::const_iterator>;
using symbol_iterator = pointee_iterator<SymbolDataListType::iterator>;
typedef iterator_range<symbol_iterator> symbol_range;
typedef iterator_range<const_symbol_iterator> const_symbol_range;
using symbol_range = iterator_range<symbol_iterator>;
using const_symbol_range = iterator_range<const_symbol_iterator>;
typedef std::vector<IndirectSymbolData>::const_iterator
const_indirect_symbol_iterator;
typedef std::vector<IndirectSymbolData>::iterator indirect_symbol_iterator;
using const_indirect_symbol_iterator =
std::vector<IndirectSymbolData>::const_iterator;
using indirect_symbol_iterator = std::vector<IndirectSymbolData>::iterator;
typedef std::vector<DataRegionData>::const_iterator
const_data_region_iterator;
typedef std::vector<DataRegionData>::iterator data_region_iterator;
using const_data_region_iterator =
std::vector<DataRegionData>::const_iterator;
using data_region_iterator = std::vector<DataRegionData>::iterator;
/// MachO specific deployment target version info.
// A Major version of 0 indicates that no version information was supplied
// and so the corresponding load command should not be emitted.
typedef struct {
using VersionMinInfoType = struct {
MCVersionMinType Kind;
unsigned Major;
unsigned Minor;
unsigned Update;
} VersionMinInfoType;
};
private:
MCContext &Context;

View File

@ -46,17 +46,19 @@ namespace llvm {
class MCSectionELF;
class MCSectionMachO;
class MCSectionWasm;
class MCStreamer;
class MCSymbol;
class MCSymbolELF;
class MCSymbolWasm;
class SMLoc;
class SourceMgr;
/// Context object for machine code objects. This class owns all of the
/// sections that it creates.
///
class MCContext {
public:
typedef StringMap<MCSymbol *, BumpPtrAllocator &> SymbolTable;
using SymbolTable = StringMap<MCSymbol *, BumpPtrAllocator &>;
private:
/// The SourceMgr for this object, if any.
@ -223,10 +225,12 @@ namespace llvm {
std::string SectionName;
StringRef GroupName;
unsigned UniqueID;
WasmSectionKey(StringRef SectionName, StringRef GroupName,
unsigned UniqueID)
: SectionName(SectionName), GroupName(GroupName), UniqueID(UniqueID) {
}
bool operator<(const WasmSectionKey &Other) const {
if (SectionName != Other.SectionName)
return SectionName < Other.SectionName;

View File

@ -168,10 +168,10 @@ public:
MCLineDivisions[Sec].push_back(LineEntry);
}
typedef std::vector<MCDwarfLineEntry> MCDwarfLineEntryCollection;
typedef MCDwarfLineEntryCollection::iterator iterator;
typedef MCDwarfLineEntryCollection::const_iterator const_iterator;
typedef MapVector<MCSection *, MCDwarfLineEntryCollection> MCLineDivisionMap;
using MCDwarfLineEntryCollection = std::vector<MCDwarfLineEntry>;
using iterator = MCDwarfLineEntryCollection::iterator;
using const_iterator = MCDwarfLineEntryCollection::const_iterator;
using MCLineDivisionMap = MapVector<MCSection *, MCDwarfLineEntryCollection>;
private:
// A collection of MCDwarfLineEntry for each section.

View File

@ -28,7 +28,8 @@ class MCSymbol;
class MCValue;
class raw_ostream;
class StringRef;
typedef DenseMap<const MCSection *, uint64_t> SectionAddrMap;
using SectionAddrMap = DenseMap<const MCSection *, uint64_t>;
/// \brief Base class for the full range of assembler expressions which are
/// needed for parsing.

View File

@ -200,8 +200,8 @@ protected:
Sec) {}
public:
typedef SmallVectorImpl<MCFixup>::const_iterator const_fixup_iterator;
typedef SmallVectorImpl<MCFixup>::iterator fixup_iterator;
using const_fixup_iterator = SmallVectorImpl<MCFixup>::const_iterator;
using fixup_iterator = SmallVectorImpl<MCFixup>::iterator;
SmallVectorImpl<MCFixup> &getFixups() { return Fixups; }
const SmallVectorImpl<MCFixup> &getFixups() const { return Fixups; }

View File

@ -176,8 +176,9 @@ public:
void addOperand(const MCOperand &Op) { Operands.push_back(Op); }
typedef SmallVectorImpl<MCOperand>::iterator iterator;
typedef SmallVectorImpl<MCOperand>::const_iterator const_iterator;
using iterator = SmallVectorImpl<MCOperand>::iterator;
using const_iterator = SmallVectorImpl<MCOperand>::const_iterator;
void clear() { Operands.clear(); }
void erase(iterator I) { Operands.erase(I); }
size_t size() const { return Operands.size(); }

View File

@ -111,7 +111,7 @@ class MCLOHDirective {
const MCAsmLayout &Layout) const;
public:
typedef SmallVectorImpl<MCSymbol *> LOHArgs;
using LOHArgs = SmallVectorImpl<MCSymbol *>;
MCLOHDirective(MCLOHType Kind, const LOHArgs &Args)
: Kind(Kind), Args(Args.begin(), Args.end()) {
@ -140,7 +140,7 @@ class MCLOHContainer {
SmallVector<MCLOHDirective, 32> Directives;
public:
typedef SmallVectorImpl<MCLOHDirective> LOHDirectives;
using LOHDirectives = SmallVectorImpl<MCLOHDirective>;
MCLOHContainer() = default;
@ -179,8 +179,8 @@ public:
};
// Add types for specialized template using MCSymbol.
typedef MCLOHDirective::LOHArgs MCLOHArgs;
typedef MCLOHContainer::LOHDirectives MCLOHDirectives;
using MCLOHArgs = MCLOHDirective::LOHArgs;
using MCLOHDirectives = MCLOHContainer::LOHDirectives;
} // end namespace llvm

View File

@ -67,9 +67,9 @@ public:
/// assembly parsers.
class MCAsmParser {
public:
typedef bool (*DirectiveHandler)(MCAsmParserExtension*, StringRef, SMLoc);
typedef std::pair<MCAsmParserExtension*, DirectiveHandler>
ExtensionDirectiveHandler;
using DirectiveHandler = bool (*)(MCAsmParserExtension*, StringRef, SMLoc);
using ExtensionDirectiveHandler =
std::pair<MCAsmParserExtension*, DirectiveHandler>;
struct MCPendingError {
SMLoc Loc;

View File

@ -27,7 +27,7 @@ class MCStreamer;
class MCSubtargetInfo;
template <typename T> class SmallVectorImpl;
typedef SmallVectorImpl<std::unique_ptr<MCParsedAsmOperand>> OperandVector;
using OperandVector = SmallVectorImpl<std::unique_ptr<MCParsedAsmOperand>>;
enum AsmRewriteKind {
AOK_Delete = 0, // Rewrite should be ignored.

View File

@ -27,13 +27,13 @@ namespace llvm {
/// An unsigned integer type large enough to represent all physical registers,
/// but not necessarily virtual registers.
typedef uint16_t MCPhysReg;
using MCPhysReg = uint16_t;
/// MCRegisterClass - Base class of TargetRegisterClass.
class MCRegisterClass {
public:
typedef const MCPhysReg* iterator;
typedef const MCPhysReg* const_iterator;
using iterator = const MCPhysReg*;
using const_iterator = const MCPhysReg*;
const iterator RegsBegin;
const uint8_t *const RegSet;
@ -134,7 +134,7 @@ struct MCRegisterDesc {
///
class MCRegisterInfo {
public:
typedef const MCRegisterClass *regclass_iterator;
using regclass_iterator = const MCRegisterClass *;
/// DwarfLLVMRegPair - Emitted by tablegen so Dwarf<->LLVM reg mappings can be
/// performed with a binary search.

View File

@ -47,13 +47,13 @@ public:
BundleLockedAlignToEnd
};
typedef iplist<MCFragment> FragmentListType;
using FragmentListType = iplist<MCFragment>;
typedef FragmentListType::const_iterator const_iterator;
typedef FragmentListType::iterator iterator;
using const_iterator = FragmentListType::const_iterator;
using iterator = FragmentListType::iterator;
typedef FragmentListType::const_reverse_iterator const_reverse_iterator;
typedef FragmentListType::reverse_iterator reverse_iterator;
using const_reverse_iterator = FragmentListType::const_reverse_iterator;
using reverse_iterator = FragmentListType::reverse_iterator;
private:
MCSymbol *Begin;

View File

@ -44,12 +44,11 @@ class MCInstPrinter;
class MCSection;
class MCStreamer;
class MCSymbolRefExpr;
class MCSymbolWasm;
class MCSubtargetInfo;
class raw_ostream;
class Twine;
typedef std::pair<MCSection *, const MCExpr *> MCSectionSubPair;
using MCSectionSubPair = std::pair<MCSection *, const MCExpr *>;
/// Target specific streamer interface. This is used so that targets can
/// implement support for target specific assembly directives.

View File

@ -26,6 +26,7 @@
#include <string>
namespace llvm {
class MachineInstr;
class MCInst;
@ -63,8 +64,7 @@ public:
MCSubtargetInfo() = delete;
MCSubtargetInfo &operator=(const MCSubtargetInfo &) = delete;
MCSubtargetInfo &operator=(MCSubtargetInfo &&) = delete;
virtual ~MCSubtargetInfo() {}
virtual ~MCSubtargetInfo() = default;
/// getTargetTriple - Return the target triple string.
const Triple &getTargetTriple() const { return TargetTriple; }
@ -178,11 +178,11 @@ public:
/// Returns string representation of scheduler comment
virtual std::string getSchedInfoStr(const MachineInstr &MI) const {
return std::string();
return {};
}
virtual std::string getSchedInfoStr(MCInst const &MCI) const {
return std::string();
return {};
}
};

View File

@ -145,10 +145,10 @@ protected:
/// MCSymbol contains a uint64_t so is probably aligned to 8. On a 32-bit
/// system, the name is a pointer so isn't going to satisfy the 8 byte
/// alignment of uint64_t. Account for that here.
typedef union {
using NameEntryStorageTy = union {
const StringMapEntry<bool> *NameEntry;
uint64_t AlignmentPadding;
} NameEntryStorageTy;
};
MCSymbol(SymbolKind Kind, const StringMapEntry<bool> *Name, bool isTemporary)
: IsTemporary(isTemporary), IsRedefinable(false), IsUsed(false),

View File

@ -63,7 +63,7 @@ using namespace llvm;
namespace {
typedef DenseMap<const MCSectionELF *, uint32_t> SectionIndexMapTy;
using SectionIndexMapTy = DenseMap<const MCSectionELF *, uint32_t>;
class ELFObjectWriter;
@ -194,8 +194,8 @@ public:
ELFSymbolData &MSD, const MCAsmLayout &Layout);
// Start and end offset of each section
typedef std::map<const MCSectionELF *, std::pair<uint64_t, uint64_t>>
SectionOffsetsTy;
using SectionOffsetsTy =
std::map<const MCSectionELF *, std::pair<uint64_t, uint64_t>>;
bool shouldRelocateWithSymbol(const MCAssembler &Asm,
const MCSymbolRefExpr *RefA,
@ -208,7 +208,7 @@ public:
uint64_t &FixedValue) override;
// Map from a signature symbol to the group section index
typedef DenseMap<const MCSymbol *, unsigned> RevGroupMapTy;
using RevGroupMapTy = DenseMap<const MCSymbol *, unsigned>;
/// Compute the symbol table data
///

View File

@ -58,7 +58,7 @@ void StringTableBuilder::write(raw_ostream &OS) const {
OS << Data;
}
typedef std::pair<CachedHashStringRef, size_t> StringPair;
using StringPair = std::pair<CachedHashStringRef, size_t>;
void StringTableBuilder::write(uint8_t *Buf) const {
assert(isFinalized());

View File

@ -38,6 +38,7 @@
#include "llvm/Support/JamCRC.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
@ -54,7 +55,7 @@ using llvm::support::endian::write32le;
namespace {
typedef SmallString<COFF::NameSize> name;
using name = SmallString<COFF::NameSize>;
enum AuxiliaryType {
ATFunctionDefinition,
@ -75,7 +76,7 @@ class COFFSymbol {
public:
COFF::symbol Data = {};
typedef SmallVector<AuxSymbol, 1> AuxiliarySymbols;
using AuxiliarySymbols = SmallVector<AuxSymbol, 1>;
name Name;
int Index;
@ -107,7 +108,7 @@ struct COFFRelocation {
static size_t size() { return COFF::RelocationSize; }
};
typedef std::vector<COFFRelocation> relocations;
using relocations = std::vector<COFFRelocation>;
class COFFSection {
public:
@ -124,11 +125,11 @@ public:
class WinCOFFObjectWriter : public MCObjectWriter {
public:
typedef std::vector<std::unique_ptr<COFFSymbol>> symbols;
typedef std::vector<std::unique_ptr<COFFSection>> sections;
using symbols = std::vector<std::unique_ptr<COFFSymbol>>;
using sections = std::vector<std::unique_ptr<COFFSection>>;
typedef DenseMap<MCSymbol const *, COFFSymbol *> symbol_map;
typedef DenseMap<MCSection const *, COFFSection *> section_map;
using symbol_map = DenseMap<MCSymbol const *, COFFSymbol *>;
using section_map = DenseMap<MCSection const *, COFFSection *>;
std::unique_ptr<MCWinCOFFObjectTargetWriter> TargetObjectWriter;