Fix issue with deferred_* attributes

This commit is contained in:
gingerBill
2019-03-15 16:39:49 +00:00
parent 394baa9ddd
commit 885c5dc8b7
2 changed files with 10 additions and 12 deletions
+4 -4
View File
@@ -2005,7 +2005,7 @@ DECL_ATTRIBUTE_PROC(proc_decl_attribute) {
if (value != nullptr) {
Operand o = {};
check_expr(c, &o, value);
Entity *e = entity_of_ident(o.expr);
Entity *e = entity_of_node(o.expr);
if (e != nullptr && e->kind == Entity_Procedure) {
warning(elem, "'%.*s' is deprecated, please use one of the following instead: 'deferred_none', 'deferred_in', 'deferred_out'", LIT(name));
if (ac->deferred_procedure.entity != nullptr) {
@@ -2022,7 +2022,7 @@ DECL_ATTRIBUTE_PROC(proc_decl_attribute) {
if (value != nullptr) {
Operand o = {};
check_expr(c, &o, value);
Entity *e = entity_of_ident(o.expr);
Entity *e = entity_of_node(o.expr);
if (e != nullptr && e->kind == Entity_Procedure) {
ac->deferred_procedure.kind = DeferredProcedure_none;
ac->deferred_procedure.entity = e;
@@ -2035,7 +2035,7 @@ DECL_ATTRIBUTE_PROC(proc_decl_attribute) {
if (value != nullptr) {
Operand o = {};
check_expr(c, &o, value);
Entity *e = entity_of_ident(o.expr);
Entity *e = entity_of_node(o.expr);
if (e != nullptr && e->kind == Entity_Procedure) {
if (ac->deferred_procedure.entity != nullptr) {
error(elem, "Previous usage of a 'deferred_*' attribute");
@@ -2051,7 +2051,7 @@ DECL_ATTRIBUTE_PROC(proc_decl_attribute) {
if (value != nullptr) {
Operand o = {};
check_expr(c, &o, value);
Entity *e = entity_of_ident(o.expr);
Entity *e = entity_of_node(o.expr);
if (e != nullptr && e->kind == Entity_Procedure) {
if (ac->deferred_procedure.entity != nullptr) {
error(elem, "Previous usage of a 'deferred_*' attribute");
+6 -8
View File
@@ -2972,18 +2972,16 @@ irValue *ir_emit_call(irProcedure *p, irValue *value, Array<irValue *> args, Pro
Type *original_type = e->type;
Type *new_type = pt->Proc.abi_compat_params[i];
if (!are_types_identical(original_type, new_type)) {
Type *arg_type = ir_type(args[i]);
Type *arg_type = ir_type(args[i]);
if (are_types_identical(arg_type, new_type)) {
// NOTE(bill): Done
} else if (!are_types_identical(original_type, new_type)) {
if (is_type_pointer(new_type) && !is_type_pointer(original_type)) {
if (e->flags&EntityFlag_Value) {
args[i] = ir_address_from_load_or_generate_local(p, args[i]);
} else {
if (is_type_pointer(arg_type)) {
// args[i] = ir_copy_value_to_ptr(p, ir_emit_load(p, args[i]), original_type, 16);
} else {
args[i] = ir_copy_value_to_ptr(p, args[i], original_type, 16);
}
} else if (!is_type_pointer(arg_type)) {
args[i] = ir_copy_value_to_ptr(p, args[i], original_type, 16);
}
} else if (is_type_integer(new_type)) {
args[i] = ir_emit_transmute(p, args[i], new_type);