[PATCH] D56855: Add ___Z demangling to new common demangle function
James Henderson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 18 03:15:33 PST 2019
jhenderson marked an inline comment as done.
jhenderson added inline comments.
================
Comment at: lib/Demangle/Demangle.cpp:18-19
char *Demangled;
- if (MangledName.compare(0, 2, "_Z") == 0)
+ if (MangledName.compare(0, 2, "_Z") == 0 ||
+ MangledName.compare(0, 4, "___Z") == 0)
Demangled = itaniumDemangle(MangledName.c_str(), nullptr, nullptr, nullptr);
----------------
erik.pilkington wrote:
> As of r351481, we allow leading underscores on these. Maybe it would be easier to flip this around so we call microsoftDemangle if the name starts with `?`, then itaniumDemangle otherwise?
@erik.pilkington, flipping it around would adversely affect the behaviour, because `itaniumDemangle` can also do demangling of types, which aren't strictly fully encoded mangled names. Based on code-inspection, I believe an input string of, say, 'v', would become 'void', which is clearly wrong behaviour for a variable with the name 'v'. At the same time, having to check for `_Z`, `__Z`, `___Z` and `____Z` seems silly. I'll see if I can come up with a better solution.
@grimar, my understanding is that it would compare the entirety of the first string against the other side, which would fail (unless the string was for example "_Z"). Is that what you understand after your re-read?
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56855/new/
https://reviews.llvm.org/D56855
More information about the llvm-commits
mailing list