Skip to content

Commit eeac42c

Browse files
committed
Cache the Identifier for "_ObjectiveCType". NFC.
1 parent 6771e58 commit eeac42c

File tree

6 files changed

+8
-7
lines changed

6 files changed

+8
-7
lines changed

include/swift/AST/KnownIdentifiers.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ IDENTIFIER_(nsErrorDomain)
5151
IDENTIFIER(objectAtIndexedSubscript)
5252
IDENTIFIER(objectForKeyedSubscript)
5353
IDENTIFIER(ObjectiveC)
54+
IDENTIFIER_(ObjectiveCType)
5455
IDENTIFIER_(OptionalNilComparisonType)
5556
IDENTIFIER(parameter)
5657
IDENTIFIER(Protocol)

lib/AST/ASTContext.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3987,9 +3987,9 @@ ASTContext::getBridgedToObjC(const DeclContext *dc, Type type,
39873987

39883988
// Find the type we bridge to.
39893989
return ProtocolConformance::getTypeWitnessByName(type,
3990-
conformance->getConcrete(),
3991-
getIdentifier("_ObjectiveCType"),
3992-
resolver);
3990+
conformance->getConcrete(),
3991+
Id_ObjectiveCType,
3992+
resolver);
39933993
}
39943994

39953995
std::pair<ArchetypeBuilder *, ArchetypeBuilder::PotentialArchetype *>

lib/PrintAsObjC/PrintAsObjC.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ class ObjCPrinter : private DeclVisitor<ObjCPrinter>,
807807
Type objcType = ProtocolConformance::getTypeWitnessByName(
808808
nominal->getDeclaredType(),
809809
conformance,
810-
ctx.getIdentifier("_ObjectiveCType"),
810+
ctx.Id_ObjectiveCType,
811811
nullptr);
812812
if (!objcType) return false;
813813

lib/SIL/Bridging.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ Type TypeConverter::getLoweredCBridgedType(AbstractionPattern pattern,
216216
assert(conformance && "Missing conformance?");
217217
Type bridgedTy =
218218
ProtocolConformance::getTypeWitnessByName(
219-
t, conformance, M.getASTContext().getIdentifier("_ObjectiveCType"),
219+
t, conformance, M.getASTContext().Id_ObjectiveCType,
220220
nullptr);
221221
assert(bridgedTy && "Missing _ObjectiveCType witness?");
222222
if (bridgedCollectionsAreOptional && clangTy)

lib/SILGen/SILGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ SILGenModule::getBridgedObjectiveCTypeRequirement(SILLocation loc) {
241241
// Look for _bridgeToObjectiveC().
242242
auto &ctx = getASTContext();
243243
AssociatedTypeDecl *found = nullptr;
244-
DeclName name(ctx.getIdentifier("_ObjectiveCType"));
244+
DeclName name(ctx.Id_ObjectiveCType);
245245
for (auto member : proto->lookupDirect(name, true)) {
246246
if (auto assocType = dyn_cast<AssociatedTypeDecl>(member)) {
247247
found = assocType;

lib/Sema/CSApply.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1422,7 +1422,7 @@ namespace {
14221422

14231423
// Add substitution for the dependent type T._ObjectiveCType.
14241424
if (conformsToBridgedToObjectiveC) {
1425-
auto objcTypeId = tc.Context.getIdentifier("_ObjectiveCType");
1425+
auto objcTypeId = tc.Context.Id_ObjectiveCType;
14261426
auto objcAssocType = cast<AssociatedTypeDecl>(
14271427
conformance->getProtocol()->lookupDirect(
14281428
objcTypeId).front());

0 commit comments

Comments
 (0)