File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
include/swift/RemoteInspection
stdlib/public/RemoteInspection Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -210,6 +210,9 @@ class alignas(8) TypeRef {
210210 // / Build a demangle tree from this TypeRef.
211211 Demangle::NodePointer getDemangling (Demangle::Demangler &Dem) const ;
212212
213+ // / Build the mangled name from this TypeRef.
214+ llvm::Optional<std::string> mangle (Demangle::Demangler &Dem) const ;
215+
213216 bool isConcrete () const ;
214217 bool isConcreteAfterSubstitutions (const GenericArgumentMap &Subs) const ;
215218
Original file line number Diff line number Diff line change @@ -1025,6 +1025,24 @@ Demangle::NodePointer TypeRef::getDemangling(Demangle::Demangler &Dem) const {
10251025 return DemanglingForTypeRef (Dem).visit (this );
10261026}
10271027
1028+ llvm::Optional<std::string> TypeRef::mangle (Demangle::Demangler &Dem) const {
1029+ NodePointer node = getDemangling (Dem);
1030+ if (!node)
1031+ return {};
1032+
1033+ // The mangled tree stored in this typeref implicitly assumes the type and
1034+ // global mangling, so add those back in.
1035+ auto typeMangling = Dem.createNode (Node::Kind::TypeMangling);
1036+ typeMangling->addChild (node, Dem);
1037+ auto global = Dem.createNode (Node::Kind::Global);
1038+ global->addChild (node, Dem);
1039+
1040+ auto mangling = mangleNode (global);
1041+ if (!mangling.isSuccess ())
1042+ return {};
1043+ return mangling.result ();
1044+ }
1045+
10281046bool TypeRef::isConcrete () const {
10291047 GenericArgumentMap Subs;
10301048 return TypeRefIsConcrete (Subs).visit (this );
You can’t perform that action at this time.
0 commit comments