mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Add a basic "re-mangler", which turns a parsed
demangling tree back into a mangled string. Also, extend the demangling API in a few obvious ways, and simplify testing for failure in the node-returning APIs by having them simply return null instead of a spurious Failure node. Also, preserve slightly more information in the demangling tree. The goal here is eventually to always allow a perfect round-trip through the demangler parse tree. This patch gets us close, but we're not quite there yet. Tests to follow. Swift SVN r24473
This commit is contained in:
@@ -1129,18 +1129,20 @@ static int doPrintAST(const CompilerInvocation &InitInvok,
|
||||
demangle_wrappers::demangleSymbolAsNode(MangledNameToFind);
|
||||
using NodeKind = Demangle::Node::Kind;
|
||||
|
||||
if (node->getKind() != NodeKind::Global) {
|
||||
if (!node) {
|
||||
llvm::errs() << "Unable to demangle name.\n";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
node = node->getFirstChild();
|
||||
|
||||
// FIXME: Look up things other than types.
|
||||
if (node->getKind() != NodeKind::Type) {
|
||||
if (node->getKind() != NodeKind::TypeMangling) {
|
||||
llvm::errs() << "Name does not refer to a type.\n";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
node = node->getFirstChild();
|
||||
assert(node->getKind() == NodeKind::Type);
|
||||
node = node->getFirstChild();
|
||||
|
||||
switch (node->getKind()) {
|
||||
case NodeKind::Class:
|
||||
|
||||
Reference in New Issue
Block a user