This is an archive of the discontinued LLVM Phabricator instance.

[llvm-cxxfilt] Improve strip-underscore behavior
ClosedPublic

Authored by steven_wu on Nov 14 2019, 9:31 AM.

Details

Summary

For platform that uses macho format, c++filt should be stripping the
leading underscore by default. Introduce the binutil compatible "-n"
option to control strip-undercore behaivor together with the existing
"-_" option and fallback to system default if none of them are set.

rdar://problem/57173514

Diff Detail

Event Timeline

steven_wu created this revision.Nov 14 2019, 9:31 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 14 2019, 9:31 AM
steven_wu edited reviewers, added: mattd; removed: davis-matthew.Nov 14 2019, 9:32 AM
erik.pilkington accepted this revision.Nov 18 2019, 2:35 PM

LGTM

llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
77

Side comment: Why does this function take an ostream then only write "import thunk for" into it? Looks like that will produce broken output for import thunks in the Split case in demangleLine. Can't we just return a string with "import thunk for" prefixed in that case?

This revision is now accepted and ready to land.Nov 18 2019, 2:35 PM
compnerd accepted this revision.Nov 18 2019, 2:47 PM

Sorry about the delay on the review!

llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
69–76

Please rewrite this as:

if (StripUnderscore)
  return true;
if (NoStripUnderscore)
  return false;
return Triple(sys::getProcessTriple()).isOSBinFormatMachO();
steven_wu updated this revision to Diff 229929.Nov 18 2019, 2:59 PM

Address review feedback

steven_wu marked an inline comment as done.Nov 18 2019, 3:02 PM
steven_wu added inline comments.
llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
77

Agree with that. That will be a followup patch.

steven_wu updated this revision to Diff 229931.Nov 18 2019, 3:04 PM

Fix comments

Harbormaster completed remote builds in B41141: Diff 229931.
This revision was automatically updated to reflect the committed changes.