mattgallagher / cwldemangle Goto Github PK
View Code? Open in Web Editor NEWAn implementation of Swift mangled symbol parsing and demangled printing in Swift.
An implementation of Swift mangled symbol parsing and demangled printing in Swift.
Sorry for the very weird question ๐
Is there a way to go back to the mangled version?
If for instance if I have a function:
Mangled:
$s6Module3FooC3bar3bazSayAA3BarVGSi_tF
Demangled:
Module.Foo.bar(baz: Swift.Int) -> Swift.Array<Module.Bar>
And if I want a specific part mangled back. For example for Swift.Int:
$sSiN
I'm not looking for anyone to fix this for me. I'm happy to implement it myself ๐ .
Would just like some idea of how to change the code to accommodate.
My idea so far was to keep track of the area in the mangled string for a specific node in the AST and just store that, in the SwiftSymbol Object. But we still need to resolve how to mangle the module name back: i.e. how do I go from Swift.Array<Module.Bar>
to $s[...]6Module3Bar[...]
?
It would be nice to be able to include this as an external dependency using swift package manager.
Hi Matt,
Is CwlDemangle supports Swift 3?
For example this symbol:
"_T0s14StringProtocolP10FoundationSS5IndexVADRtzrlE10componentsSaySSGqd__11separatedBy_tsAARd__lF"
demangles into this when you call SwiftSymbol.print() on it:
"(extension in Foundation):Swift.StringProtocol<>.components(separatedBy: A\u{1}) -> Swift.Array<Swift.String>"
If you just dump this string as part of a json serialization process, then it will be invalid json and cannot be parsed by other json deserializers.
In swift you would represent the U+0001 char as "\u{1}". You can see a list of unicode characters here: https://en.wikipedia.org/wiki/List_of_Unicode_characters
this is a greate job by translate it form c++ to swift!
I want demangle swift symbols in server, my server code is java [\sad],I do not good at java develop.do you know anywhere has java implement?
Just a heads-up: There's been a fair amount of activity on Demangle.cpp since December, and talk of "new mangling". Maybe preparation for Swift 4?
Sigh. I was just about to integrate your great Swift-based demangle code into my Swift logging module, now I fear that could soon be a wasted investment.
(But I still think it's marvelous that you did this work.)
Hello
We are using your demangle swift code in our project to print stack traces in a little bit more readable way.
Unfortunately this mangled name is crashing Demangle.swift
on printing its name, after calling SwiftName.description
with following string passed to demangleSwiftName
to create SwiftName
instance in the first place:
_TFFFFC9Le_Figaro11DataManagerP33_4BF0F705F2DC93973E68326EF6A0FFBA16getSingleArticleFTGSqSS_13articleSourceGSqSS_10articleUrlGSqSS_17completionHandlerGSqFT_T__12errorHandlerGSqFGSqPs5Error__T___T_U_FGSqP__T_U_FCSo22NSManagedObjectContextT_U_FT6resultGSqP__5errorGSqPS1____T_
as string parameter.
Swift 3.0, Xcode 8.0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.