Skip to content

swift-demangle: add -remangle-new option #6959

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 1 commit into from
Jan 21, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tools/swift-demangle/swift-demangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ static llvm::cl::opt<bool>
RemangleMode("test-remangle",
llvm::cl::desc("Remangle test mode (show the remangled string)"));

static llvm::cl::opt<bool>
RemangleNew("remangle-new",
llvm::cl::desc("Remangle the symbol with new mangling scheme"));

static llvm::cl::opt<bool>
DisableSugar("no-sugar",
llvm::cl::desc("No sugar mode (disable common language idioms such as ? and [] from the output)"));
Expand Down Expand Up @@ -104,6 +108,15 @@ static void demangle(llvm::raw_ostream &os, llvm::StringRef name,
return;
}
if (!TreeOnly) {
if (RemangleNew) {
if (!pointer) {
llvm::errs() << "Can't de-mangle " << name << '\n';
exit(1);
}
std::string remangled = swift::Demangle::mangleNodeNew(pointer);
llvm::outs() << remangled;
return;
}
std::string string = swift::Demangle::nodeToString(pointer, options);
if (!CompactMode)
llvm::outs() << name << " ---> ";
Expand Down