[Mangling] Allow standard substitutions in protocol mangling.

Protocol name mangling didn’t always go through a path that allowed the use
of standard substitutions. Enable standard substitutions for protocol name
manglings where they make sense.

Removes ~277k from the standard library binary size.
This commit is contained in:
Doug Gregor
2018-06-17 23:16:57 -07:00
parent 7952a19f31
commit f232af5535
27 changed files with 99 additions and 73 deletions

View File

@@ -1195,6 +1195,17 @@ NodePointer Demangler::popTypeList() {
}
NodePointer Demangler::popProtocol() {
if (NodePointer Type = popNode(Node::Kind::Type)) {
if (Type->getNumChildren() < 1)
return nullptr;
NodePointer Proto = Type->getChild(0);
if (Proto->getKind() != Node::Kind::Protocol)
return nullptr;
return Type;
}
NodePointer Name = popNode(isDeclName);
NodePointer Ctx = popContext();
NodePointer Proto = createWithChildren(Node::Kind::Protocol, Ctx, Name);