From fceda07f94c9e4181f97ecacc1bdc1b9a0b7ab16 Mon Sep 17 00:00:00 2001 From: Vexu Date: Sat, 21 Dec 2019 14:38:32 +0200 Subject: use self hosted translate-c for cimports --- src/ir.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/ir.cpp') diff --git a/src/ir.cpp b/src/ir.cpp index a862ff1068..e24265137a 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -13,7 +13,6 @@ #include "os.hpp" #include "range_set.hpp" #include "softfloat.hpp" -#include "translate_c.hpp" #include "util.hpp" #include @@ -23755,14 +23754,14 @@ static IrInstruction *ir_analyze_instruction_c_import(IrAnalyze *ira, IrInstruct clang_argv.append(nullptr); // to make the [start...end] argument work - AstNode *root_node; Stage2ErrorMsg *errors_ptr; size_t errors_len; + Stage2Ast *ast; const char *resources_path = buf_ptr(ira->codegen->zig_c_headers_dir); - if ((err = parse_h_file(ira->codegen, &root_node, &errors_ptr, &errors_len, - &clang_argv.at(0), &clang_argv.last(), TranslateModeImport, resources_path))) + if ((err = stage2_translate_c(&ast, &errors_ptr, &errors_len, + &clang_argv.at(0), &clang_argv.last(), resources_path))) { if (err != ErrorCCompileErrors) { ir_add_error_node(ira, node, buf_sprintf("C import failed: %s", err_str(err))); @@ -23813,7 +23812,7 @@ static IrInstruction *ir_analyze_instruction_c_import(IrAnalyze *ira, IrInstruct buf_sprintf("C import failed: unable to open output file: %s", strerror(errno))); return ira->codegen->invalid_instruction; } - ast_render(out_file, root_node, 4); + stage2_render_ast(ast, out_file); if (fclose(out_file) != 0) { ir_add_error_node(ira, node, buf_sprintf("C import failed: unable to write to output file: %s", strerror(errno))); -- cgit v1.2.3