Fix more styling and minor issues

This commit is contained in:
Harold Brenes
2025-04-27 23:05:17 -04:00
parent f3923ed666
commit 89533f49e4
3 changed files with 11 additions and 11 deletions
+2 -2
View File
@@ -153,8 +153,8 @@ struct AttributeContext {
Type * objc_superclass; Type * objc_superclass;
Type * objc_ivar; Type * objc_ivar;
Entity *objc_context_provider; Entity *objc_context_provider;
bool objc_is_class_method : 1; bool objc_is_class_method;
bool objc_is_implementation : 1; // This struct or proc provides a class/method implementation, not a binding to an existing type. bool objc_is_implementation; // This struct or proc provides a class/method implementation, not a binding to an existing type.
String require_target_feature; // required by the target micro-architecture String require_target_feature; // required by the target micro-architecture
String enable_target_feature; // will be enabled for the procedure only String enable_target_feature; // will be enabled for the procedure only
+5 -5
View File
@@ -1269,7 +1269,7 @@ String lb_get_objc_type_encoding(Type *t, gbAllocator allocator, isize pointer_d
return build_context.metrics.ptr_size == 4 ? str_lit("{string=*i}") : str_lit("{string=*q}"); return build_context.metrics.ptr_size == 4 ? str_lit("{string=*i}") : str_lit("{string=*q}");
case Basic_cstring: return str_lit("*"); case Basic_cstring: return str_lit("*");
case Basic_any: return str_lit("{any=^v^v"); // rawptr + ^Type_Info case Basic_any: return str_lit("{any=^v^v}"); // rawptr + ^Type_Info
case Basic_typeid: case Basic_typeid:
GB_ASSERT(t->Basic.size == 8); GB_ASSERT(t->Basic.size == 8);
@@ -1458,14 +1458,14 @@ gb_internal void lb_register_objc_thing(
LLVMSetInitializer(v.value, LLVMConstNull(t)); LLVMSetInitializer(v.value, LLVMConstNull(t));
} }
lbValue class_ptr{}; lbValue class_ptr = {};
lbValue class_name = lb_const_value(m, t_cstring, exact_value_string(g.name)); lbValue class_name = lb_const_value(m, t_cstring, exact_value_string(g.name));
// If this class requires an implementation, save it for registration below. // If this class requires an implementation, save it for registration below.
if (g.class_impl_type != nullptr) { if (g.class_impl_type != nullptr) {
// Make sure the superclass has been initialized before us // Make sure the superclass has been initialized before us
lbValue superclass_value{}; lbValue superclass_value = lb_const_nil(m, t_objc_Class);
auto &tn = g.class_impl_type->Named.type_name->TypeName; auto &tn = g.class_impl_type->Named.type_name->TypeName;
Type *superclass = tn.objc_superclass; Type *superclass = tn.objc_superclass;
@@ -1478,7 +1478,7 @@ gb_internal void lb_register_objc_thing(
} }
args.count = 3; args.count = 3;
args[0] = superclass == nullptr ? lb_const_nil(m, t_objc_Class) : superclass_value; args[0] = superclass_value;
args[1] = class_name; args[1] = class_name;
args[2] = lb_const_int(m, t_uint, 0); args[2] = lb_const_int(m, t_uint, 0);
class_ptr = lb_emit_runtime_call(p, "objc_allocateClassPair", args); class_ptr = lb_emit_runtime_call(p, "objc_allocateClassPair", args);
@@ -1640,7 +1640,7 @@ gb_internal void lb_finalize_objc_names(lbGenerator *gen, lbProcedure *p) {
wrapper_args[0] = md.ac.objc_is_class_method ? t_objc_Class : class_ptr_type; wrapper_args[0] = md.ac.objc_is_class_method ? t_objc_Class : class_ptr_type;
wrapper_args[1] = t_objc_SEL; wrapper_args[1] = t_objc_SEL;
auto method_param_count = (isize)method_type->Proc.param_count; isize method_param_count = method_type->Proc.param_count;
i32 method_param_offset = 0; i32 method_param_offset = 0;
// TODO(harold): Need to make sure (at checker stage) that the non-class method has the self parameter already. // TODO(harold): Need to make sure (at checker stage) that the non-class method has the self parameter already.