mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Remove name mangling for foreign export variables
This commit is contained in:
+2
-2
@@ -514,7 +514,6 @@ void check_proc_decl(Checker *c, Entity *e, DeclInfo *d) {
|
|||||||
|
|
||||||
init_entity_foreign_library(c, e);
|
init_entity_foreign_library(c, e);
|
||||||
|
|
||||||
|
|
||||||
auto *fp = &c->info.foreigns;
|
auto *fp = &c->info.foreigns;
|
||||||
HashKey key = hash_string(name);
|
HashKey key = hash_string(name);
|
||||||
Entity **found = map_get(fp, key);
|
Entity **found = map_get(fp, key);
|
||||||
@@ -606,7 +605,8 @@ void check_var_decl(Checker *c, Entity *e, Entity **entities, isize entity_count
|
|||||||
error(e->token, "A foreign variable declaration cannot have a default value");
|
error(e->token, "A foreign variable declaration cannot have a default value");
|
||||||
}
|
}
|
||||||
init_entity_foreign_library(c, e);
|
init_entity_foreign_library(c, e);
|
||||||
|
}
|
||||||
|
if (e->Variable.is_foreign || (e->flags & EntityFlag_ForeignExport) != 0) {
|
||||||
String name = e->token.string;
|
String name = e->token.string;
|
||||||
auto *fp = &c->info.foreigns;
|
auto *fp = &c->info.foreigns;
|
||||||
HashKey key = hash_string(name);
|
HashKey key = hash_string(name);
|
||||||
|
|||||||
+7
-3
@@ -8163,9 +8163,13 @@ void ir_gen_tree(irGen *s) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool is_foreign = e->Variable.is_foreign;
|
||||||
|
bool is_export = (e->flags & EntityFlag_ForeignExport) != 0;
|
||||||
|
|
||||||
String name = e->token.string;
|
String name = e->token.string;
|
||||||
String original_name = name;
|
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);
|
name = ir_mangle_name(s, e->token.pos.file, e);
|
||||||
}
|
}
|
||||||
ir_add_entity_name(m, e, name);
|
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);
|
irValue *g = ir_value_global(a, e, nullptr);
|
||||||
g->Global.name = name;
|
g->Global.name = name;
|
||||||
g->Global.is_thread_local = e->Variable.is_thread_local;
|
g->Global.is_thread_local = e->Variable.is_thread_local;
|
||||||
g->Global.is_export = (e->flags & EntityFlag_ForeignExport) != 0;
|
g->Global.is_foreign = is_foreign;
|
||||||
g->Global.is_foreign = e->Variable.is_foreign;
|
g->Global.is_export = is_export;
|
||||||
|
|
||||||
irGlobalVariable var = {};
|
irGlobalVariable var = {};
|
||||||
var.var = g;
|
var.var = g;
|
||||||
|
|||||||
Reference in New Issue
Block a user