aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index c1d3dc3327..4428c7797c 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -3062,7 +3062,7 @@ static LLVMValueRef ir_render_cast(CodeGen *g, IrExecutable *executable,
ZigType *actual_type = cast_instruction->value->value->type;
ZigType *wanted_type = cast_instruction->base.value->type;
LLVMValueRef expr_val = ir_llvm_value(g, cast_instruction->value);
- assert(expr_val);
+ ir_assert(expr_val, &cast_instruction->base);
switch (cast_instruction->cast_op) {
case CastOpNoCast:
@@ -4330,8 +4330,17 @@ static LLVMValueRef ir_render_struct_field_ptr(CodeGen *g, IrExecutable *executa
return struct_ptr;
}
- ZigType *struct_type = (struct_ptr_type->id == ZigTypeIdPointer) ?
- struct_ptr_type->data.pointer.child_type : struct_ptr_type;
+ ZigType *struct_type;
+ if (struct_ptr_type->id == ZigTypeIdPointer) {
+ if (struct_ptr_type->data.pointer.inferred_struct_field != nullptr) {
+ struct_type = struct_ptr_type->data.pointer.inferred_struct_field->inferred_struct_type;
+ } else {
+ struct_type = struct_ptr_type->data.pointer.child_type;
+ }
+ } else {
+ struct_type = struct_ptr_type;
+ }
+
if ((err = type_resolve(g, struct_type, ResolveStatusLLVMFull)))
codegen_report_errors_and_exit(g);
@@ -6152,6 +6161,7 @@ static LLVMValueRef ir_render_instruction(CodeGen *g, IrExecutable *executable,
case IrInstructionIdUndeclaredIdent:
case IrInstructionIdCallExtra:
case IrInstructionIdCallSrc:
+ case IrInstructionIdCallSrcArgs:
case IrInstructionIdAllocaSrc:
case IrInstructionIdEndExpr:
case IrInstructionIdImplicitCast:
@@ -8132,7 +8142,6 @@ static void define_builtin_fns(CodeGen *g) {
create_builtin_fn(g, BuiltinFnIdNearbyInt, "nearbyInt", 2);
create_builtin_fn(g, BuiltinFnIdRound, "round", 2);
create_builtin_fn(g, BuiltinFnIdMulAdd, "mulAdd", 4);
- create_builtin_fn(g, BuiltinFnIdInlineCall, "inlineCall", SIZE_MAX);
create_builtin_fn(g, BuiltinFnIdNewStackCall, "newStackCall", SIZE_MAX);
create_builtin_fn(g, BuiltinFnIdAsyncCall, "asyncCall", SIZE_MAX);
create_builtin_fn(g, BuiltinFnIdTypeId, "typeId", 1);