aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHarold Brenes <harold@hbrenes.com>2025-04-27 23:05:17 -0400
committerHarold Brenes <harold@hbrenes.com>2025-04-27 23:05:17 -0400
commit89533f49e4fc2ae6f16551a51acaad115faffecd (patch)
treeebb85685c21084ed94c5cab17a64197d9cdc9426 /src
parentf3923ed66640ea9fd342ca851fdd2bd794405e0c (diff)
Fix more styling and minor issues
Diffstat (limited to 'src')
-rw-r--r--src/checker.cpp2
-rw-r--r--src/checker.hpp4
-rw-r--r--src/llvm_backend.cpp16
3 files changed, 11 insertions, 11 deletions
diff --git a/src/checker.cpp b/src/checker.cpp
index 6563b1c58..15d19fb1a 100644
--- a/src/checker.cpp
+++ b/src/checker.cpp
@@ -6491,7 +6491,7 @@ gb_internal void check_objc_context_provider_procedures(Checker *c) {
Type *proc_type = proc_entity->type;
// TODO(harold): Give better errors here (specify exactly what's wrong)
- const char* signature_error = "The procedure for @(objc_context_provider) has an incorrect signature.";
+ const char *signature_error = "The procedure for @(objc_context_provider) has an incorrect signature.";
if (proc_type->Proc.param_count != 1 || proc_type->Proc.result_count != 1) {
error(proc_entity->token, signature_error);
diff --git a/src/checker.hpp b/src/checker.hpp
index 336f09a7e..0f7e1cb59 100644
--- a/src/checker.hpp
+++ b/src/checker.hpp
@@ -153,8 +153,8 @@ struct AttributeContext {
Type * objc_superclass;
Type * objc_ivar;
Entity *objc_context_provider;
- bool objc_is_class_method : 1;
- bool objc_is_implementation : 1; // This struct or proc provides a class/method implementation, not a binding to an existing type.
+ bool objc_is_class_method;
+ 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 enable_target_feature; // will be enabled for the procedure only
diff --git a/src/llvm_backend.cpp b/src/llvm_backend.cpp
index 7ffd4ea30..aec8b7fc5 100644
--- a/src/llvm_backend.cpp
+++ b/src/llvm_backend.cpp
@@ -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}");
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:
GB_ASSERT(t->Basic.size == 8);
@@ -1458,16 +1458,16 @@ gb_internal void lb_register_objc_thing(
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));
// If this class requires an implementation, save it for registration below.
if (g.class_impl_type != nullptr) {
// 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;
if (superclass != nullptr) {
auto& superclass_global = string_map_must_get(&class_map, superclass->Named.type_name->TypeName.objc_class_name);
@@ -1478,7 +1478,7 @@ gb_internal void lb_register_objc_thing(
}
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[2] = lb_const_int(m, t_uint, 0);
class_ptr = lb_emit_runtime_call(p, "objc_allocateClassPair", args);
@@ -1627,7 +1627,7 @@ gb_internal void lb_finalize_objc_names(lbGenerator *gen, lbProcedure *p) {
continue;
}
- for (const ObjcMethodData& md : *methods) {
+ for (const ObjcMethodData &md : *methods) {
GB_ASSERT( md.proc_entity->kind == Entity_Procedure);
Type *method_type = md.proc_entity->type;
@@ -1640,8 +1640,8 @@ 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[1] = t_objc_SEL;
- auto method_param_count = (isize)method_type->Proc.param_count;
- i32 method_param_offset = 0;
+ isize method_param_count = method_type->Proc.param_count;
+ i32 method_param_offset = 0;
// TODO(harold): Need to make sure (at checker stage) that the non-class method has the self parameter already.
// (Maybe this is already accounted for?.)