File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -402,6 +402,9 @@ class alignas(1 << TypeAlignInBits) TypeBase {
402
402
// / hasReferenceSemantics() - Do objects of this type have reference
403
403
// / semantics?
404
404
bool hasReferenceSemantics ();
405
+
406
+ // / Is this the 'Any' type?
407
+ bool isAny ();
405
408
406
409
// / Are values of this type essentially just class references,
407
410
// / possibly with some sort of additional information?
Original file line number Diff line number Diff line change @@ -89,6 +89,14 @@ bool TypeBase::hasReferenceSemantics() {
89
89
return getCanonicalType ().hasReferenceSemantics ();
90
90
}
91
91
92
+ bool TypeBase::isAny () {
93
+ if (auto comp = getAs<ProtocolCompositionType>())
94
+ if (comp->getProtocols ().empty ())
95
+ return true ;
96
+
97
+ return false ;
98
+ }
99
+
92
100
bool TypeBase::isAnyClassReferenceType () {
93
101
return getCanonicalType ().isAnyClassReferenceType ();
94
102
}
@@ -1953,9 +1961,8 @@ getObjCObjectRepresentable(Type type, const DeclContext *dc) {
1953
1961
1954
1962
// Any can be bridged to id.
1955
1963
if (type->getASTContext ().LangOpts .EnableIdAsAny ) {
1956
- if (auto protoCompTy = type->getAs <ProtocolCompositionType>()) {
1957
- if (protoCompTy->getProtocols ().empty ())
1958
- return ForeignRepresentableKind::Bridged;
1964
+ if (type->isAny ()) {
1965
+ return ForeignRepresentableKind::Bridged;
1959
1966
}
1960
1967
}
1961
1968
You can’t perform that action at this time.
0 commit comments