Skip to content

Commit 68746a0

Browse files
committed
[NFC] AST: Rename IdentTypeReprUnqualifiedIdentTypeRepr
1 parent 6fbc06e commit 68746a0

17 files changed

+58
-59
lines changed

include/swift/AST/Attr.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class ModuleDecl;
6666
class PatternBindingInitializer;
6767
class TrailingWhereClause;
6868
class TypeExpr;
69-
class IdentTypeRepr;
69+
class UnqualifiedIdentTypeRepr;
7070

7171
class alignas(1 << AttrAlignInBits) AttributeBase
7272
: public ASTAllocated<AttributeBase> {
@@ -1766,7 +1766,8 @@ class CustomAttr final : public DeclAttribute {
17661766
///
17671767
/// For an identifier type repr, return a pair of `nullptr` and the
17681768
/// identifier.
1769-
std::pair<IdentTypeRepr *, DeclRefTypeRepr *> destructureMacroRef();
1769+
std::pair<UnqualifiedIdentTypeRepr *, DeclRefTypeRepr *>
1770+
destructureMacroRef();
17701771

17711772
/// Whether the attribute has any arguments.
17721773
bool hasArgs() const { return argList != nullptr; }

include/swift/AST/TypeDeclFinder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class TypeDeclFinder : public TypeWalker {
4444
/// equivalently and where generic arguments can be walked to separately from
4545
/// the generic type.
4646
class SimpleTypeDeclFinder : public TypeDeclFinder {
47-
/// The function to call when a \c IdentTypeRepr is seen.
47+
/// The function to call when a \c TypeDecl is seen.
4848
llvm::function_ref<Action(const TypeDecl *)> Callback;
4949

5050
Action visitNominalType(NominalType *ty) override;

include/swift/AST/TypeRepr.h

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ class AttributedTypeRepr final
324324
friend class TypeRepr;
325325
};
326326

327-
class IdentTypeRepr;
327+
class UnqualifiedIdentTypeRepr;
328328

329329
/// This is the abstract base class for types that directly reference a
330330
/// type declaration. In written syntax, this type representation consists of
@@ -361,15 +361,15 @@ class DeclRefTypeRepr : public TypeRepr {
361361
SourceRange AngleBrackets);
362362

363363
/// Returns the qualifier or base type representation. For example, `A.B`
364-
/// for `A.B.C`. The base of a `IdentTypeRepr` is null.
364+
/// for `A.B.C`. The base of a `UnqualifiedIdentTypeRepr` is null.
365365
TypeRepr *getBase() const;
366366

367367
/// Returns the root qualifier. For example, `A` for `A.B.C`. The root
368-
/// qualifier of a `IdentTypeRepr` is itself.
368+
/// qualifier of a `UnqualifiedIdentTypeRepr` is itself.
369369
TypeRepr *getRoot();
370370

371371
/// Returns the root qualifier. For example, `A` for `A.B.C`. The root
372-
/// qualifier of a `IdentTypeRepr` is itself.
372+
/// qualifier of a `UnqualifiedIdentTypeRepr` is itself.
373373
const TypeRepr *getRoot() const;
374374

375375
DeclNameLoc getNameLoc() const;
@@ -426,18 +426,18 @@ class DeclRefTypeRepr : public TypeRepr {
426426
/// Foo
427427
/// Bar<Gen>
428428
/// \endcode
429-
class IdentTypeRepr : public DeclRefTypeRepr {
429+
class UnqualifiedIdentTypeRepr : public DeclRefTypeRepr {
430430
protected:
431-
IdentTypeRepr(TypeReprKind K, DeclNameLoc Loc, DeclNameRef Id,
432-
unsigned NumGenericArgs, bool hasGenericArgList)
431+
UnqualifiedIdentTypeRepr(TypeReprKind K, DeclNameLoc Loc, DeclNameRef Id,
432+
unsigned NumGenericArgs, bool hasGenericArgList)
433433
: DeclRefTypeRepr(K, Id, Loc, NumGenericArgs, hasGenericArgList) {}
434434

435435
public:
436436
static bool classof(const TypeRepr *T) {
437437
return T->getKind() == TypeReprKind::SimpleIdent ||
438438
T->getKind() == TypeReprKind::GenericIdent;
439439
}
440-
static bool classof(const IdentTypeRepr *T) { return true; }
440+
static bool classof(const UnqualifiedIdentTypeRepr *T) { return true; }
441441

442442
protected:
443443
SourceLoc getStartLocImpl() const { return getNameLoc().getStartLoc(); }
@@ -446,11 +446,12 @@ class IdentTypeRepr : public DeclRefTypeRepr {
446446
};
447447

448448
/// A simple identifier type like "Int".
449-
class SimpleIdentTypeRepr : public IdentTypeRepr {
449+
class SimpleIdentTypeRepr : public UnqualifiedIdentTypeRepr {
450450
public:
451451
SimpleIdentTypeRepr(DeclNameLoc Loc, DeclNameRef Id)
452-
: IdentTypeRepr(TypeReprKind::SimpleIdent, Loc, Id, /*NumGenericArgs=*/0,
453-
/*HasAngleBrackets=*/false) {}
452+
: UnqualifiedIdentTypeRepr(TypeReprKind::SimpleIdent, Loc, Id,
453+
/*NumGenericArgs=*/0,
454+
/*HasAngleBrackets=*/false) {}
454455

455456
// SmallVector::emplace_back will never need to call this because
456457
// we reserve the right size, but it does try statically.
@@ -474,7 +475,7 @@ class SimpleIdentTypeRepr : public IdentTypeRepr {
474475
/// Bar<Gen>
475476
/// \endcode
476477
class GenericIdentTypeRepr final
477-
: public IdentTypeRepr,
478+
: public UnqualifiedIdentTypeRepr,
478479
private llvm::TrailingObjects<GenericIdentTypeRepr, TypeRepr *> {
479480
friend TrailingObjects;
480481
SourceRange AngleBrackets;

include/swift/AST/TypeReprNodes.def

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ TYPEREPR(Error, TypeRepr)
4646
TYPEREPR(Attributed, TypeRepr)
4747

4848
ABSTRACT_TYPEREPR(DeclRef, TypeRepr)
49-
ABSTRACT_TYPEREPR(Ident, DeclRefTypeRepr)
50-
TYPEREPR(SimpleIdent, IdentTypeRepr)
51-
TYPEREPR(GenericIdent, IdentTypeRepr)
49+
ABSTRACT_TYPEREPR(UnqualifiedIdent, DeclRefTypeRepr)
50+
TYPEREPR(SimpleIdent, UnqualifiedIdentTypeRepr)
51+
TYPEREPR(GenericIdent, UnqualifiedIdentTypeRepr)
5252
TYPEREPR(Member, DeclRefTypeRepr)
5353

5454
TYPEREPR(Function, TypeRepr)

include/swift/Parse/Parser.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,16 @@ namespace llvm {
4242
}
4343

4444
namespace swift {
45-
class IdentTypeRepr;
46-
class ErrorTypeRepr;
4745
class CodeCompletionCallbacks;
4846
class DoneParsingCallback;
49-
class IDEInspectionCallbacksFactory;
5047
class DefaultArgumentInitializer;
5148
class DiagnosticEngine;
5249
class Expr;
5350
class Lexer;
5451
class PersistentParserState;
5552
class RequirementRepr;
5653
class SILParserStateBase;
57-
class ScopeInfo;
58-
class SingleValueStmtExpr;
5954
class SourceManager;
60-
class TupleType;
61-
class TypeLoc;
6255
class UUID;
6356

6457
struct EnumElementInfo;

lib/AST/ASTDumper.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3297,7 +3297,9 @@ class PrintTypeRepr : public TypeReprVisitor<PrintTypeRepr, void, StringRef>,
32973297
}
32983298

32993299
void visitDeclRefTypeRepr(DeclRefTypeRepr *T, StringRef label) {
3300-
printCommon(isa<IdentTypeRepr>(T) ? "type_ident" : "type_member", label);
3300+
printCommon(isa<UnqualifiedIdentTypeRepr>(T) ? "type_unqualified_ident"
3301+
: "type_member",
3302+
label);
33013303

33023304
printFieldQuoted(T->getNameRef(), "id", IdentifierColor);
33033305
if (T->isBound())

lib/AST/Attr.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2749,13 +2749,13 @@ CustomAttr *CustomAttr::create(ASTContext &ctx, SourceLoc atLoc, TypeExpr *type,
27492749
CustomAttr(atLoc, range, type, initContext, argList, implicit);
27502750
}
27512751

2752-
std::pair<IdentTypeRepr *, DeclRefTypeRepr *>
2752+
std::pair<UnqualifiedIdentTypeRepr *, DeclRefTypeRepr *>
27532753
CustomAttr::destructureMacroRef() {
27542754
TypeRepr *typeRepr = getTypeRepr();
27552755
if (!typeRepr)
27562756
return {nullptr, nullptr};
2757-
if (auto *identType = dyn_cast<IdentTypeRepr>(typeRepr))
2758-
return {nullptr, identType};
2757+
if (auto *unqualIdentType = dyn_cast<UnqualifiedIdentTypeRepr>(typeRepr))
2758+
return {nullptr, unqualIdentType};
27592759
if (auto *memType = dyn_cast<MemberTypeRepr>(typeRepr)) {
27602760
if (auto *base = dyn_cast<SimpleIdentTypeRepr>(memType->getBase())) {
27612761
return {base, memType};

lib/AST/Decl.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6732,7 +6732,7 @@ NominalTypeDecl::hasInverseMarking(InvertibleProtocolKind target) const {
67326732
continue;
67336733

67346734
auto *subjectRepr =
6735-
dyn_cast<IdentTypeRepr>(requirementRepr.getSubjectRepr());
6735+
dyn_cast<UnqualifiedIdentTypeRepr>(requirementRepr.getSubjectRepr());
67366736

67376737
if (!(subjectRepr && subjectRepr->isBound()))
67386738
continue;
@@ -6775,7 +6775,8 @@ ProtocolDecl::hasInverseMarking(InvertibleProtocolKind target) const {
67756775
reqRepr.getKind() != RequirementReprKind::TypeConstraint)
67766776
continue;
67776777

6778-
auto *subjectRepr = dyn_cast<IdentTypeRepr>(reqRepr.getSubjectRepr());
6778+
auto *subjectRepr =
6779+
dyn_cast<UnqualifiedIdentTypeRepr>(reqRepr.getSubjectRepr());
67796780
auto *constraintRepr = reqRepr.getConstraintRepr();
67806781

67816782
if (!subjectRepr || !subjectRepr->getNameRef().isSimpleName(ctx.Id_Self))

lib/AST/Expr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2270,7 +2270,7 @@ TypeExpr *TypeExpr::createForSpecializedDecl(DeclRefTypeRepr *ParentTR,
22702270
return nullptr;
22712271
}
22722272

2273-
if (isa<IdentTypeRepr>(ParentTR)) {
2273+
if (isa<UnqualifiedIdentTypeRepr>(ParentTR)) {
22742274
specializedTR = GenericIdentTypeRepr::create(
22752275
C, ParentTR->getNameLoc(), ParentTR->getNameRef(), Args, AngleLocs);
22762276
specializedTR->setValue(boundDecl, ParentTR->getDeclContext());

lib/AST/TypeRepr.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ DeclRefTypeRepr *DeclRefTypeRepr::create(const ASTContext &C, TypeRepr *Base,
189189
}
190190

191191
TypeRepr *DeclRefTypeRepr::getBase() const {
192-
if (isa<IdentTypeRepr>(this)) {
192+
if (isa<UnqualifiedIdentTypeRepr>(this)) {
193193
return nullptr;
194194
}
195195

@@ -202,8 +202,8 @@ TypeRepr *DeclRefTypeRepr::getRoot() {
202202
}
203203

204204
const TypeRepr *DeclRefTypeRepr::getRoot() const {
205-
if (auto *ITR = dyn_cast<IdentTypeRepr>(this))
206-
return ITR;
205+
if (auto *UITR = dyn_cast<UnqualifiedIdentTypeRepr>(this))
206+
return UITR;
207207

208208
return cast<MemberTypeRepr>(this)->getRoot();
209209
}
@@ -481,9 +481,9 @@ TupleTypeRepr *TupleTypeRepr::createEmpty(const ASTContext &C,
481481
GenericIdentTypeRepr::GenericIdentTypeRepr(DeclNameLoc Loc, DeclNameRef Id,
482482
ArrayRef<TypeRepr *> GenericArgs,
483483
SourceRange AngleBrackets)
484-
: IdentTypeRepr(TypeReprKind::GenericIdent, Loc, Id,
485-
/*NumGenericArgs=*/GenericArgs.size(),
486-
/*HasAngleBrackets=*/AngleBrackets.isValid()),
484+
: UnqualifiedIdentTypeRepr(TypeReprKind::GenericIdent, Loc, Id,
485+
/*NumGenericArgs=*/GenericArgs.size(),
486+
/*HasAngleBrackets=*/AngleBrackets.isValid()),
487487
AngleBrackets(AngleBrackets) {
488488
#ifndef NDEBUG
489489
for (auto arg : GenericArgs)

0 commit comments

Comments
 (0)