fix(demangle): tweak MSVC demangling flags #640
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These flags create more visually pleasing results for function names
which are demangled from the MSVC mangling scheme.
Here are two examples from oleaut32.pdb A128178EA85DAE837E96C39303FF06381:
Before:
SafeGetLocaleInfoPooled(struct tagDATEINFO *,unsigned long,unsigned short * *,int *)
After:
SafeGetLocaleInfoPooled(tagDATEINFO*, unsigned long, unsigned short**, int*)
Before:
CTypeInfo2::Invoke(void *,long,unsigned short,struct tagDISPPARAMS *,struct tagVARIANT *,struct tagEXCEPINFO *,unsigned int *)
After:
CTypeInfo2::Invoke(void*, long, unsigned short, tagDISPPARAMS*, tagVARIANT*, tagEXCEPINFO*, unsigned int*)
The flags in detail:
SPACE_AFTER_COMMA
: Adds a space after each comma.HUG_TYPE
: Removes the space in front of "*" and "&".NO_CLASS_TYPE
: Removes "struct" / "class" / "enum" / "union" keywords from argument types.NO_MS_KEYWORDS
: Removes__cdecl
and similar distracting keywords.The new output is more consistent with the output that we produce for
functions which were mangled with the Itanium C++ ABI scheme, i.e. which
are going down the
cpp_demangle
path.For comparison, here are two demangled functions from a macOS mozglue.dylib;
you can see that these already follow the same "space after comma", "no class/struct keyword",
"no space before *" rules:
mozilla::baseprofiler::ParseFeaturesFromStringArray(char const**, unsigned int, bool)
double_conversion::RoundUp(double_conversion::Vector<char>, int*, int*)