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:
John McCall
2015-01-16 06:33:08 +00:00
parent cb702a9035
commit bb675b6ac9
9 changed files with 1821 additions and 502 deletions

View File

@@ -32,6 +32,10 @@ static void printNode(llvm::raw_ostream &Out, const Node *node,
unsigned depth) {
// Indent two spaces per depth.
Out.indent(depth * 2);
if (!node) {
Out << "<<NULL>>";
return;
}
Out << "kind=" << getNodeKindString(node->getKind());
if (node->hasText()) {
Out << ", text=\"" << node->getText() << '\"';