mstange / msvc-demangler-rust

A rust library that demangles / undecorates C++ symbols mangled by MSVC
Other
42 stars 13 forks source link

Initial work for supporting llvm based output and tests #42

Closed mitsuhiko closed 5 years ago

mitsuhiko commented 5 years ago

This is work in progress. The idea is that we can support llvm tests and output behavior here. This is currently quite hacky to hobble along until we get something passing. I want to clean up the printing behavior later then separately to be easier to understand.

This fixes #40

mitsuhiko commented 5 years ago

This changes the existing behavior with regards to space slightly. In particular )const now becomes ) const which I believe is a sensible default but I might change this back and make it configurable.

mitsuhiko commented 5 years ago

The bug in the last test is because in parse 1 to 5 are all handled as just read_var_type.

The actual mapping table for 0..5 is as follows:

Symbol Behavior
0 Private Static
1 Protected Static
2 Public Static
3 Global
4 Function Local Static

This is then followed by a qualifier of which LLVM implements A, B, C, D and Q, R, S, T.

So this symbol:

?B@@3VA@@A

Has type 3 (global) with qualifier A (no qualifier).

This might need a new node.

mitsuhiko commented 5 years ago

Some of the llvm tests from ms-operators are broken. This needs a bit of deciding. The only ones that really concern me right now is the broken backrefs.

mitsuhiko commented 5 years ago

Decided to squash merge this. Should be easy to back out if absolutely needed.