aboutsummaryrefslogtreecommitdiff
path: root/src/checker.cpp
diff options
context:
space:
mode:
authorUsername-Leon <leonardo.temperanza@gmail.com>2025-10-15 15:30:32 +0200
committerUsername-Leon <leonardo.temperanza@gmail.com>2025-10-15 15:30:32 +0200
commit4dd6bb2e871e9b8583a89e62ce36a98d02d48cc3 (patch)
tree25b7599645caf76ebe9136da51e5114006ab93f4 /src/checker.cpp
parente10093bd991334789031df9ed587d27823ca90dd (diff)
parent596066aa0453752f24cc2fa5087fafe2c4686536 (diff)
Merge branch 'master' of https://github.com/LeonardoTemperanza/Odin
Diffstat (limited to 'src/checker.cpp')
-rw-r--r--src/checker.cpp37
1 files changed, 23 insertions, 14 deletions
diff --git a/src/checker.cpp b/src/checker.cpp
index 32bda2e43..8b3638c9d 100644
--- a/src/checker.cpp
+++ b/src/checker.cpp
@@ -1416,6 +1416,8 @@ gb_internal void init_universal(void) {
t_objc_SEL = alloc_type_pointer(t_objc_selector);
t_objc_Class = alloc_type_pointer(t_objc_class);
t_objc_Ivar = alloc_type_pointer(t_objc_ivar);
+
+ t_objc_instancetype = add_global_type_name(intrinsics_pkg->scope, str_lit("objc_instancetype"), t_objc_id);
}
}
@@ -1499,9 +1501,12 @@ gb_internal void destroy_checker_info(CheckerInfo *i) {
map_destroy(&i->objc_msgSend_types);
string_set_destroy(&i->obcj_class_name_set);
- mpsc_destroy(&i->objc_class_implementations);
map_destroy(&i->objc_method_implementations);
+ // NOTE(harold): Disabling this: It can cause the 'count == 0' assert to trigger
+ // when there's checker errors and the queue is still full as it did not reach the generation stage.
+ // mpsc_destroy(&i->objc_class_implementations);
+
string_map_destroy(&i->load_file_cache);
string_map_destroy(&i->load_directory_cache);
map_destroy(&i->load_directory_map);
@@ -3386,12 +3391,20 @@ gb_internal void init_core_map_type(Checker *c) {
t_raw_map_ptr = alloc_type_pointer(t_raw_map);
}
+gb_internal void init_core_objc_c(Checker *c) {
+ if (build_context.metrics.os == TargetOs_darwin) {
+ t_objc_super = find_core_type(c, str_lit("objc_super"));
+ t_objc_super_ptr = alloc_type_pointer(t_objc_super);
+ }
+}
+
gb_internal void init_preload(Checker *c) {
init_core_type_info(c);
init_mem_allocator(c);
init_core_context(c);
init_core_source_code_location(c);
init_core_map_type(c);
+ init_core_objc_c(c);
}
gb_internal ExactValue check_decl_attribute_value(CheckerContext *c, Ast *value) {
@@ -5080,26 +5093,22 @@ gb_internal void add_import_dependency_node(Checker *c, Ast *decl, PtrMap<AstPac
error(token, "Unable to find package: %.*s", LIT(path));
exit_with_errors();
}
- AstPackage *pkg = *found;
- GB_ASSERT(pkg->scope != nullptr);
-
- id->package = pkg;
+ AstPackage *child_pkg = *found;
+ GB_ASSERT(child_pkg->scope != nullptr);
- ImportGraphNode **found_node = nullptr;
- ImportGraphNode *m = nullptr;
- ImportGraphNode *n = nullptr;
+ id->package = child_pkg;
- found_node = map_get(M, pkg);
+ ImportGraphNode **found_node = map_get(M, child_pkg);
GB_ASSERT(found_node != nullptr);
- m = *found_node;
+ ImportGraphNode *child = *found_node;
found_node = map_get(M, parent_pkg);
GB_ASSERT(found_node != nullptr);
- n = *found_node;
+ ImportGraphNode *parent = *found_node;
- import_graph_node_set_add(&n->succ, m);
- import_graph_node_set_add(&m->pred, n);
- ptr_set_add(&m->scope->imported, n->scope);
+ import_graph_node_set_add(&parent->succ, child);
+ import_graph_node_set_add(&child->pred, parent);
+ ptr_set_add(&parent->scope->imported, child->scope);
case_end;
case_ast_node(ws, WhenStmt, decl);