add concept of inline for, inline while, inline var

This commit is contained in:
Andrew Kelley
2016-11-03 14:13:57 -04:00
parent 1a0111d4c3
commit c8333d0cc9
8 changed files with 217 additions and 108 deletions

View File

@@ -4105,7 +4105,7 @@ static void build_all_basic_blocks(CodeGen *g, FnTableEntry *fn) {
static void gen_global_var(CodeGen *g, VariableTableEntry *var, LLVMValueRef init_val,
TypeTableEntry *type_entry)
{
assert(var->is_const);
assert(var->gen_is_const);
assert(var->import);
assert(type_entry);
bool is_local_to_unit = true;
@@ -4183,12 +4183,12 @@ static void do_code_gen(CodeGen *g) {
LLVMSetUnnamedAddr(global_value, true);
// TODO debug info for function pointers
if (var->is_const && var->type->id != TypeTableEntryIdFn) {
if (var->gen_is_const && var->type->id != TypeTableEntryIdFn) {
gen_global_var(g, var, init_val, var->type);
}
}
LLVMSetGlobalConstant(global_value, var->is_const);
LLVMSetGlobalConstant(global_value, var->gen_is_const);
var->value_ref = global_value;
}