File tree Expand file tree Collapse file tree 4 files changed +9
-22
lines changed Expand file tree Collapse file tree 4 files changed +9
-22
lines changed Original file line number Diff line number Diff line change @@ -541,7 +541,6 @@ class CanType : public Type {
541
541
CanType getNominalParent () const ; // in Types.h
542
542
NominalTypeDecl *getAnyNominal () const ;
543
543
GenericTypeDecl *getAnyGeneric () const ;
544
- TypeDecl *getAnyTypeDecl () const ;
545
544
546
545
bool isForeignReferenceType (); // in Types.h
547
546
Original file line number Diff line number Diff line change @@ -1233,11 +1233,6 @@ class alignas(1 << TypeAlignInBits) TypeBase
1233
1233
// / declaration.
1234
1234
GenericTypeDecl *getAnyGeneric ();
1235
1235
1236
- // If this a GenericType, ModuleType, or GenericTypeParamType, return the
1237
- // type declaration.
1238
- // NOTE: Will not attempt to find an AssociatedTypeDecl.
1239
- TypeDecl *getAnyTypeDecl ();
1240
-
1241
1236
// / removeArgumentLabels - Retrieve a version of this type with all
1242
1237
// / argument labels removed.
1243
1238
Type removeArgumentLabels (unsigned numArgumentLabels);
@@ -7426,10 +7421,6 @@ inline GenericTypeDecl *TypeBase::getAnyGeneric() {
7426
7421
return getCanonicalType ().getAnyGeneric ();
7427
7422
}
7428
7423
7429
- inline TypeDecl *TypeBase::getAnyTypeDecl () {
7430
- return getCanonicalType ().getAnyTypeDecl ();
7431
- }
7432
-
7433
7424
inline bool TypeBase::isBuiltinIntegerType (unsigned n) {
7434
7425
if (auto intTy = dyn_cast<BuiltinIntegerType>(getCanonicalType ()))
7435
7426
return intTy->getWidth ().isFixedWidth ()
Original file line number Diff line number Diff line change @@ -3336,6 +3336,14 @@ static bool hasInverseCopyable(
3336
3336
Decl *decl,
3337
3337
std::function<bool (InverseMarking const &)> isRelevantInverse) {
3338
3338
3339
+ auto getTypeDecl = [](Type type) -> TypeDecl* {
3340
+ if (auto genericTy = type->getAnyGeneric ())
3341
+ return genericTy;
3342
+ if (auto gtpt = dyn_cast<GenericTypeParamType>(type))
3343
+ return gtpt->getDecl ();
3344
+ return nullptr ;
3345
+ };
3346
+
3339
3347
if (auto *extension = dyn_cast<ExtensionDecl>(decl)) {
3340
3348
if (auto *nominal = extension->getSelfNominalTypeDecl ())
3341
3349
if (isRelevantInverse (nominal->getNoncopyableMarking ()))
@@ -3361,7 +3369,7 @@ static bool hasInverseCopyable(
3361
3369
// Check for noncopyable types in the types of this declaration.
3362
3370
if (Type type = value->getInterfaceType ()) {
3363
3371
bool hasNoncopyable = type.findIf ([&](Type type) {
3364
- if (auto typeDecl = type-> getAnyTypeDecl ( ))
3372
+ if (auto * typeDecl = getTypeDecl (type ))
3365
3373
if (isRelevantInverse (typeDecl->getNoncopyableMarking ()))
3366
3374
return true ;
3367
3375
Original file line number Diff line number Diff line change @@ -91,17 +91,6 @@ GenericTypeDecl *CanType::getAnyGeneric() const {
91
91
return nullptr ;
92
92
}
93
93
94
- TypeDecl *CanType::getAnyTypeDecl () const {
95
- // NOTE: there is no simple way to determine if it's an AssociatedTypeDecl.
96
- if (auto genericTy = getAnyGeneric ())
97
- return genericTy;
98
- if (auto gtpt = dyn_cast<GenericTypeParamType>(*this ))
99
- return gtpt->getDecl ();
100
- if (auto module = dyn_cast<ModuleType>(*this ))
101
- return module ->getModule ();
102
- return nullptr ;
103
- }
104
-
105
94
// ===----------------------------------------------------------------------===//
106
95
// Various Type Methods.
107
96
// ===----------------------------------------------------------------------===//
You can’t perform that action at this time.
0 commit comments