Skip to content

Commit b2b69e8

Browse files
committed
Rename BoundNameAliasType to NameAliasType.
NameAliasType is dead! Long live NameAliasType!
1 parent 0524741 commit b2b69e8

29 files changed

+105
-105
lines changed

include/swift/AST/TypeNodes.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ TYPE(InOut, Type)
145145
UNCHECKED_TYPE(TypeVariable, Type)
146146
ABSTRACT_SUGARED_TYPE(Sugar, Type)
147147
SUGARED_TYPE(Paren, SugarType)
148-
SUGARED_TYPE(BoundNameAlias, SugarType)
148+
SUGARED_TYPE(NameAlias, SugarType)
149149
ABSTRACT_SUGARED_TYPE(SyntaxSugar, SugarType)
150150
ABSTRACT_SUGARED_TYPE(UnarySyntaxSugar, SyntaxSugarType)
151151
SUGARED_TYPE(ArraySlice, UnarySyntaxSugarType)

include/swift/AST/Types.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ class alignas(1 << TypeAlignInBits) TypeBase {
373373
GenericArgCount : 32
374374
);
375375

376-
SWIFT_INLINE_BITFIELD_FULL(BoundNameAliasType, SugarType, 1+16,
376+
SWIFT_INLINE_BITFIELD_FULL(NameAliasType, SugarType, 1+16,
377377
: NumPadBits,
378378

379379
/// Whether we have a parent type.
@@ -1550,26 +1550,26 @@ class SugarType : public TypeBase {
15501550

15511551
/// A reference to a type alias that is somehow generic, along with the
15521552
/// set of substitutions to apply to make the type concrete.
1553-
class BoundNameAliasType final
1553+
class NameAliasType final
15541554
: public SugarType, public llvm::FoldingSetNode,
1555-
llvm::TrailingObjects<BoundNameAliasType, Type, GenericSignature *,
1555+
llvm::TrailingObjects<NameAliasType, Type, GenericSignature *,
15561556
Substitution>
15571557
{
15581558
TypeAliasDecl *typealias;
15591559

15601560
friend class ASTContext;
15611561
friend TrailingObjects;
15621562

1563-
BoundNameAliasType(TypeAliasDecl *typealias, Type parent,
1563+
NameAliasType(TypeAliasDecl *typealias, Type parent,
15641564
const SubstitutionMap &substitutions, Type underlying,
15651565
RecursiveTypeProperties properties);
15661566

15671567
unsigned getNumSubstitutions() const {
1568-
return Bits.BoundNameAliasType.NumSubstitutions;
1568+
return Bits.NameAliasType.NumSubstitutions;
15691569
}
15701570

15711571
size_t numTrailingObjects(OverloadToken<Type>) const {
1572-
return Bits.BoundNameAliasType.HasParent ? 1 : 0;
1572+
return Bits.NameAliasType.HasParent ? 1 : 0;
15731573
}
15741574

15751575
size_t numTrailingObjects(OverloadToken<GenericSignature *>) const {
@@ -1594,7 +1594,7 @@ class BoundNameAliasType final
15941594
}
15951595

15961596
public:
1597-
static BoundNameAliasType *get(TypeAliasDecl *typealias, Type parent,
1597+
static NameAliasType *get(TypeAliasDecl *typealias, Type parent,
15981598
const SubstitutionMap &substitutions,
15991599
Type underlying);
16001600

@@ -1607,7 +1607,7 @@ class BoundNameAliasType final
16071607
/// Retrieve the parent of this type as written, e.g., the part that was
16081608
/// written before ".", if provided.
16091609
Type getParent() const {
1610-
return Bits.BoundNameAliasType.HasParent ? *getTrailingObjects<Type>()
1610+
return Bits.NameAliasType.HasParent ? *getTrailingObjects<Type>()
16111611
: Type();
16121612
}
16131613

@@ -1632,7 +1632,7 @@ class BoundNameAliasType final
16321632

16331633
// Implement isa/cast/dyncast/etc.
16341634
static bool classof(const TypeBase *T) {
1635-
return T->getKind() == TypeKind::BoundNameAlias;
1635+
return T->getKind() == TypeKind::NameAlias;
16361636
}
16371637
};
16381638

include/swift/Serialization/DeclTypeRecordNodes.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ TYPE(OPENED_EXISTENTIAL)
106106
TYPE(EXISTENTIAL_METATYPE)
107107
TYPE(SIL_BLOCK_STORAGE)
108108
TYPE(SIL_BOX)
109-
TYPE(BOUND_NAME_ALIAS)
109+
TYPE(NAME_ALIAS)
110110

111111
FIRST_DECL(TYPE_ALIAS, 60)
112112
DECL(GENERIC_TYPE_PARAM)

include/swift/Serialization/ModuleFormat.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -647,8 +647,8 @@ namespace decls_block {
647647
TypeIDField // canonical type (a fallback)
648648
>;
649649

650-
using BoundNameAliasTypeLayout = BCRecordLayout<
651-
BOUND_NAME_ALIAS_TYPE,
650+
using NameAliasTypeLayout = BCRecordLayout<
651+
NAME_ALIAS_TYPE,
652652
DeclIDField, // typealias decl
653653
TypeIDField, // parent type
654654
TypeIDField // underlying type

lib/AST/ASTContext.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ FOR_KNOWN_FOUNDATION_TYPES(CACHE_FOUNDATION_DECL)
278278
/// arenas.
279279
struct Arena {
280280
llvm::DenseMap<Type, ErrorType *> ErrorTypesWithOriginal;
281-
llvm::FoldingSet<BoundNameAliasType> BoundNameAliasTypes;
281+
llvm::FoldingSet<NameAliasType> NameAliasTypes;
282282
llvm::FoldingSet<TupleType> TupleTypes;
283283
llvm::DenseMap<std::pair<Type,char>, MetatypeType*> MetatypeTypes;
284284
llvm::DenseMap<std::pair<Type,char>,
@@ -2887,35 +2887,35 @@ StringRef ASTContext::getSwiftName(KnownFoundationEntity kind) {
28872887
// Type manipulation routines.
28882888
//===----------------------------------------------------------------------===//
28892889

2890-
BoundNameAliasType::BoundNameAliasType(TypeAliasDecl *typealias, Type parent,
2890+
NameAliasType::NameAliasType(TypeAliasDecl *typealias, Type parent,
28912891
const SubstitutionMap &substitutions,
28922892
Type underlying,
28932893
RecursiveTypeProperties properties)
2894-
: SugarType(TypeKind::BoundNameAlias, underlying, properties),
2894+
: SugarType(TypeKind::NameAlias, underlying, properties),
28952895
typealias(typealias) {
28962896
// Record the parent (or absence of a parent).
28972897
if (parent) {
2898-
Bits.BoundNameAliasType.HasParent = true;
2898+
Bits.NameAliasType.HasParent = true;
28992899
*getTrailingObjects<Type>() = parent;
29002900
} else {
2901-
Bits.BoundNameAliasType.HasParent = false;
2901+
Bits.NameAliasType.HasParent = false;
29022902
}
29032903

29042904
// Record the substitutions.
29052905
if (auto genericSig = substitutions.getGenericSignature()) {
29062906
SmallVector<Substitution, 4> flatSubs;
29072907
genericSig->getSubstitutions(substitutions, flatSubs);
2908-
Bits.BoundNameAliasType.NumSubstitutions = flatSubs.size();
2908+
Bits.NameAliasType.NumSubstitutions = flatSubs.size();
29092909
std::copy(flatSubs.begin(), flatSubs.end(),
29102910
getTrailingObjects<Substitution>());
29112911

29122912
*getTrailingObjects<GenericSignature *>() = genericSig;
29132913
} else {
2914-
Bits.BoundNameAliasType.NumSubstitutions = 0;
2914+
Bits.NameAliasType.NumSubstitutions = 0;
29152915
}
29162916
}
29172917

2918-
BoundNameAliasType *BoundNameAliasType::get(
2918+
NameAliasType *NameAliasType::get(
29192919
TypeAliasDecl *typealias,
29202920
Type parent,
29212921
const SubstitutionMap &substitutions,
@@ -2945,12 +2945,12 @@ BoundNameAliasType *BoundNameAliasType::get(
29452945

29462946
// Profile the type.
29472947
llvm::FoldingSetNodeID id;
2948-
BoundNameAliasType::Profile(id, typealias, parent, substitutions,
2948+
NameAliasType::Profile(id, typealias, parent, substitutions,
29492949
underlying);
29502950

29512951
// Did we already record this type?
29522952
void *insertPos;
2953-
auto &types = ctx.Impl.getArena(arena).BoundNameAliasTypes;
2953+
auto &types = ctx.Impl.getArena(arena).NameAliasTypes;
29542954
if (auto result = types.FindNodeOrInsertPos(id, insertPos))
29552955
return result;
29562956

@@ -2961,19 +2961,19 @@ BoundNameAliasType *BoundNameAliasType::get(
29612961
auto size =
29622962
totalSizeToAlloc<Type, GenericSignature *, Substitution>(
29632963
parent ? 1 : 0, genericSig ? 1 : 0, numSubstitutions);
2964-
auto mem = ctx.Allocate(size, alignof(BoundNameAliasType), arena);
2965-
auto result = new (mem) BoundNameAliasType(typealias, parent, substitutions,
2964+
auto mem = ctx.Allocate(size, alignof(NameAliasType), arena);
2965+
auto result = new (mem) NameAliasType(typealias, parent, substitutions,
29662966
underlying, storedProperties);
29672967
types.InsertNode(result, insertPos);
29682968
return result;
29692969
}
29702970

2971-
void BoundNameAliasType::Profile(llvm::FoldingSetNodeID &id) const {
2971+
void NameAliasType::Profile(llvm::FoldingSetNodeID &id) const {
29722972
Profile(id, getDecl(), getParent(), getSubstitutionMap(),
29732973
Type(getSinglyDesugaredType()));
29742974
}
29752975

2976-
void BoundNameAliasType::Profile(
2976+
void NameAliasType::Profile(
29772977
llvm::FoldingSetNodeID &id,
29782978
TypeAliasDecl *typealias,
29792979
Type parent, const SubstitutionMap &substitutions,

lib/AST/ASTDumper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3029,8 +3029,8 @@ namespace {
30293029
OS << ")";
30303030
}
30313031

3032-
void visitBoundNameAliasType(BoundNameAliasType *T, StringRef label) {
3033-
printCommon(label, "bound_name_alias_type");
3032+
void visitNameAliasType(NameAliasType *T, StringRef label) {
3033+
printCommon(label, "name_alias_type");
30343034
printField("decl", T->getDecl()->printRef());
30353035
if (T->getParent())
30363036
printRec("parent", T->getParent());

lib/AST/ASTMangler.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -733,16 +733,16 @@ void ASTMangler::appendType(Type type) {
733733
appendType(cast<BuiltinVectorType>(tybase)->getElementType());
734734
return appendOperator("Bv",
735735
cast<BuiltinVectorType>(tybase)->getNumElements());
736-
case TypeKind::BoundNameAlias: {
736+
case TypeKind::NameAlias: {
737737
assert(DWARFMangling && "sugared types are only legal for the debugger");
738-
auto boundAliasTy = cast<BoundNameAliasType>(tybase);
738+
auto aliasTy = cast<NameAliasType>(tybase);
739739

740740
// It's not possible to mangle the context of the builtin module.
741741
// FIXME: We also cannot yet mangle references to typealiases that
742742
// involve generics.
743-
TypeAliasDecl *decl = boundAliasTy->getDecl();
743+
TypeAliasDecl *decl = aliasTy->getDecl();
744744
if (decl->getModuleContext() == decl->getASTContext().TheBuiltinModule) {
745-
return appendType(boundAliasTy->getSinglyDesugaredType());
745+
return appendType(aliasTy->getSinglyDesugaredType());
746746
}
747747

748748
// For the DWARF output we want to mangle the type alias + context,

lib/AST/ASTPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3263,7 +3263,7 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
32633263
Printer << BUILTIN_TYPE_NAME_SILTOKEN;
32643264
}
32653265

3266-
void visitBoundNameAliasType(BoundNameAliasType *T) {
3266+
void visitNameAliasType(NameAliasType *T) {
32673267
if (Options.PrintForSIL || Options.PrintNameAliasUnderlyingType) {
32683268
visit(T->getSinglyDesugaredType());
32693269
return;

lib/AST/Decl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2540,7 +2540,7 @@ void TypeAliasDecl::setUnderlyingType(Type underlying) {
25402540
// If we can set a sugared type, do so.
25412541
if (!getGenericSignature()) {
25422542
auto sugaredType =
2543-
BoundNameAliasType::get(this, Type(), SubstitutionMap(), underlying);
2543+
NameAliasType::get(this, Type(), SubstitutionMap(), underlying);
25442544
setInterfaceType(MetatypeType::get(sugaredType, ctx));
25452545
} else {
25462546
setInterfaceType(MetatypeType::get(underlying, ctx));

lib/AST/DiagnosticEngine.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,8 @@ static void formatSelectionArgument(StringRef ModifierArguments,
329329
static bool isInterestingTypealias(Type type) {
330330
// Dig out the typealias declaration, if there is one.
331331
TypeAliasDecl *aliasDecl = nullptr;
332-
if (auto boundAliasTy = dyn_cast<BoundNameAliasType>(type.getPointer()))
333-
aliasDecl = boundAliasTy->getDecl();
332+
if (auto aliasTy = dyn_cast<NameAliasType>(type.getPointer()))
333+
aliasDecl = aliasTy->getDecl();
334334
else
335335
return false;
336336

0 commit comments

Comments
 (0)