@@ -858,9 +858,13 @@ NodePointer Demangler::demangleMetatype() {
858858 case ' A' :
859859 return createWithChild (Node::Kind::ReflectionMetadataAssocTypeDescriptor,
860860 popProtocolConformance ());
861- case ' C' :
861+ case ' C' : {
862+ NodePointer Ty = popNode (Node::Kind::Type);
863+ if (!Ty || !isNominal (Ty->getChild (0 )->getKind ()))
864+ return nullptr ;
862865 return createWithChild (Node::Kind::ReflectionMetadataSuperclassDescriptor,
863- popNode (isNominal));
866+ Ty->getChild (0 ));
867+ }
864868 default :
865869 return nullptr ;
866870 }
@@ -1016,12 +1020,20 @@ NodePointer Demangler::popProtocolConformance() {
10161020 NodePointer Module = popModule ();
10171021 NodePointer Proto = popProtocol ();
10181022 NodePointer Type = popNode (Node::Kind::Type);
1023+ NodePointer Ident;
1024+ if (!Type) {
1025+ // Property behavior conformance
1026+ Ident = popNode (Node::Kind::Identifier);
1027+ Type = popNode (Node::Kind::Type);
1028+ }
10191029 if (GenSig) {
10201030 Type = createType (createWithChildren (Node::Kind::DependentGenericType,
10211031 GenSig, Type));
10221032 }
1023- return createWithChildren (Node::Kind::ProtocolConformance,
1024- Type, Proto, Module);
1033+ NodePointer Conf = createWithChildren (Node::Kind::ProtocolConformance,
1034+ Type, Proto, Module);
1035+ addChild (Conf, Ident);
1036+ return Conf;
10251037}
10261038
10271039NodePointer Demangler::demangleThunkOrSpecialization () {
@@ -1089,7 +1101,7 @@ NodePointer Demangler::demangleGenericSpecialization(Node::Kind SpecKind) {
10891101
10901102NodePointer Demangler::demangleFunctionSpecialization () {
10911103 NodePointer Spec = demangleSpecAttributes (
1092- Node::Kind::FunctionSignatureSpecialization);
1104+ Node::Kind::FunctionSignatureSpecialization, /* demangleUniqueID */ true );
10931105 unsigned ParamIdx = 0 ;
10941106 while (Spec && !nextIf (' _' )) {
10951107 Spec = addChild (Spec, demangleFuncSpecParam (ParamIdx));
@@ -1226,15 +1238,27 @@ NodePointer Demangler::addFuncSpecParamNumber(NodePointer Param,
12261238 Node::Kind::FunctionSignatureSpecializationParamPayload, Str));
12271239}
12281240
1229- NodePointer Demangler::demangleSpecAttributes (Node::Kind SpecKind) {
1230- NodePointer SpecNd = NodeFactory::create (SpecKind);
1231- if (nextIf (' q' ))
1232- SpecNd->addChild (NodeFactory::create (Node::Kind::SpecializationIsFragile));
1241+ NodePointer Demangler::demangleSpecAttributes (Node::Kind SpecKind,
1242+ bool demangleUniqueID) {
1243+ bool isFragile = nextIf (' q' );
12331244
12341245 int PassID = (int )nextChar () - ' 0' ;
12351246 if (PassID < 0 || PassID > 9 )
12361247 return nullptr ;
12371248
1249+ int Idx = -1 ;
1250+ if (demangleUniqueID)
1251+ Idx = demangleNatural ();
1252+
1253+ NodePointer SpecNd;
1254+ if (Idx >= 0 ) {
1255+ SpecNd = NodeFactory::create (SpecKind, Idx);
1256+ } else {
1257+ SpecNd = NodeFactory::create (SpecKind);
1258+ }
1259+ if (isFragile)
1260+ SpecNd->addChild (NodeFactory::create (Node::Kind::SpecializationIsFragile));
1261+
12381262 SpecNd->addChild (NodeFactory::create (Node::Kind::SpecializationPassID,
12391263 PassID));
12401264 return SpecNd;
0 commit comments