Files
swift-mirror/tools/swift-demangle/swift-demangle.cpp
Enrico Granata efcd17f604 This commit implements the Demangler API in C++ and de facto deprecates the existing Demangle.swift
The new demangler is in the "swift/SIL/Demangle.{h|cpp}" files, and in the swift::Demangle namespace, which has two public entry points:

std::string demangleSymbol(llvm::StringRef mangled);
std::string demangleType(llvm::StringRef mangled);

This was necessary to support the need for LLDB to demangle Swift symbol (and type) names

Test case is included



Swift SVN r6547
2013-07-24 17:52:27 +00:00

20 lines
484 B
C++

#include "swift/SIL/Demangle.h"
#include <string>
#include <iostream>
int main(int argc, char **argv) {
for (int k = 1; k < argc; k++) {
if (strcmp(argv[k], "--type") == 0) {
if (++k >= argc)
break;
std::cout << argv[k] << " ---> " << swift::Demangle::demangleType(argv[k])
<< std::endl;
} else {
std::cout << argv[k] << " ---> "
<< swift::Demangle::demangleSymbol(argv[k]) << std::endl;
}
}
return 0;
}