aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp9
1 files changed, 4 insertions, 5 deletions
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 <errno.h>
@@ -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)));