Skip to content

[gardening][SIL] Replace typedef with using #15759

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
Apr 6, 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
8 changes: 4 additions & 4 deletions include/swift/SIL/CFG.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ struct GraphTraits<swift::SILFunction *>

static NodeRef getEntryNode(GraphType F) { return &F->front(); }

typedef pointer_iterator<swift::SILFunction::iterator> nodes_iterator;
using nodes_iterator = pointer_iterator<swift::SILFunction::iterator>;
static nodes_iterator nodes_begin(GraphType F) {
return nodes_iterator(F->begin());
}
Expand All @@ -104,12 +104,12 @@ struct GraphTraits<swift::SILFunction *>

template <> struct GraphTraits<Inverse<swift::SILFunction*> >
: public GraphTraits<Inverse<swift::SILBasicBlock*> > {
typedef Inverse<swift::SILFunction *> GraphType;
typedef NodeRef NodeRef;
using GraphType = Inverse<swift::SILFunction *>;
using NodeRef = NodeRef;

static NodeRef getEntryNode(GraphType F) { return &F.Graph->front(); }

typedef pointer_iterator<swift::SILFunction::iterator> nodes_iterator;
using nodes_iterator = pointer_iterator<swift::SILFunction::iterator>;
static nodes_iterator nodes_begin(GraphType F) {
return nodes_iterator(F.Graph->begin());
}
Expand Down
4 changes: 2 additions & 2 deletions include/swift/SIL/Dominance.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ namespace llvm {
/// iterable by generic graph iterators.
template <> struct GraphTraits<swift::DominanceInfoNode *> {
using ChildIteratorType = swift::DominanceInfoNode::iterator;
typedef swift::DominanceInfoNode *NodeRef;
using NodeRef = swift::DominanceInfoNode *;

static NodeRef getEntryNode(NodeRef N) { return N; }
static inline ChildIteratorType child_begin(NodeRef N) { return N->begin(); }
Expand All @@ -201,7 +201,7 @@ template <> struct GraphTraits<swift::DominanceInfoNode *> {

template <> struct GraphTraits<const swift::DominanceInfoNode *> {
using ChildIteratorType = swift::DominanceInfoNode::const_iterator;
typedef const swift::DominanceInfoNode *NodeRef;
using NodeRef = const swift::DominanceInfoNode *;

static NodeRef getEntryNode(NodeRef N) { return N; }
static inline ChildIteratorType child_begin(NodeRef N) { return N->begin(); }
Expand Down
14 changes: 7 additions & 7 deletions include/swift/SIL/PatternMatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,17 @@ struct OneOf_match;

template <typename T0>
struct OneOf_match<T0> {
typedef T0 Ty;
using Ty = T0;
};

template <typename T0, typename T1>
struct OneOf_match<T0, T1> {
typedef match_combine_or<T0, T1> Ty;
using Ty = match_combine_or<T0, T1>;
};

template <typename T0, typename T1, typename ...Arguments>
struct OneOf_match<T0, T1, Arguments ...> {
typedef typename OneOf_match<match_combine_or<T0, T1>, Arguments ...>::Ty Ty;
using Ty = typename OneOf_match<match_combine_or<T0, T1>, Arguments...>::Ty;
};

/// This is a vararg version of m_CombineOr. It is a boolean "or" of
Expand Down Expand Up @@ -584,18 +584,18 @@ struct Apply_match;

template <typename CalleeTy>
struct Apply_match<CalleeTy> {
typedef Callee_match<CalleeTy> Ty;
using Ty = Callee_match<CalleeTy>;
};

template <typename CalleeTy, typename T0>
struct Apply_match<CalleeTy, T0> {
typedef match_combine_and<Callee_match<CalleeTy>, Argument_match<T0>> Ty;
using Ty = match_combine_and<Callee_match<CalleeTy>, Argument_match<T0>>;
};

template <typename CalleeTy, typename T0, typename ...Arguments>
struct Apply_match<CalleeTy, T0, Arguments ...> {
typedef match_combine_and<typename Apply_match<CalleeTy, Arguments ...>::Ty,
Argument_match<T0> > Ty;
using Ty = match_combine_and<typename Apply_match<CalleeTy, Arguments...>::Ty,
Argument_match<T0>>;
};

/// Match only an ApplyInst's Callee.
Expand Down
2 changes: 1 addition & 1 deletion include/swift/SIL/SILCoverageMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ namespace llvm {
template <>
struct ilist_traits<::swift::SILCoverageMap>
: public ilist_default_traits<::swift::SILCoverageMap> {
typedef ::swift::SILCoverageMap SILCoverageMap;
using SILCoverageMap = ::swift::SILCoverageMap;

public:
static void deleteNode(SILCoverageMap *VT) { VT->~SILCoverageMap(); }
Expand Down
2 changes: 1 addition & 1 deletion include/swift/SIL/SILDebuggerClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class SILBuilder;

class SILDebuggerClient : public DebuggerClient {
public:
typedef SmallVectorImpl<LookupResultEntry> ResultVector;
using ResultVector = SmallVectorImpl<LookupResultEntry>;

SILDebuggerClient(ASTContext &C) : DebuggerClient(C) { }
virtual ~SILDebuggerClient() = default;
Expand Down
4 changes: 2 additions & 2 deletions include/swift/SIL/SILDeclRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ enum ForDefinition_t : bool {
/// declaration, such as uncurry levels of a function, the allocating and
/// initializing entry points of a constructor, etc.
struct SILDeclRef {
typedef llvm::PointerUnion<ValueDecl *, AbstractClosureExpr *> Loc;
using Loc = llvm::PointerUnion<ValueDecl *, AbstractClosureExpr *>;

/// Represents the "kind" of the SILDeclRef. For some Swift decls there
/// are multiple SIL entry points, and the kind is used to distinguish them.
enum class Kind : unsigned {
Expand Down
2 changes: 1 addition & 1 deletion include/swift/SIL/SILDefaultWitnessTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ namespace llvm {
template <>
struct ilist_traits<::swift::SILDefaultWitnessTable> :
public ilist_default_traits<::swift::SILDefaultWitnessTable> {
typedef ::swift::SILDefaultWitnessTable SILDefaultWitnessTable;
using SILDefaultWitnessTable = ::swift::SILDefaultWitnessTable;

public:
static void deleteNode(SILDefaultWitnessTable *WT) { WT->~SILDefaultWitnessTable(); }
Expand Down
10 changes: 5 additions & 5 deletions include/swift/SIL/SILFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class SILSpecializeAttr final {
class SILFunction
: public llvm::ilist_node<SILFunction>, public SILAllocated<SILFunction> {
public:
typedef llvm::iplist<SILBasicBlock> BlockListType;
using BlockListType = llvm::iplist<SILBasicBlock>;

private:
friend class SILBasicBlock;
Expand Down Expand Up @@ -694,9 +694,9 @@ class SILFunction
BlockListType &getBlocks() { return BlockList; }
const BlockListType &getBlocks() const { return BlockList; }

typedef BlockListType::iterator iterator;
typedef BlockListType::reverse_iterator reverse_iterator;
typedef BlockListType::const_iterator const_iterator;
using iterator = BlockListType::iterator;
using reverse_iterator = BlockListType::reverse_iterator;
using const_iterator = BlockListType::const_iterator;

bool empty() const { return BlockList.empty(); }
iterator begin() { return BlockList.begin(); }
Expand Down Expand Up @@ -881,7 +881,7 @@ namespace llvm {
template <>
struct ilist_traits<::swift::SILFunction> :
public ilist_default_traits<::swift::SILFunction> {
typedef ::swift::SILFunction SILFunction;
using SILFunction = ::swift::SILFunction;

public:
static void deleteNode(SILFunction *V) { V->~SILFunction(); }
Expand Down
2 changes: 1 addition & 1 deletion include/swift/SIL/SILGlobalVariable.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ namespace llvm {
template <>
struct ilist_traits<::swift::SILGlobalVariable> :
public ilist_default_traits<::swift::SILGlobalVariable> {
typedef ::swift::SILGlobalVariable SILGlobalVariable;
using SILGlobalVariable = ::swift::SILGlobalVariable;

public:
static void deleteNode(SILGlobalVariable *V) {}
Expand Down
9 changes: 5 additions & 4 deletions include/swift/SIL/SILInstruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -1081,8 +1081,8 @@ class InstructionBaseWithTrailingOperands
protected:
friend llvm::TrailingObjects<Derived, Operand, OtherTrailingTypes...>;

typedef llvm::TrailingObjects<Derived, Operand, OtherTrailingTypes...>
TrailingObjects;
using TrailingObjects =
llvm::TrailingObjects<Derived, Operand, OtherTrailingTypes...>;

using TrailingObjects::totalSizeToAlloc;

Expand Down Expand Up @@ -1158,8 +1158,9 @@ class UnaryInstructionWithTypeDependentOperandsBase
friend InstructionBaseWithTrailingOperands<Kind, Derived, Operand,
OtherTrailingTypes...>;

typedef InstructionBaseWithTrailingOperands<
Kind, Derived, Operand, OtherTrailingTypes...> TrailingObjects;
using TrailingObjects =
InstructionBaseWithTrailingOperands<Kind, Derived, Operand,
OtherTrailingTypes...>;

public:
template <typename... Args>
Expand Down
4 changes: 2 additions & 2 deletions include/swift/SIL/SILLocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class SILLocation {
using type = Pattern;
};

typedef llvm::PointerUnion4<Stmt*, Expr*, Decl*, Pattern*> ASTNodeTy;
using ASTNodeTy = llvm::PointerUnion4<Stmt *, Expr *, Decl *, Pattern *>;

public:
enum LocationKind : unsigned {
Expand Down Expand Up @@ -419,7 +419,7 @@ class SILLocation {
}

/// Fingerprint a DebugLoc for use in a DenseMap.
typedef std::pair<std::pair<unsigned, unsigned>, StringRef> DebugLocKey;
using DebugLocKey = std::pair<std::pair<unsigned, unsigned>, StringRef>;
struct DebugLocHash : public DebugLocKey {
DebugLocHash(DebugLoc L) : DebugLocKey({{L.Line, L.Column}, L.Filename}) {}
};
Expand Down
2 changes: 1 addition & 1 deletion include/swift/SIL/SILModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ class SILModule {
// Callbacks registered by the SIL optimizer to run on each deserialized
// function body. This is intentionally a stateless type because the
// ModuleDecl and SILFunction should be sufficient context.
typedef void (*SILFunctionBodyCallback)(ModuleDecl *, SILFunction *F);
using SILFunctionBodyCallback = void (*)(ModuleDecl *, SILFunction *F);
SmallVector<SILFunctionBodyCallback, 0> DeserializationCallbacks;

/// The SILLoader used when linking functions into this module.
Expand Down
2 changes: 1 addition & 1 deletion include/swift/SIL/SILProperty.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ namespace llvm {
template <>
struct ilist_traits<::swift::SILProperty>
: public ilist_default_traits<::swift::SILProperty> {
typedef ::swift::SILProperty SILProperty;
using SILProperty = ::swift::SILProperty;

public:
static void deleteNode(SILProperty *VT) { VT->~SILProperty(); }
Expand Down
2 changes: 1 addition & 1 deletion include/swift/SIL/SILVTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ namespace llvm {
template <>
struct ilist_traits<::swift::SILVTable> :
public ilist_default_traits<::swift::SILVTable> {
typedef ::swift::SILVTable SILVTable;
using SILVTable = ::swift::SILVTable;

static void deleteNode(SILVTable *VT) { VT->~SILVTable(); }

Expand Down
4 changes: 2 additions & 2 deletions include/swift/SIL/SILValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ class Operand {
inline SILValue getSILValueType(const Operand &op) {
return op.get();
}
typedef ArrayRefView<Operand,SILValue,getSILValueType> OperandValueArrayRef;
using OperandValueArrayRef = ArrayRefView<Operand, SILValue, getSILValueType>;

/// An iterator over all uses of a ValueBase.
class ValueBaseUseIterator : public std::iterator<std::forward_iterator_tag,
Expand Down Expand Up @@ -600,7 +600,7 @@ inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, SILValue V) {
namespace llvm {
/// A SILValue casts like a ValueBase *.
template<> struct simplify_type<const ::swift::SILValue> {
typedef ::swift::ValueBase *SimpleType;
using SimpleType = ::swift::ValueBase *;
static SimpleType getSimplifiedValue(::swift::SILValue Val) {
return Val;
}
Expand Down
2 changes: 1 addition & 1 deletion include/swift/SIL/SILWitnessTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ namespace llvm {
template <>
struct ilist_traits<::swift::SILWitnessTable> :
public ilist_default_traits<::swift::SILWitnessTable> {
typedef ::swift::SILWitnessTable SILWitnessTable;
using SILWitnessTable = ::swift::SILWitnessTable;

public:
static void deleteNode(SILWitnessTable *WT) { WT->~SILWitnessTable(); }
Expand Down
4 changes: 2 additions & 2 deletions include/swift/SIL/TypeLowering.h
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ class GenericContextScope {

namespace llvm {
template<> struct DenseMapInfo<swift::Lowering::TypeConverter::CachingTypeKey> {
typedef swift::Lowering::TypeConverter::CachingTypeKey CachingTypeKey;
using CachingTypeKey = swift::Lowering::TypeConverter::CachingTypeKey;

using APCachingKey = swift::Lowering::AbstractionPattern::CachingKey;
using CachingKeyInfo = DenseMapInfo<APCachingKey>;
Expand Down Expand Up @@ -967,7 +967,7 @@ namespace llvm {
};

template<> struct DenseMapInfo<swift::Lowering::TypeConverter::OverrideKey> {
typedef swift::Lowering::TypeConverter::OverrideKey OverrideKey;
using OverrideKey = swift::Lowering::TypeConverter::OverrideKey;

using SILDeclRefInfo = DenseMapInfo<swift::SILDeclRef>;

Expand Down
2 changes: 1 addition & 1 deletion include/swift/SIL/TypeSubstCloner.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class TypeSubstCloner : public SILClonerWithScopes<ImplClass> {
friend class SILInstructionVisitor<ImplClass>;
friend class SILCloner<ImplClass>;

typedef SILClonerWithScopes<ImplClass> super;
using super = SILClonerWithScopes<ImplClass>;

void postProcess(SILInstruction *Orig, SILInstruction *Cloned) {
llvm_unreachable("Clients need to explicitly call a base class impl!");
Expand Down