mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-01-18 14:21:36 +00:00
the IR won't create globals of the same name - make names starting with # an exception
This commit is contained in:
parent
21a2679efb
commit
7756cb9205
2 changed files with 11 additions and 4 deletions
4
ast.c
4
ast.c
|
@ -510,8 +510,10 @@ bool ast_global_codegen(ast_value *self, ir_builder *ir)
|
|||
}
|
||||
|
||||
v = ir_builder_create_global(ir, self->name, self->expression.vtype);
|
||||
if (!v)
|
||||
if (!v) {
|
||||
printf("ir_builder_create_global failed\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (self->isconst) {
|
||||
switch (self->expression.vtype)
|
||||
|
|
11
ir.c
11
ir.c
|
@ -206,9 +206,14 @@ ir_value* ir_builder_get_global(ir_builder *self, const char *name)
|
|||
|
||||
ir_value* ir_builder_create_global(ir_builder *self, const char *name, int vtype)
|
||||
{
|
||||
ir_value *ve = ir_builder_get_global(self, name);
|
||||
if (ve) {
|
||||
return NULL;
|
||||
ir_value *ve;
|
||||
|
||||
if (name && name[0] != '#')
|
||||
{
|
||||
ve = ir_builder_get_global(self, name);
|
||||
if (ve) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
ve = ir_value_var(name, store_global, vtype);
|
||||
|
|
Loading…
Reference in a new issue