This is a follow-up to rL351448. This change adds support for the ___Z extension of Itanium demangling, requested by @erik.pilkington in the previous review, to the newly available demangle function.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Demangle/Demangle.cpp | ||
---|---|---|
25–26 | 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? |
minor nit:
lib/Demangle/Demangle.cpp | ||
---|---|---|
26 | I wonder if MangledName.compare(0, string::npos, "___Z") would be a bit more readable way here? |
lib/Demangle/Demangle.cpp | ||
---|---|---|
26 | I think there is no much difference. I just had to count the amount of '_`, but the initial version is better I think now. |
lib/Demangle/Demangle.cpp | ||
---|---|---|
26 | Oh, and I just misread the spec :) Please ignore this comments. |
lib/Demangle/Demangle.cpp | ||
---|---|---|
25–26 | @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? |
lib/Demangle/Demangle.cpp | ||
---|---|---|
25–26 | Yes, I mixed "compared string" with "comparing string". Sorry for the noise. |
LGTM.
lib/Demangle/Demangle.cpp | ||
---|---|---|
17 | Using just size_t form seems to be much more common. But I see std::size_t is also used sometimes. | |
20 | Up to you again, but I would use just I or Pos for shortness: std::size_t I = MangledName.find_first_not_of('_'); |
Using just size_t form seems to be much more common. But I see std::size_t is also used sometimes.
Up to you. FTR in LLD we use size_t.