DeanoBurrito / northport

Monolithic kernel and support libraries for riscv64 and x86_64.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

C++ demangler has some strange edge cases.

DeanoBurrito opened this issue · comments

commented

I didnt do enough testing on this one, as itll occasionally spit out some nonsense.
I think a big part of the problem is treating each scoped name entry as its own token, which can cause pointers to be displayed in the wrong place.

There are 2 paths forward with this:

  • We keep track of appending text (like a pointer), waiting until a scoped name has ended before it's printed. I like this the most, as there's only 1 case of appending text, the rest are prepended. However this isnt super maintainable, and more state is more room for unexpected errors.
  • We could also handle this on the input parser. When parsing a scoped name, we output the shorthand tokens as needed, but only output a single scoped name, and perhaps the token maintains a list text items (start, len - all from original source). This keeps the output simple, however adds complexity on the input.
commented

Demangler was written in bd489dc, and most cases were fixed in 2d0fade.

Demangler now supports the majority of the most commonly used parts of the language.