[PATCH] D44668: [demangler] WIP: Add a "partial" demangling API for LLDB
Erik Pilkington via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 19 18:48:31 PDT 2018
erik.pilkington created this revision.
erik.pilkington added reviewers: clayborg, jingham.
Herald added subscribers: hiraditya, mgorny.
lldb-dev thread: http://lists.llvm.org/pipermail/lldb-dev/2018-January/013186.html
Currently, the demangler in ItaniumDemangler works by parsing the mangled name into an AST-like format, then traverses that AST to produce the demangled name. Some users (LLDB) consume this demangled name by writing custom parsers. This is redundant (in a very hot section, AFAIK), as the name has to be printed and the re-parsed. For large demangled names with many (potentially nested) <template-param>s and substitutions, the demangler has to produce a massive symbol that LLDB has to dig through in order to find the small amount of information that it needs. Just parsing to an AST expands no substitutions, and should run in about O(strlen of the mangled name).
This patch adds a partial demangling API that parses the mangled name into the AST-like format without printing and provides some functions to access interesting information from that AST. If LLDB used this instead of `char*`s to investigate the demangled name, it would be cleaner and save time. (AFAIK, I've never touched lldb!)
I've put this patch up super early, I still want to add more tests and make it more robust. I'm hoping that this would be a good place to find out if this is what the LLDB people actually want. Does anyone have any thoughts?
Thanks for taking a look!
Erik
Repository:
rL LLVM
https://reviews.llvm.org/D44668
Files:
llvm/include/llvm/Demangle/Demangle.h
llvm/lib/Demangle/ItaniumDemangle.cpp
llvm/unittests/CMakeLists.txt
llvm/unittests/Demangle/CMakeLists.txt
llvm/unittests/Demangle/PartialDemangleTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44668.139061.patch
Type: text/x-patch
Size: 15659 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180320/35860ca6/attachment.bin>
More information about the llvm-commits
mailing list