diff options
| author | gingerBill <bill@gingerbill.org> | 2017-10-15 16:11:34 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2017-10-15 16:11:34 +0100 |
| commit | e5e14b99476c72c1aa1cc8cb36fa05f5aa830de4 (patch) | |
| tree | b4fbaf03b879c4f23299dcb040e026a557ef6566 /src/ir.cpp | |
| parent | 3d8bf36a304f3500840d4e2a990e78d15da70cb1 (diff) | |
Remove name mangling for `foreign export` variables
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 4a6807586..1d5bd233f 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -8163,9 +8163,13 @@ void ir_gen_tree(irGen *s) { continue; } + + bool is_foreign = e->Variable.is_foreign; + bool is_export = (e->flags & EntityFlag_ForeignExport) != 0; + String name = e->token.string; String original_name = name; - if (!e->scope->is_global) { + if (!e->scope->is_global && !(is_foreign || is_export)) { name = ir_mangle_name(s, e->token.pos.file, e); } ir_add_entity_name(m, e, name); @@ -8173,8 +8177,8 @@ void ir_gen_tree(irGen *s) { irValue *g = ir_value_global(a, e, nullptr); g->Global.name = name; g->Global.is_thread_local = e->Variable.is_thread_local; - g->Global.is_export = (e->flags & EntityFlag_ForeignExport) != 0; - g->Global.is_foreign = e->Variable.is_foreign; + g->Global.is_foreign = is_foreign; + g->Global.is_export = is_export; irGlobalVariable var = {}; var.var = g; |