aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-03-01 17:51:52 -0500
committerAndrew Kelley <andrew@ziglang.org>2019-03-01 17:52:17 -0500
commit9c47bf68faafc42292f8c8aeb1e1b9e00cfda368 (patch)
tree5568115bdb432c2a4187550c5a162eac91ce21ae /src
parentfc17b8ee8bae48b1b4067deee4b38716b935a160 (diff)
downloadzig-9c47bf68faafc42292f8c8aeb1e1b9e00cfda368.tar.gz
zig-9c47bf68faafc42292f8c8aeb1e1b9e00cfda368.zip
gen-h: respect @export
Diffstat (limited to 'src')
-rw-r--r--src/codegen.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index 4d3b20bb90..5abe685a13 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -8591,10 +8591,17 @@ static void gen_h_file(CodeGen *g) {
Buf return_type_c = BUF_INIT;
get_c_type(g, gen_h, fn_type_id->return_type, &return_type_c);
+ Buf *symbol_name;
+ if (fn_table_entry->export_list.length == 0) {
+ symbol_name = &fn_table_entry->symbol_name;
+ } else {
+ FnExport *fn_export = &fn_table_entry->export_list.items[0];
+ symbol_name = &fn_export->name;
+ }
buf_appendf(&h_buf, "%s %s %s(",
buf_ptr(export_macro),
buf_ptr(&return_type_c),
- buf_ptr(&fn_table_entry->symbol_name));
+ buf_ptr(symbol_name));
Buf param_type_c = BUF_INIT;
if (fn_type_id->param_count > 0) {