Skip to content

[gardening][IRGen] Replace typedef with using #15514

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/swift/IRGen/Linking.h
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ class LinkInfo {

/// Allow LinkEntity to be used as a key for a DenseMap.
template <> struct llvm::DenseMapInfo<swift::irgen::LinkEntity> {
typedef swift::irgen::LinkEntity LinkEntity;
using LinkEntity = swift::irgen::LinkEntity;
static LinkEntity getEmptyKey() {
LinkEntity entity;
entity.Pointer = nullptr;
Expand Down
5 changes: 3 additions & 2 deletions lib/IRGen/ClassMetadataVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class IRGenModule;
template <class Impl> class ClassMetadataVisitor
: public NominalMetadataVisitor<Impl>,
public SILVTableVisitor<Impl> {
typedef NominalMetadataVisitor<Impl> super;
using super = NominalMetadataVisitor<Impl>;

protected:
using super::IGM;
Expand Down Expand Up @@ -157,7 +157,8 @@ template <class Impl> class ClassMetadataVisitor
/// the metadata layout, maintaining the offset of the next field.
template <class Impl>
class ClassMetadataScanner : public ClassMetadataVisitor<Impl> {
typedef ClassMetadataVisitor<Impl> super;
using super = ClassMetadataVisitor<Impl>;

protected:
Size NextOffset = Size(0);

Expand Down
3 changes: 2 additions & 1 deletion lib/IRGen/EnumMetadataVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ template <class Impl> class EnumMetadataVisitor
/// pointer-sized chunks) into the metadata for the next field.
template <class Impl>
class EnumMetadataScanner : public EnumMetadataVisitor<Impl> {
typedef EnumMetadataVisitor<Impl> super;
using super = EnumMetadataVisitor<Impl>;

protected:
Size NextOffset = Size(0);

Expand Down
10 changes: 5 additions & 5 deletions lib/IRGen/Explosion.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ class Explosion {
return Values.size() - NextValue;
}

typedef SmallVector<llvm::Value*, 8>::iterator iterator;
using iterator = SmallVector<llvm::Value *, 8>::iterator;
iterator begin() { return Values.begin() + NextValue; }
iterator end() { return Values.end(); }

typedef SmallVector<llvm::Value*, 8>::const_iterator const_iterator;
using const_iterator = SmallVector<llvm::Value *, 8>::const_iterator;
const_iterator begin() const { return Values.begin() + NextValue; }
const_iterator end() const { return Values.end(); }

Expand Down Expand Up @@ -233,9 +233,9 @@ class ExplosionSchema {
return Elements[index];
}

typedef SmallVectorImpl<Element>::iterator iterator;
typedef SmallVectorImpl<Element>::const_iterator const_iterator;
using iterator = SmallVectorImpl<Element>::iterator;
using const_iterator = SmallVectorImpl<Element>::const_iterator;

iterator begin() { return Elements.begin(); }
iterator end() { return Elements.end(); }
const_iterator begin() const { return Elements.begin(); }
Expand Down
3 changes: 2 additions & 1 deletion lib/IRGen/ForeignClassMetadataVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ class ForeignClassMetadataVisitor
/// the metadata layout, maintaining the offset of the next field.
template <class Impl>
class ForeignClassMetadataScanner : public ForeignClassMetadataVisitor<Impl> {
typedef ForeignClassMetadataVisitor<Impl> super;
using super = ForeignClassMetadataVisitor<Impl>;

protected:
Size NextOffset = Size(0);

Expand Down
2 changes: 1 addition & 1 deletion lib/IRGen/GenClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,7 @@ void IRGenModule::emitClassDecl(ClassDecl *D) {
}

namespace {
typedef std::pair<ClassDecl*, ModuleDecl*> CategoryNameKey;
using CategoryNameKey = std::pair<ClassDecl*, ModuleDecl*>;
/// Used to provide unique names to ObjC categories generated by Swift
/// extensions. The first category for a class in a module gets the module's
/// name as its key, e.g., NSObject (MySwiftModule). Another extension of the
Expand Down
2 changes: 1 addition & 1 deletion lib/IRGen/GenClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ namespace irgen {
Address emitTailProjection(IRGenFunction &IGF, llvm::Value *Base,
SILType ClassType, SILType TailType);

typedef llvm::ArrayRef<std::pair<SILType, llvm::Value *>> TailArraysRef;
using TailArraysRef = llvm::ArrayRef<std::pair<SILType, llvm::Value *>>;

/// Adds the size for tail allocated arrays to \p size and returns the new
/// size value. Also updades the alignment mask to represent the alignment of
Expand Down
12 changes: 6 additions & 6 deletions lib/IRGen/GenMeta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@ namespace {
/// generic metadata layout class.
template <class Impl, class Base>
class GenericMetadataBuilderBase : public Base {
typedef Base super;
using super = Base;

struct FillOp {
CanType Type;
Expand Down Expand Up @@ -2159,7 +2159,7 @@ namespace {
ClassMetadataBuilderBase<GenericClassMetadataBuilder,
ResilientClassMemberBuilder>>
{
typedef GenericMetadataBuilderBase super;
using super = GenericMetadataBuilderBase;

Optional<ConstantAggregateBuilderBase::PlaceholderPosition>
ClassRODataOffset, MetaclassObjectOffset, MetaclassRODataOffset;
Expand Down Expand Up @@ -2684,8 +2684,8 @@ namespace {
public GenericValueMetadataBuilderBase<GenericStructMetadataBuilder,
StructMetadataBuilderBase<GenericStructMetadataBuilder>> {

typedef GenericValueMetadataBuilderBase super;
using super = GenericValueMetadataBuilderBase;

public:
GenericStructMetadataBuilder(IRGenModule &IGM, StructDecl *theStruct,
ConstantStructBuilder &B)
Expand Down Expand Up @@ -3048,8 +3048,8 @@ namespace {
/// the first-used instance as the canonical instance for a process.
template<typename Impl, typename Base>
class ForeignMetadataBuilderBase : public Base {
typedef Base super;
using super = Base;

protected:
using super::IGM;
using super::asImpl;
Expand Down
9 changes: 5 additions & 4 deletions lib/IRGen/GenRecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class RecordTypeInfoImpl : public Base,
friend class llvm::TrailingObjects<Impl, FieldImpl_>;

public:
typedef FieldImpl_ FieldImpl;
using FieldImpl = FieldImpl_;

private:
const unsigned NumFields;
Expand Down Expand Up @@ -298,7 +298,7 @@ template <class Impl, class Base, class FieldImpl>
class RecordTypeInfo<Impl, Base, FieldImpl,
/*IsFixedSize*/ false, /*IsLoadable*/ false>
: public RecordTypeInfoImpl<Impl, Base, FieldImpl> {
typedef RecordTypeInfoImpl<Impl, Base, FieldImpl> super;
using super = RecordTypeInfoImpl<Impl, Base, FieldImpl>;

/// The index+1 of the unique non-empty field, or zero if there is none.
unsigned UniqueNonEmptyFieldIndexPlusOne;
Expand Down Expand Up @@ -378,7 +378,8 @@ template <class Impl, class Base, class FieldImpl>
class RecordTypeInfo<Impl, Base, FieldImpl,
/*IsFixedSize*/ true, /*IsLoadable*/ false>
: public RecordTypeInfoImpl<Impl, Base, FieldImpl> {
typedef RecordTypeInfoImpl<Impl, Base, FieldImpl> super;
using super = RecordTypeInfoImpl<Impl, Base, FieldImpl>;

protected:
template <class... As>
RecordTypeInfo(As&&...args) : super(std::forward<As>(args)...) {}
Expand All @@ -389,7 +390,7 @@ template <class Impl, class Base, class FieldImpl>
class RecordTypeInfo<Impl, Base, FieldImpl,
/*IsFixedSize*/ true, /*IsLoadable*/ true>
: public RecordTypeInfoImpl<Impl, Base, FieldImpl> {
typedef RecordTypeInfoImpl<Impl, Base, FieldImpl> super;
using super = RecordTypeInfoImpl<Impl, Base, FieldImpl>;

unsigned ExplosionSize : 16;

Expand Down
2 changes: 1 addition & 1 deletion lib/IRGen/GenStruct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ namespace {
template <class Impl, class Base, class FieldInfoType = StructFieldInfo>
class StructTypeInfoBase :
public RecordTypeInfo<Impl, Base, FieldInfoType> {
typedef RecordTypeInfo<Impl, Base, FieldInfoType> super;
using super = RecordTypeInfo<Impl, Base, FieldInfoType>;

protected:
template <class... As>
Expand Down
2 changes: 1 addition & 1 deletion lib/IRGen/GenTuple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ namespace {
template <class Impl, class Base>
class TupleTypeInfoBase
: public RecordTypeInfo<Impl, Base, TupleFieldInfo> {
typedef RecordTypeInfo<Impl, Base, TupleFieldInfo> super;
using super = RecordTypeInfo<Impl, Base, TupleFieldInfo>;

protected:
template <class... As>
Expand Down
2 changes: 1 addition & 1 deletion lib/IRGen/GenType.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace irgen {
class WeakTypeInfo;

/// Either a type or a forward-declaration.
typedef llvm::PointerUnion<const TypeInfo*, llvm::Type*> TypeCacheEntry;
using TypeCacheEntry = llvm::PointerUnion<const TypeInfo *, llvm::Type *>;

/// The helper class for generating types.
class TypeConverter {
Expand Down
3 changes: 2 additions & 1 deletion lib/IRGen/GenValueWitness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ namespace {
/// An implementation of DynamicPackingPHIMapping for Addresses.
template <> class DynamicPackingPHIMapping<Address>
: private DynamicPackingPHIMapping<llvm::Value*> {
typedef DynamicPackingPHIMapping<llvm::Value*> super;
using super = DynamicPackingPHIMapping<llvm::Value *>;

public:
void collect(IRGenFunction &IGF, Address value) {
super::collect(IGF, value.getAddress());
Expand Down
3 changes: 2 additions & 1 deletion lib/IRGen/HeapTypeInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ enum class IsaEncoding : uint8_t {
/// ReferenceCounting getReferenceCounting() const;
template <class Impl>
class HeapTypeInfo : public SingleScalarTypeInfo<Impl, ReferenceTypeInfo> {
typedef SingleScalarTypeInfo<Impl, ReferenceTypeInfo> super;
using super = SingleScalarTypeInfo<Impl, ReferenceTypeInfo>;

protected:
using super::asDerived;
public:
Expand Down
9 changes: 5 additions & 4 deletions lib/IRGen/IRBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ namespace irgen {
class FunctionPointer;
class IRGenModule;

typedef llvm::IRBuilder<> IRBuilderBase;
using IRBuilderBase = llvm::IRBuilder<>;

class IRBuilder : public IRBuilderBase {
public:
// Without this, it keeps resolving to llvm::IRBuilderBase because
// of the injected class name.
typedef irgen::IRBuilderBase IRBuilderBase;
using IRBuilderBase = irgen::IRBuilderBase;

private:
/// The block containing the insertion point when the insertion
Expand Down Expand Up @@ -115,7 +115,7 @@ class IRBuilder : public IRBuilderBase {
class StableIP {
/// Either an instruction that we're inserting after or the basic
/// block that we're inserting at the beginning of.
typedef llvm::PointerUnion<llvm::Instruction*, llvm::BasicBlock*> UnionTy;
using UnionTy = llvm::PointerUnion<llvm::Instruction *, llvm::BasicBlock *>;
UnionTy After;
public:
StableIP() = default;
Expand Down Expand Up @@ -400,7 +400,8 @@ class IRBuilder : public IRBuilderBase {

namespace llvm {
template <> struct PointerLikeTypeTraits<swift::irgen::IRBuilder::StableIP> {
typedef swift::irgen::IRBuilder::StableIP type;
using type = swift::irgen::IRBuilder::StableIP;

public:
static void *getAsVoidPointer(type IP) {
return IP.getOpaqueValue();
Expand Down
4 changes: 2 additions & 2 deletions lib/IRGen/IRGen.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ inline bool operator<=(OperationCost l, OperationCost r) {
/// An alignment value, in eight-bit units.
class Alignment {
public:
typedef uint32_t int_type;
using int_type = uint32_t;

constexpr Alignment() : Value(0) {}
constexpr explicit Alignment(int_type Value) : Value(Value) {}
Expand Down Expand Up @@ -334,7 +334,7 @@ class Alignment {
/// A size value, in eight-bit units.
class Size {
public:
typedef uint64_t int_type;
using int_type = uint64_t;

constexpr Size() : Value(0) {}
explicit constexpr Size(int_type Value) : Value(Value) {}
Expand Down
6 changes: 3 additions & 3 deletions lib/IRGen/IRGenDebugInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ using namespace swift;
using namespace irgen;

namespace {
typedef llvm::DenseMap<const llvm::MDString *, llvm::TrackingMDNodeRef>
TrackingDIRefMap;
using TrackingDIRefMap =
llvm::DenseMap<const llvm::MDString *, llvm::TrackingMDNodeRef>;

class IRGenDebugInfoImpl : public IRGenDebugInfo {
friend class IRGenDebugInfoImpl;
Expand All @@ -71,7 +71,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
IRGenModule &IGM;

/// Used for caching SILDebugScopes without inline information.
typedef std::pair<const void *, const void *> LocalScopeHash;
using LocalScopeHash = std::pair<const void *, const void *>;
struct LocalScope : public LocalScopeHash {
LocalScope(const SILDebugScope *DS)
: LocalScopeHash({DS->Loc.getOpaquePointerValue(),
Expand Down
2 changes: 1 addition & 1 deletion lib/IRGen/IRGenModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ class IRGenModule {
llvm::Constant *getOrCreateReleaseFunction(const TypeInfo &objectTI, Type t,
llvm::Type *llvmType);

typedef llvm::Constant *(IRGenModule::*OutlinedCopyAddrFunction)(
using OutlinedCopyAddrFunction = llvm::Constant *(IRGenModule::*)(
const TypeInfo &objectTI, llvm::Type *llvmType, SILType addrTy,
const llvm::MapVector<CanType, llvm::Value *> *typeToMetadataVec);

Expand Down
4 changes: 2 additions & 2 deletions lib/IRGen/IRGenSIL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,8 @@ class IRGenSILFunction :
/// With closure captures it is actually possible to have two function
/// arguments that both have the same name. Until this is fixed, we need to
/// also hash the ArgNo here.
typedef std::pair<unsigned, std::pair<const SILDebugScope *, StringRef>>
StackSlotKey;
using StackSlotKey =
std::pair<unsigned, std::pair<const SILDebugScope *, StringRef>>;
/// Keeps track of the mapping of source variables to -O0 shadow copy allocas.
llvm::SmallDenseMap<StackSlotKey, Address, 8> ShadowStackSlots;
llvm::SmallDenseMap<Decl *, SmallString<4>, 8> AnonymousVariables;
Expand Down
2 changes: 1 addition & 1 deletion lib/IRGen/NonFixedTypeInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void emitStoreEnumTagSinglePayload(IRGenFunction &IGF, llvm::Value *whichCase,
template <class Impl>
class WitnessSizedTypeInfo : public IndirectTypeInfo<Impl, TypeInfo> {
private:
typedef IndirectTypeInfo<Impl, TypeInfo> super;
using super = IndirectTypeInfo<Impl, TypeInfo>;

protected:
const Impl &asImpl() const { return static_cast<const Impl &>(*this); }
Expand Down
2 changes: 1 addition & 1 deletion lib/IRGen/StructLayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ enum class LayoutKind {
class NonFixedOffsetsImpl;

/// The type to pass around for non-fixed offsets.
typedef Optional<NonFixedOffsetsImpl*> NonFixedOffsets;
using NonFixedOffsets = Optional<NonFixedOffsetsImpl *>;

/// An abstract class for determining non-fixed offsets.
class NonFixedOffsetsImpl {
Expand Down
3 changes: 2 additions & 1 deletion lib/IRGen/StructMetadataVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ template <class Impl> class StructMetadataVisitor
/// the metadata layout, maintaining the offset of the next field.
template <class Impl>
class StructMetadataScanner : public StructMetadataVisitor<Impl> {
typedef StructMetadataVisitor<Impl> super;
using super = StructMetadataVisitor<Impl>;

protected:
Size NextOffset = Size(0);

Expand Down