[PATCH] D80173: Give microsoftDemangle() an outparam for how many input bytes were consumed.

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 19 13:44:28 PDT 2020


thakis added a comment.

Sure! The motivation is that if you want to write something like c++filt that finds all symbols in text and replaces them with the demangled form, you'll have a loop like:

  for each word w
    try to demangle w to demangled_w
    if that worked,
      print demangled_w
    else
      print w

For Itanium this works great since as far as I know if `w` is demangled successfully, it always consumes all of `w`. But with the Microsoft scheme, it's possible that we get a `demangled_w` successfully but only consume some prefix of `w`, and it'd be good to print the unconsumed suffix too. With the current API that's not (*) possible.

*: Well I suppose for each w that successfully demangles, you could hand in only the first half of w and see if that demangles too and binary search over prefixes to find the suffix. But since the data is right there in the demangler and we only have to get it out, adding a way to get it out seems better to me.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80173/new/

https://reviews.llvm.org/D80173





More information about the llvm-commits mailing list