aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-01-01 22:46:46 -0500
committerGitHub <noreply@github.com>2020-01-01 22:46:46 -0500
commit576320e6d5bf706a0ee03a3e9318c8ef2fd6e76f (patch)
tree0405ebde5048781fd6f65d3bf9d444c54d04bd02 /src/ir.cpp
parent1b64a5f5f0cece3cf0009410ddb13b5dd6f899e1 (diff)
parent88c5e2a96e09270a2ec3045639e7cab3712f5291 (diff)
downloadzig-576320e6d5bf706a0ee03a3e9318c8ef2fd6e76f.tar.gz
zig-576320e6d5bf706a0ee03a3e9318c8ef2fd6e76f.zip
Merge pull request #4025 from ziglang/Vexu-stage-2-cimport
Use self hosted translate-c for cImport
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 ddfed8229b..fbd9ba7ac0 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>
@@ -23762,14 +23761,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)));
@@ -23820,7 +23819,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)));