mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Mangling] Give protocol-conformance-ref an operator.
Due to some unfortunate refactoring, protocol-conformance-ref is a nonterminal in the mangling grammar that doesn't have its own operator: ``` protocol-conformance-ref ::= protocol module? ``` Both "module" and "protocol" can be an "identifier", which introduces a mangling collision. Address the mangling collision by using the operator "HP". Fixes rdar://problem/46735592.
This commit is contained in:
@@ -633,7 +633,7 @@ Property behaviors are implemented using private protocol conformances.
|
||||
::
|
||||
|
||||
concrete-protocol-conformance ::= type protocol-conformance-ref any-protocol-conformance-list 'HC'
|
||||
protocol-conformance-ref ::= protocol module?
|
||||
protocol-conformance-ref ::= protocol module? 'HP'
|
||||
|
||||
any-protocol-conformance ::= concrete-protocol-conformance
|
||||
any-protocol-conformance ::= dependent-protocol-conformance
|
||||
|
||||
@@ -458,7 +458,7 @@ protected:
|
||||
NodePointer getDependentGenericParamType(int depth, int index);
|
||||
NodePointer demangleGenericParamIndex();
|
||||
NodePointer popProtocolConformance();
|
||||
NodePointer popProtocolConformanceRef();
|
||||
NodePointer demangleProtocolConformanceRef();
|
||||
NodePointer popAnyProtocolConformance();
|
||||
NodePointer demangleConcreteProtocolConformance();
|
||||
NodePointer popDependentProtocolConformance();
|
||||
|
||||
@@ -2282,6 +2282,8 @@ void ASTMangler::appendProtocolConformanceRef(
|
||||
// are global anyway.
|
||||
if (isRetroactiveConformance(conformance))
|
||||
appendModule(conformance->getDeclContext()->getParentModule());
|
||||
|
||||
appendOperator("HP");
|
||||
}
|
||||
|
||||
/// Retrieve the index of the conformance requirement indicated by the
|
||||
|
||||
@@ -610,6 +610,7 @@ NodePointer Demangler::demangleOperator() {
|
||||
case 'C': return demangleConcreteProtocolConformance();
|
||||
case 'D': return demangleDependentProtocolConformanceRoot();
|
||||
case 'I': return demangleDependentProtocolConformanceInherited();
|
||||
case 'P': return demangleProtocolConformanceRef();
|
||||
default:
|
||||
pushBack();
|
||||
pushBack();
|
||||
@@ -1294,7 +1295,7 @@ NodePointer Demangler::popAnyProtocolConformance() {
|
||||
});
|
||||
}
|
||||
|
||||
NodePointer Demangler::popProtocolConformanceRef() {
|
||||
NodePointer Demangler::demangleProtocolConformanceRef() {
|
||||
NodePointer module = popModule();
|
||||
NodePointer proto = popProtocol();
|
||||
auto protocolConformanceRef =
|
||||
@@ -1309,7 +1310,7 @@ NodePointer Demangler::popProtocolConformanceRef() {
|
||||
|
||||
NodePointer Demangler::demangleConcreteProtocolConformance() {
|
||||
NodePointer conditionalConformanceList = popAnyProtocolConformanceList();
|
||||
NodePointer conformanceRef = popProtocolConformanceRef();
|
||||
NodePointer conformanceRef = popNode(Node::Kind::ProtocolConformanceRef);
|
||||
NodePointer type = popNode(Node::Kind::Type);
|
||||
return createWithChildren(Node::Kind::ConcreteProtocolConformance,
|
||||
type, conformanceRef, conditionalConformanceList);
|
||||
|
||||
@@ -1659,6 +1659,7 @@ void Remangler::mangleProtocolConformanceRef(Node *node) {
|
||||
manglePureProtocol(node->getChild(0));
|
||||
if (node->getNumChildren() > 1)
|
||||
mangleChildNode(node, 1);
|
||||
Buffer << "HP";
|
||||
}
|
||||
|
||||
void Remangler::mangleConcreteProtocolConformance(Node *node) {
|
||||
|
||||
@@ -301,7 +301,7 @@ _T0So13GenericOptionas8HashableSCsACP9hashValueSivgTW ---> {T:} protocol witness
|
||||
_T0So11CrappyColorVs16RawRepresentableSCMA ---> reflection metadata associated type descriptor __C.CrappyColor : Swift.RawRepresentable in __C_Synthesized
|
||||
$S28protocol_conformance_records15NativeValueTypeVAA8RuncibleAAMc ---> protocol conformance descriptor for protocol_conformance_records.NativeValueType : protocol_conformance_records.Runcible in protocol_conformance_records
|
||||
$SSC9SomeErrorLeVD ---> __C_Synthesized.related decl 'e' for SomeError
|
||||
$s20mangling_retroactive5test1yyAA2Z2V5InnerVy12RetroactiveB1XV_AG1YVAI0F1A1PAAyHCg_AkL1QAAyHCg0_GF ---> mangling_retroactive.test1(mangling_retroactive.Z2<RetroactiveB.X>.Inner<RetroactiveB.Y>) -> ()
|
||||
$s20mangling_retroactive5test0yyAA1ZVy12RetroactiveB1XVSiAE1YVAG0D1A1PAAHPyHCg_AiJ1QAAHPyHCg1_GF ---> mangling_retroactive.test0(mangling_retroactive.Z<RetroactiveB.X, Swift.Int, RetroactiveB.Y>) -> ()
|
||||
_T0LiteralAByxGxd_tcfC ---> _T0LiteralAByxGxd_tcfC
|
||||
_T0XZ ---> _T0XZ
|
||||
_TTSf0os___TFVs17_LegacyStringCore15_invariantCheckfT_T_ ---> function signature specialization <Arg[0] = Guaranteed To Owned and Exploded> of Swift._LegacyStringCore._invariantCheck() -> ()
|
||||
|
||||
Reference in New Issue
Block a user