Skip to content

Commit b5552d1

Browse files
committed
print: deal with anonymous BBs properly
1 parent 39cad27 commit b5552d1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/shady/print.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,10 @@ static void print_basic_block(PrinterCtx* ctx, const Node* bb) {
126126
printf(GREEN);
127127
printf("\n\ncont");
128128
printf(BYELLOW);
129-
printf(" %s", bb->payload.basic_block.name);
129+
if (bb->payload.basic_block.name && strlen(bb->payload.basic_block.name) > 0)
130+
printf(" %s", bb->payload.basic_block.name);
131+
else
132+
printf(" %%%d", bb->id);
130133
printf(RESET);
131134
if (ctx->config.print_ptrs) {
132135
printf(" %zu:: ", (size_t)(void*)bb);
@@ -948,7 +951,10 @@ static void print_node_impl(PrinterCtx* ctx, const Node* node) {
948951
}
949952
case BasicBlock_TAG: {
950953
printf(BYELLOW);
951-
printf("%s", node->payload.basic_block.name);
954+
if (node->payload.basic_block.name && strlen(node->payload.basic_block.name) > 0)
955+
printf("%s", node->payload.basic_block.name);
956+
else
957+
printf("%%%d", node->id);
952958
printf(RESET);
953959
break;
954960
}

0 commit comments

Comments
 (0)