i’m starting to work with the Swift ABI manglings again, and one thing that would really help me is if there were a way to parse these strings and get structured information out of them. i’m also interested in using the mangled name grammar as a serialization format for things like generic constraints.
I think the only supported way—aside from invoking swift-demangle -expand and parsing the text output—would be to compile and link directly to libDemangling from the compiler sources and traverse the node hierarchy that way. We have a project that does that, and suffice it to say, it's quite ugly going through the Swift <-> C <-> C++ funnel (we're not trying to use C++ interop yet).
With swift-syntax and the parser as precedent, I would love to see the next component of the compiler that gets Swiftified to be the mangler/demangler so that folks can just use it as a regular package dependency.
that looks like exactly what i need. however, i noticed it has not been updated since Swift 5.3. has the Swift mangling ABI changed meaningfully since then? (e.g. will it work for async declarations?)
I haven't been proactive about updating CwlDemangle because it looked like Swift was going to implement it properly:
That proposal was returned for review but never returned
If it's missing something, I can probably update CwlDemangle. I don't use it much myself, anymore, so I'm not sure what the scale of missing features would be. Apple have pretty extensive test cases on their side and all I've done the last few times is convert their test cases to XCTests and work through the issues.