Add well-known identifier caching (#6486)

I'm doing this because I figured it'd be an incremental improvement for
all the operator lookups that we do. Even to the extent that we've
discussed witness caching, I think it'll still apply. It does add one
more step to adding new interfaces (before, you'd just write the string,
now you add it to the def file and reference it).

I'll claim it makes GetClangOperatorKind a lot friendlier to read/edit,
nevermind removing the string comparisons. :)
This commit is contained in:
Jon Ross-Perkins
2025-12-11 21:41:47 +00:00
committed by GitHub
parent a848ae11e4
commit c0b335b87f
19 changed files with 482 additions and 239 deletions
+1 -2
View File
@@ -35,8 +35,7 @@ static auto GetOperatorOpFunction(Context& context, SemIR::LocId loc_id,
}
// Look up the interface member.
auto op_name_id =
SemIR::NameId::ForIdentifier(context.identifiers().Add(op.op_name));
auto op_name_id = context.core_identifiers().AddNameId(op.op_name);
return PerformMemberAccess(context, implicit_loc_id, interface_id,
op_name_id);
}