Fixed code style

This commit is contained in:
Dmitry Stogov 2023-05-22 20:08:36 +03:00
parent 71061d0ee4
commit d1fcaa3e63
2 changed files with 4 additions and 7 deletions

5
ir.c
View File

@ -73,10 +73,11 @@ void ir_print_const(const ir_ctx *ctx, const ir_insn *insn, FILE *f, bool quoted
fprintf(f, "%s", ir_get_str(ctx, insn->val.i32)); fprintf(f, "%s", ir_get_str(ctx, insn->val.i32));
return; return;
} else if (insn->op == IR_STR) { } else if (insn->op == IR_STR) {
if (quoted) if (quoted) {
fprintf(f, "\"%s\"", ir_get_str(ctx, insn->val.i32)); fprintf(f, "\"%s\"", ir_get_str(ctx, insn->val.i32));
else } else {
fprintf(f, "%s", ir_get_str(ctx, insn->val.i32)); fprintf(f, "%s", ir_get_str(ctx, insn->val.i32));
}
return; return;
} }
IR_ASSERT(IR_IS_CONST_OP(insn->op) || insn->op == IR_FUNC_ADDR); IR_ASSERT(IR_IS_CONST_OP(insn->op) || insn->op == IR_FUNC_ADDR);

View File

@ -65,11 +65,7 @@ void ir_dump_dot(const ir_ctx *ctx, FILE *f)
fprintf(f, "\trankdir=TB;\n"); fprintf(f, "\trankdir=TB;\n");
for (i = 1 - ctx->consts_count, insn = ctx->ir_base + i; i < IR_UNUSED; i++, insn++) { for (i = 1 - ctx->consts_count, insn = ctx->ir_base + i; i < IR_UNUSED; i++, insn++) {
fprintf(f, "\tc%d [label=\"C%d: CONST %s(", -i, -i, ir_type_name[insn->type]); fprintf(f, "\tc%d [label=\"C%d: CONST %s(", -i, -i, ir_type_name[insn->type]);
/* FIXME(tony): /* FIXME(tony): We still cannot handle strings with escaped double quote inside */
We still cannot handle strings with double quote inside, such as
"Hamlet said, \"To be, or not to be\"".
'dot' command reports syntax error.
*/
ir_print_const(ctx, insn, f, false); ir_print_const(ctx, insn, f, false);
fprintf(f, ")\",style=filled,fillcolor=yellow];\n"); fprintf(f, ")\",style=filled,fillcolor=yellow];\n");
} }