Skip to content

Commit edbfce2

Browse files
committed
Simplify the code slightly.
I was trying to use fatalError() here, but that is in libswiftRuntime, which isn't linked into everything that has the demangler code in it. The upshot is that we'd have to touch a lot of other projects to use fatalError(). rdar://89139049
1 parent e4855e7 commit edbfce2

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/Demangling/Demangler.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,13 @@ static bool isRequirement(Node::Kind kind) {
9393

9494
void swift::Demangle::failAssert(const char *file, unsigned line,
9595
NodePointer node, const char *expr) {
96-
fprintf(stderr, "%s:%u: assertion failed for Node %p: %s\n", file, line, node,
97-
expr);
98-
if (node) {
99-
fprintf(stderr, "%s:%u: Node %p is:\n", file, line, node);
100-
node->dump();
101-
}
96+
std::string treeStr = getNodeTreeAsString(node);
97+
98+
fprintf(stderr,
99+
"%s:%u: assertion failed for Node %p: %s\n"
100+
"%s:%u: Node %p is:\n%s\n",
101+
file, line, node, expr,
102+
file, line, node, treeStr.c_str());
102103
abort();
103104
}
104105

0 commit comments

Comments
 (0)