This patch changes cxa_demangle.cpp to use an AST instead of manipulating std::strings to produce a demangled name. This is good because:
- Performance: 3.7x faster to demangle symbols in LLVM
- Code size: 40% reduction for a release build on my machine
- Better readability: Now the formatting code is separated from the parsing code
This is probably correctish because:
- The fuzzer doesn't seem to have any problems with this patch.
- Demangles symbols in llvm identically to old demangler
Sorry for the mega-patch, I couldn't figure out a sane way of dividing this up further.
Please see a recent thread on llvm-dev for more context: http://lists.llvm.org/pipermail/llvm-dev/2017-June/114448.html
Thanks for taking a look!
Erik
If this is supposed to be *the* ultimate LLVM demangler, can we follow LLVM coding standard?