Skip to content

Some demangler changes #15461

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 25, 2018
Merged

Some demangler changes #15461

merged 2 commits into from
Mar 25, 2018

Conversation

eeckstein
Copy link
Contributor

@eeckstein eeckstein commented Mar 23, 2018

  • Support the final mangling prefix _$s
  • Also accept symbol names without the $ prefix

For details see the commit messages

rdar://problem/37681432
rdar://problem/38546308

@eeckstein
Copy link
Contributor Author

@swift-ci smoke test and merge

@eeckstein eeckstein requested a review from jrose-apple March 23, 2018 21:01
@eeckstein
Copy link
Contributor Author

@jrose-apple Are you fine with requiring -stdin for swift-demangle to read from stdin?
(see the commit message for the motivation)

@compnerd
Copy link
Member

@eeckstein not sure if my opinion matters, but, I think that requiring the flag is a bit surprising. c++filt (and llvm-c++filt) both default to that without any flags and will run a loop to read in input and decode each line. This is extremely helpful for use in scripts and just generally when debugging things without a debugger helping you to undecorate the names.

Copy link
Contributor

@jrose-apple jrose-apple left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm with @compnerd. swift-demangle is supposed to act like c++filt first and foremost; passing arguments on the command line is the convenient extra feature, not the original purpose.

@eeckstein
Copy link
Contributor Author

no problem. I'll remove that change

@eeckstein
Copy link
Contributor Author

@jrose-apple I removed that commit

@eeckstein
Copy link
Contributor Author

@swift-ci smoke test

@jrose-apple jrose-apple dismissed their stale review March 23, 2018 21:47

(controversial change removed)

@@ -175,7 +175,7 @@ static int demangleSTDIN(const swift::Demangle::DemangleOptions &options) {
// This doesn't handle Unicode symbols, but maybe that's okay.
// Also accept the future mangling prefix.
// TODO: remove the "_S" as soon as MANGLING_PREFIX_STR gets "_S".
llvm::Regex maybeSymbol("(_T|_*\\$S|" MANGLING_PREFIX_STR ")[_a-zA-Z0-9$.]+");
llvm::Regex maybeSymbol("_(T|\\$[Ss]|" MANGLING_PREFIX_STR ")[_a-zA-Z0-9$.]+");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@graydon and I just noticed that MANGLING_PREFIX_STR will have an unescaped $ in it, which means that things without the leading underscore weren't getting matched. Moving the underscore to the outside doesn't fix that either.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "(_T|_?\\$[Ss])" and leave out the MANGLING_PREFIX_STR part entirely?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

argh...
Thanks for catching this! I thought I already fixed this, but apparently not.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, you didn't regress it. :-)

This makes it easier to copy-paste $S symbol names with a double-click.

rdar://problem/38546308
@eeckstein
Copy link
Contributor Author

@swift-ci smoke test and merge

1 similar comment
@eeckstein
Copy link
Contributor Author

@swift-ci smoke test and merge

@swift-ci swift-ci merged commit 73e1090 into swiftlang:master Mar 25, 2018
@eeckstein eeckstein deleted the demangler-work branch March 25, 2018 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants