What kind of mangling has the LDC2 -X JsonFile "deco" field?

Adam D. Ruppe destructionator at gmail.com
Thu Sep 17 03:15:21 UTC 2020


On Thursday, 17 September 2020 at 03:06:45 UTC, realhet wrote:
> I'm trying to get information from the JsonFile produced by 
> LDC2, but having no clue how to decode this:
>
> For example:
> header: KeywordCat kwCatOf(int k)
>   "deco" : "FAyaZE3het8keywords10KeywordCat",

That's a D mangle but just of one individual variable, without an 
attached name. std.demangle looks for the _D prefix and the name 
so it prolly can't read it.

https://dlang.org/spec/abi.html#name_mangling

But from eyeball it is a extern(D) function taking a string 
argument and returning a KeywordCat enum..

The "F" means extern(D). After this are the argument list. "Aya" 
you'll get to recognize as "string", but formally it means "Array 
(A) of immutable (y) chars (a)". Then "Z" means non-variadic 
function and this ends the argument list, so the next thing is 
the return type. "E" means enum, then the name comes with a count 
of chars in this name piece, then the chars.



More information about the Digitalmars-d-learn mailing list