Browse Source

Remove dead code in the compiler

gingerBill 2 years ago
parent
commit
c1f5be24e2

+ 1 - 0
build.bat

@@ -62,6 +62,7 @@ if %release_mode% EQU 0 ( rem Debug
 set compiler_warnings= ^
 set compiler_warnings= ^
 	-W4 -WX ^
 	-W4 -WX ^
 	-wd4100 -wd4101 -wd4127 -wd4146 ^
 	-wd4100 -wd4101 -wd4127 -wd4146 ^
+	-wd4505 ^
 	-wd4456 -wd4457
 	-wd4456 -wd4457
 
 
 set compiler_includes= ^
 set compiler_includes= ^

+ 1 - 5
src/build_settings.cpp

@@ -149,7 +149,6 @@ enum CommandKind : u32 {
 	Command_run             = 1<<0,
 	Command_run             = 1<<0,
 	Command_build           = 1<<1,
 	Command_build           = 1<<1,
 	Command_check           = 1<<3,
 	Command_check           = 1<<3,
-	Command_query           = 1<<4,
 	Command_doc             = 1<<5,
 	Command_doc             = 1<<5,
 	Command_version         = 1<<6,
 	Command_version         = 1<<6,
 	Command_test            = 1<<7,
 	Command_test            = 1<<7,
@@ -157,7 +156,7 @@ enum CommandKind : u32 {
 	Command_strip_semicolon = 1<<8,
 	Command_strip_semicolon = 1<<8,
 	Command_bug_report      = 1<<9,
 	Command_bug_report      = 1<<9,
 
 
-	Command__does_check = Command_run|Command_build|Command_check|Command_query|Command_doc|Command_test|Command_strip_semicolon,
+	Command__does_check = Command_run|Command_build|Command_check|Command_doc|Command_test|Command_strip_semicolon,
 	Command__does_build = Command_run|Command_build|Command_test,
 	Command__does_build = Command_run|Command_build|Command_test,
 	Command_all = ~(u32)0,
 	Command_all = ~(u32)0,
 };
 };
@@ -166,7 +165,6 @@ gb_global char const *odin_command_strings[32] = {
 	"run",
 	"run",
 	"build",
 	"build",
 	"check",
 	"check",
-	"query",
 	"doc",
 	"doc",
 	"version",
 	"version",
 	"test",
 	"test",
@@ -316,8 +314,6 @@ struct BuildContext {
 	u32 cmd_doc_flags;
 	u32 cmd_doc_flags;
 	Array<String> extra_packages;
 	Array<String> extra_packages;
 
 
-	QueryDataSetSettings query_data_set_settings;
-
 	StringSet test_names;
 	StringSet test_names;
 
 
 	gbAffinity affinity;
 	gbAffinity affinity;

+ 0 - 10
src/check_decl.cpp

@@ -232,16 +232,6 @@ gb_internal Ast *remove_type_alias_clutter(Ast *node) {
 	}
 	}
 }
 }
 
 
-gb_internal isize total_attribute_count(DeclInfo *decl) {
-	isize attribute_count = 0;
-	for_array(i, decl->attributes) {
-		Ast *attr = decl->attributes[i];
-		if (attr->kind != Ast_Attribute) continue;
-		attribute_count += attr->Attribute.elems.count;
-	}
-	return attribute_count;
-}
-
 gb_internal Type *clone_enum_type(CheckerContext *ctx, Type *original_enum_type, Type *named_type) {
 gb_internal Type *clone_enum_type(CheckerContext *ctx, Type *original_enum_type, Type *named_type) {
 	// NOTE(bill, 2022-02-05): Stupid edge case for `distinct` declarations
 	// NOTE(bill, 2022-02-05): Stupid edge case for `distinct` declarations
 	//
 	//

+ 0 - 24
src/check_expr.cpp

@@ -5103,16 +5103,6 @@ gb_internal bool check_unpack_arguments(CheckerContext *ctx, Entity **lhs, isize
 	return optional_ok;
 	return optional_ok;
 }
 }
 
 
-
-gb_internal bool is_expr_constant_zero(Ast *expr) {
-	GB_ASSERT(expr != nullptr);
-	auto v = exact_value_to_integer(expr->tav.value);
-	if (v.kind == ExactValue_Integer) {
-		return big_int_cmp_zero(&v.value_integer) == 0;
-	}
-	return false;
-}
-
 gb_internal isize get_procedure_param_count_excluding_defaults(Type *pt, isize *param_count_) {
 gb_internal isize get_procedure_param_count_excluding_defaults(Type *pt, isize *param_count_) {
 	GB_ASSERT(pt != nullptr);
 	GB_ASSERT(pt != nullptr);
 	GB_ASSERT(pt->kind == Type_Proc);
 	GB_ASSERT(pt->kind == Type_Proc);
@@ -5429,20 +5419,6 @@ gb_internal isize lookup_procedure_parameter(TypeProc *pt, String parameter_name
 	}
 	}
 	return -1;
 	return -1;
 }
 }
-gb_internal isize lookup_procedure_result(TypeProc *pt, String result_name) {
-	isize result_count = pt->result_count;
-	for (isize i = 0; i < result_count; i++) {
-		Entity *e = pt->results->Tuple.variables[i];
-		String name = e->token.string;
-		if (is_blank_ident(name)) {
-			continue;
-		}
-		if (name == result_name) {
-			return i;
-		}
-	}
-	return -1;
-}
 
 
 gb_internal CALL_ARGUMENT_CHECKER(check_named_call_arguments) {
 gb_internal CALL_ARGUMENT_CHECKER(check_named_call_arguments) {
 	ast_node(ce, CallExpr, call);
 	ast_node(ce, CallExpr, call);

+ 0 - 6
src/check_stmt.cpp

@@ -1520,12 +1520,6 @@ gb_internal void check_stmt_internal(CheckerContext *ctx, Ast *node, u32 flags)
 		}
 		}
 	case_end;
 	case_end;
 
 
-	case_ast_node(ts, TagStmt, node);
-		// TODO(bill): Tag Statements
-		error(node, "Tag statements are not supported yet");
-		check_stmt(ctx, ts->stmt, flags);
-	case_end;
-
 	case_ast_node(as, AssignStmt, node);
 	case_ast_node(as, AssignStmt, node);
 		switch (as->op.kind) {
 		switch (as->op.kind) {
 		case Token_Eq: {
 		case Token_Eq: {

+ 39 - 101
src/checker.cpp

@@ -61,18 +61,6 @@ gb_internal void scope_reserve(Scope *scope, isize capacity) {
 	}
 	}
 }
 }
 
 
-gb_internal i32 is_scope_an_ancestor(Scope *parent, Scope *child) {
-	i32 i = 0;
-	while (child != nullptr) {
-		if (parent == child) {
-			return i;
-		}
-		child = child->parent;
-		i++;
-	}
-	return -1;
-}
-
 gb_internal void entity_graph_node_set_destroy(EntityGraphNodeSet *s) {
 gb_internal void entity_graph_node_set_destroy(EntityGraphNodeSet *s) {
 	if (s->hashes.data != nullptr) {
 	if (s->hashes.data != nullptr) {
 		ptr_set_destroy(s);
 		ptr_set_destroy(s);
@@ -86,9 +74,9 @@ gb_internal void entity_graph_node_set_add(EntityGraphNodeSet *s, EntityGraphNod
 	ptr_set_add(s, n);
 	ptr_set_add(s, n);
 }
 }
 
 
-gb_internal bool entity_graph_node_set_exists(EntityGraphNodeSet *s, EntityGraphNode *n) {
-	return ptr_set_exists(s, n);
-}
+// gb_internal bool entity_graph_node_set_exists(EntityGraphNodeSet *s, EntityGraphNode *n) {
+// 	return ptr_set_exists(s, n);
+// }
 
 
 gb_internal void entity_graph_node_set_remove(EntityGraphNodeSet *s, EntityGraphNode *n) {
 gb_internal void entity_graph_node_set_remove(EntityGraphNodeSet *s, EntityGraphNode *n) {
 	ptr_set_remove(s, n);
 	ptr_set_remove(s, n);
@@ -139,13 +127,13 @@ gb_internal void import_graph_node_set_add(ImportGraphNodeSet *s, ImportGraphNod
 	ptr_set_add(s, n);
 	ptr_set_add(s, n);
 }
 }
 
 
-gb_internal bool import_graph_node_set_exists(ImportGraphNodeSet *s, ImportGraphNode *n) {
-	return ptr_set_exists(s, n);
-}
+// gb_internal bool import_graph_node_set_exists(ImportGraphNodeSet *s, ImportGraphNode *n) {
+// 	return ptr_set_exists(s, n);
+// }
 
 
-gb_internal void import_graph_node_set_remove(ImportGraphNodeSet *s, ImportGraphNode *n) {
-	ptr_set_remove(s, n);
-}
+// gb_internal void import_graph_node_set_remove(ImportGraphNodeSet *s, ImportGraphNode *n) {
+// 	ptr_set_remove(s, n);
+// }
 
 
 gb_internal ImportGraphNode *import_graph_node_create(gbAllocator a, AstPackage *pkg) {
 gb_internal ImportGraphNode *import_graph_node_create(gbAllocator a, AstPackage *pkg) {
 	ImportGraphNode *n = gb_alloc_item(a, ImportGraphNode);
 	ImportGraphNode *n = gb_alloc_item(a, ImportGraphNode);
@@ -186,15 +174,6 @@ gb_internal void import_graph_node_swap(ImportGraphNode **data, isize i, isize j
 	y->index = i;
 	y->index = i;
 }
 }
 
 
-gb_internal GB_COMPARE_PROC(ast_node_cmp) {
-	Ast *x = *cast(Ast **)a;
-	Ast *y = *cast(Ast **)b;
-	Token i = ast_token(x);
-	Token j = ast_token(y);
-	return token_pos_cmp(i.pos, j.pos);
-}
-
-
 
 
 
 
 
 
@@ -213,27 +192,27 @@ gb_internal DeclInfo *make_decl_info(Scope *scope, DeclInfo *parent) {
 	return d;
 	return d;
 }
 }
 
 
-gb_internal void destroy_declaration_info(DeclInfo *d) {
-	ptr_set_destroy(&d->deps);
-	array_free(&d->labels);
-}
+// gb_internal void destroy_declaration_info(DeclInfo *d) {
+// 	ptr_set_destroy(&d->deps);
+// 	array_free(&d->labels);
+// }
 
 
-gb_internal bool decl_info_has_init(DeclInfo *d) {
-	if (d->init_expr != nullptr) {
-		return true;
-	}
-	if (d->proc_lit != nullptr) {
-		switch (d->proc_lit->kind) {
-		case_ast_node(pl, ProcLit, d->proc_lit);
-			if (pl->body != nullptr) {
-				return true;
-			}
-		case_end;
-		}
-	}
+// gb_internal bool decl_info_has_init(DeclInfo *d) {
+// 	if (d->init_expr != nullptr) {
+// 		return true;
+// 	}
+// 	if (d->proc_lit != nullptr) {
+// 		switch (d->proc_lit->kind) {
+// 		case_ast_node(pl, ProcLit, d->proc_lit);
+// 			if (pl->body != nullptr) {
+// 				return true;
+// 			}
+// 		case_end;
+// 		}
+// 	}
 
 
-	return false;
-}
+// 	return false;
+// }
 
 
 
 
 
 
@@ -528,11 +507,6 @@ struct VettedEntity {
 	Entity *entity;
 	Entity *entity;
 	Entity *other;
 	Entity *other;
 };
 };
-gb_internal void init_vetted_entity(VettedEntity *ve, VettedEntityKind kind, Entity *entity, Entity *other=nullptr)  {
-	ve->kind = kind;
-	ve->entity = entity;
-	ve->other = other;
-}
 
 
 
 
 gb_internal GB_COMPARE_PROC(vetted_entity_variable_pos_cmp) {
 gb_internal GB_COMPARE_PROC(vetted_entity_variable_pos_cmp) {
@@ -1144,7 +1118,7 @@ gb_internal void init_checker_info(CheckerInfo *i) {
 
 
 
 
 
 
-	i->allow_identifier_uses = build_context.query_data_set_settings.kind == QueryDataSet_GoToDefinitions;
+	i->allow_identifier_uses = false;
 	if (i->allow_identifier_uses) {
 	if (i->allow_identifier_uses) {
 		array_init(&i->identifier_uses, a);
 		array_init(&i->identifier_uses, a);
 	}
 	}
@@ -1226,13 +1200,10 @@ gb_internal CheckerContext make_checker_context(Checker *c) {
 
 
 	ctx.type_path = new_checker_type_path();
 	ctx.type_path = new_checker_type_path();
 	ctx.type_level = 0;
 	ctx.type_level = 0;
-	ctx.poly_path = new_checker_poly_path();
-	ctx.poly_level = 0;
 	return ctx;
 	return ctx;
 }
 }
 gb_internal void destroy_checker_context(CheckerContext *ctx) {
 gb_internal void destroy_checker_context(CheckerContext *ctx) {
 	destroy_checker_type_path(ctx->type_path);
 	destroy_checker_type_path(ctx->type_path);
-	destroy_checker_poly_path(ctx->poly_path);
 }
 }
 
 
 gb_internal void add_curr_ast_file(CheckerContext *ctx, AstFile *file) {
 gb_internal void add_curr_ast_file(CheckerContext *ctx, AstFile *file) {
@@ -1348,17 +1319,17 @@ gb_internal DeclInfo *decl_info_of_entity(Entity *e) {
 	return nullptr;
 	return nullptr;
 }
 }
 
 
-gb_internal DeclInfo *decl_info_of_ident(Ast *ident) {
-	return decl_info_of_entity(entity_of_node(ident));
-}
+// gb_internal DeclInfo *decl_info_of_ident(Ast *ident) {
+// 	return decl_info_of_entity(entity_of_node(ident));
+// }
 
 
-gb_internal AstFile *ast_file_of_filename(CheckerInfo *i, String filename) {
-	AstFile **found = string_map_get(&i->files, filename);
-	if (found != nullptr) {
-		return *found;
-	}
-	return nullptr;
-}
+// gb_internal AstFile *ast_file_of_filename(CheckerInfo *i, String filename) {
+// 	AstFile **found = string_map_get(&i->files, filename);
+// 	if (found != nullptr) {
+// 		return *found;
+// 	}
+// 	return nullptr;
+// }
 gb_internal ExprInfo *check_get_expr_info(CheckerContext *c, Ast *expr) {
 gb_internal ExprInfo *check_get_expr_info(CheckerContext *c, Ast *expr) {
 	if (c->untyped != nullptr) {
 	if (c->untyped != nullptr) {
 		ExprInfo **found = map_get(c->untyped, expr);
 		ExprInfo **found = map_get(c->untyped, expr);
@@ -2684,32 +2655,6 @@ gb_internal Entity *check_type_path_pop(CheckerContext *c) {
 }
 }
 
 
 
 
-gb_internal CheckerPolyPath *new_checker_poly_path(void) {
-	gbAllocator a = heap_allocator();
-	auto *pp = gb_alloc_item(a, CheckerPolyPath);
-	array_init(pp, a, 0, 16);
-	return pp;
-}
-
-gb_internal void destroy_checker_poly_path(CheckerPolyPath *pp) {
-	array_free(pp);
-	gb_free(heap_allocator(), pp);
-}
-
-
-gb_internal void check_poly_path_push(CheckerContext *c, Type *t) {
-	GB_ASSERT(c->poly_path != nullptr);
-	GB_ASSERT(t != nullptr);
-	GB_ASSERT(is_type_polymorphic(t));
-	array_add(c->poly_path, t);
-}
-
-gb_internal Type *check_poly_path_pop(CheckerContext *c) {
-	GB_ASSERT(c->poly_path != nullptr);
-	return array_pop(c->poly_path);
-}
-
-
 
 
 gb_internal Array<Entity *> proc_group_entities(CheckerContext *c, Operand o) {
 gb_internal Array<Entity *> proc_group_entities(CheckerContext *c, Operand o) {
 	Array<Entity *> procs = {};
 	Array<Entity *> procs = {};
@@ -2878,13 +2823,6 @@ gb_internal ExactValue check_decl_attribute_value(CheckerContext *c, Ast *value)
 	return ev;
 	return ev;
 }
 }
 
 
-gb_internal Type *check_decl_attribute_type(CheckerContext *c, Ast *value) {
-	if (value != nullptr) {
-		return check_type(c, value);
-	}
-	return nullptr;
-}
-
 
 
 #define ATTRIBUTE_USER_TAG_NAME "tag"
 #define ATTRIBUTE_USER_TAG_NAME "tag"
 
 

+ 0 - 8
src/checker.hpp

@@ -397,8 +397,6 @@ struct CheckerContext {
 
 
 	CheckerTypePath *type_path;
 	CheckerTypePath *type_path;
 	isize            type_level; // TODO(bill): Actually handle correctly
 	isize            type_level; // TODO(bill): Actually handle correctly
-	CheckerPolyPath *poly_path;
-	isize            poly_level; // TODO(bill): Actually handle correctly
 
 
 	UntypedExprInfoMap *untyped;
 	UntypedExprInfoMap *untyped;
 
 
@@ -489,12 +487,6 @@ gb_internal void destroy_checker_type_path(CheckerTypePath *tp);
 gb_internal void    check_type_path_push(CheckerContext *c, Entity *e);
 gb_internal void    check_type_path_push(CheckerContext *c, Entity *e);
 gb_internal Entity *check_type_path_pop (CheckerContext *c);
 gb_internal Entity *check_type_path_pop (CheckerContext *c);
 
 
-gb_internal CheckerPolyPath *new_checker_poly_path();
-gb_internal void destroy_checker_poly_path(CheckerPolyPath *);
-
-gb_internal void  check_poly_path_push(CheckerContext *c, Type *t);
-gb_internal Type *check_poly_path_pop (CheckerContext *c);
-
 gb_internal void init_core_context(Checker *c);
 gb_internal void init_core_context(Checker *c);
 gb_internal void init_mem_allocator(Checker *c);
 gb_internal void init_mem_allocator(Checker *c);
 
 

+ 9 - 0
src/common.cpp

@@ -50,6 +50,10 @@ gb_internal void debugf(char const *fmt, ...);
 #include "string.cpp"
 #include "string.cpp"
 #include "range_cache.cpp"
 #include "range_cache.cpp"
 
 
+#if defined(GB_SYSTEM_WINDOWS)
+	#pragma warning(push)
+	#pragma warning(disable: 4505)
+#endif
 
 
 gb_internal gb_inline bool is_power_of_two(i64 x) {
 gb_internal gb_inline bool is_power_of_two(i64 x) {
 	if (x <= 0) {
 	if (x <= 0) {
@@ -900,3 +904,8 @@ gb_internal Slice<DistanceAndTarget> did_you_mean_results(DidYouMeanAnswers *d)
 	}
 	}
 	return slice_array(d->distances, 0, count);
 	return slice_array(d->distances, 0, count);
 }
 }
+
+
+#if defined(GB_SYSTEM_WINDOWS)
+	#pragma warning(pop)
+#endif

+ 0 - 9
src/docs.cpp

@@ -85,15 +85,6 @@ gb_internal void print_doc_line(i32 indent, char const *fmt, ...) {
 	va_end(va);
 	va_end(va);
 	gb_printf("\n");
 	gb_printf("\n");
 }
 }
-gb_internal void print_doc_line_no_newline(i32 indent, char const *fmt, ...) {
-	while (indent --> 0) {
-		gb_printf("\t");
-	}
-	va_list va;
-	va_start(va, fmt);
-	gb_printf_va(fmt, va);
-	va_end(va);
-}
 gb_internal void print_doc_line_no_newline(i32 indent, String const &data) {
 gb_internal void print_doc_line_no_newline(i32 indent, String const &data) {
 	while (indent --> 0) {
 	while (indent --> 0) {
 		gb_printf("\t");
 		gb_printf("\t");

+ 0 - 8
src/entity.cpp

@@ -404,14 +404,6 @@ gb_internal Entity *alloc_entity_proc_group(Scope *scope, Token token, Type *typ
 	return entity;
 	return entity;
 }
 }
 
 
-
-gb_internal Entity *alloc_entity_builtin(Scope *scope, Token token, Type *type, i32 id) {
-	Entity *entity = alloc_entity(Entity_Builtin, scope, token, type);
-	entity->Builtin.id = id;
-	entity->state = EntityState_Resolved;
-	return entity;
-}
-
 gb_internal Entity *alloc_entity_import_name(Scope *scope, Token token, Type *type,
 gb_internal Entity *alloc_entity_import_name(Scope *scope, Token token, Type *type,
                                  String path, String name, Scope *import_scope) {
                                  String path, String name, Scope *import_scope) {
 	Entity *entity = alloc_entity(Entity_ImportName, scope, token, type);
 	Entity *entity = alloc_entity(Entity_ImportName, scope, token, type);

+ 38 - 48
src/exact_value.cpp

@@ -15,16 +15,6 @@ struct Quaternion256 {
 	f64 imag, jmag, kmag, real;
 	f64 imag, jmag, kmag, real;
 };
 };
 
 
-gb_internal Quaternion256 quaternion256_inverse(Quaternion256 x) {
-	f64 invmag2 = 1.0 / (x.real*x.real + x.imag*x.imag + x.jmag*x.jmag + x.kmag*x.kmag);
-	x.real = +x.real * invmag2;
-	x.imag = -x.imag * invmag2;
-	x.jmag = -x.jmag * invmag2;
-	x.kmag = -x.kmag * invmag2;
-	return x;
-}
-
-
 enum ExactValueKind {
 enum ExactValueKind {
 	ExactValue_Invalid    = 0,
 	ExactValue_Invalid    = 0,
 
 
@@ -453,44 +443,44 @@ gb_internal ExactValue exact_value_kmag(ExactValue v) {
 	return r;
 	return r;
 }
 }
 
 
-gb_internal ExactValue exact_value_make_imag(ExactValue v) {
-	switch (v.kind) {
-	case ExactValue_Integer:
-		return exact_value_complex(0, exact_value_to_float(v).value_float);
-	case ExactValue_Float:
-		return exact_value_complex(0, v.value_float);
-	default:
-		GB_PANIC("Expected an integer or float type for 'exact_value_make_imag'");
-	}
-	ExactValue r = {ExactValue_Invalid};
-	return r;
-}
-
-gb_internal ExactValue exact_value_make_jmag(ExactValue v) {
-	switch (v.kind) {
-	case ExactValue_Integer:
-		return exact_value_quaternion(0, 0, exact_value_to_float(v).value_float, 0);
-	case ExactValue_Float:
-		return exact_value_quaternion(0, 0, v.value_float, 0);
-	default:
-		GB_PANIC("Expected an integer or float type for 'exact_value_make_imag'");
-	}
-	ExactValue r = {ExactValue_Invalid};
-	return r;
-}
-
-gb_internal ExactValue exact_value_make_kmag(ExactValue v) {
-	switch (v.kind) {
-	case ExactValue_Integer:
-		return exact_value_quaternion(0, 0, 0, exact_value_to_float(v).value_float);
-	case ExactValue_Float:
-		return exact_value_quaternion(0, 0, 0, v.value_float);
-	default:
-		GB_PANIC("Expected an integer or float type for 'exact_value_make_imag'");
-	}
-	ExactValue r = {ExactValue_Invalid};
-	return r;
-}
+// gb_internal ExactValue exact_value_make_imag(ExactValue v) {
+// 	switch (v.kind) {
+// 	case ExactValue_Integer:
+// 		return exact_value_complex(0, exact_value_to_float(v).value_float);
+// 	case ExactValue_Float:
+// 		return exact_value_complex(0, v.value_float);
+// 	default:
+// 		GB_PANIC("Expected an integer or float type for 'exact_value_make_imag'");
+// 	}
+// 	ExactValue r = {ExactValue_Invalid};
+// 	return r;
+// }
+
+// gb_internal ExactValue exact_value_make_jmag(ExactValue v) {
+// 	switch (v.kind) {
+// 	case ExactValue_Integer:
+// 		return exact_value_quaternion(0, 0, exact_value_to_float(v).value_float, 0);
+// 	case ExactValue_Float:
+// 		return exact_value_quaternion(0, 0, v.value_float, 0);
+// 	default:
+// 		GB_PANIC("Expected an integer or float type for 'exact_value_make_jmag'");
+// 	}
+// 	ExactValue r = {ExactValue_Invalid};
+// 	return r;
+// }
+
+// gb_internal ExactValue exact_value_make_kmag(ExactValue v) {
+// 	switch (v.kind) {
+// 	case ExactValue_Integer:
+// 		return exact_value_quaternion(0, 0, 0, exact_value_to_float(v).value_float);
+// 	case ExactValue_Float:
+// 		return exact_value_quaternion(0, 0, 0, v.value_float);
+// 	default:
+// 		GB_PANIC("Expected an integer or float type for 'exact_value_make_kmag'");
+// 	}
+// 	ExactValue r = {ExactValue_Invalid};
+// 	return r;
+// }
 
 
 gb_internal i64 exact_value_to_i64(ExactValue v) {
 gb_internal i64 exact_value_to_i64(ExactValue v) {
 	v = exact_value_to_integer(v);
 	v = exact_value_to_integer(v);

+ 5 - 5
src/llvm_backend.cpp

@@ -605,11 +605,11 @@ gb_internal lbValue lb_map_get_proc_for_type(lbModule *m, Type *type) {
 	return {p->value, p->type};
 	return {p->value, p->type};
 }
 }
 
 
-gb_internal void lb_debug_print(lbProcedure *p, String const &str) {
-	auto args = array_make<lbValue>(heap_allocator(), 1);
-	args[0] = lb_const_string(p->module, str);
-	lb_emit_runtime_call(p, "print_string", args);
-}
+// gb_internal void lb_debug_print(lbProcedure *p, String const &str) {
+// 	auto args = array_make<lbValue>(heap_allocator(), 1);
+// 	args[0] = lb_const_string(p->module, str);
+// 	lb_emit_runtime_call(p, "print_string", args);
+// }
 
 
 gb_internal lbValue lb_map_set_proc_for_type(lbModule *m, Type *type) {
 gb_internal lbValue lb_map_set_proc_for_type(lbModule *m, Type *type) {
 	GB_ASSERT(build_context.use_static_map_calls);
 	GB_ASSERT(build_context.use_static_map_calls);

+ 0 - 6
src/llvm_backend_debug.cpp

@@ -14,12 +14,6 @@ gb_internal void lb_set_llvm_metadata(lbModule *m, void *key, LLVMMetadataRef va
 	}
 	}
 }
 }
 
 
-gb_internal LLVMMetadataRef lb_get_llvm_file_metadata_from_node(lbModule *m, Ast *node) {
-	if (node == nullptr) {
-		return nullptr;
-	}
-	return lb_get_llvm_metadata(m, node->file());
-}
 
 
 gb_internal LLVMMetadataRef lb_get_current_debug_scope(lbProcedure *p) {
 gb_internal LLVMMetadataRef lb_get_current_debug_scope(lbProcedure *p) {
 	GB_ASSERT_MSG(p->debug_info != nullptr, "missing debug information for %.*s", LIT(p->name));
 	GB_ASSERT_MSG(p->debug_info != nullptr, "missing debug information for %.*s", LIT(p->name));

+ 0 - 68
src/llvm_backend_general.cpp

@@ -272,12 +272,6 @@ gb_internal lbValue lb_emit_epi(lbModule *m, lbValue const &value, isize index)
 gb_internal LLVMValueRef llvm_zero(lbModule *m) {
 gb_internal LLVMValueRef llvm_zero(lbModule *m) {
 	return LLVMConstInt(lb_type(m, t_int), 0, false);
 	return LLVMConstInt(lb_type(m, t_int), 0, false);
 }
 }
-gb_internal LLVMValueRef llvm_zero32(lbModule *m) {
-	return LLVMConstInt(lb_type(m, t_i32), 0, false);
-}
-gb_internal LLVMValueRef llvm_one(lbModule *m) {
-	return LLVMConstInt(lb_type(m, t_i32), 1, false);
-}
 
 
 gb_internal LLVMValueRef llvm_alloca(lbProcedure *p, LLVMTypeRef llvm_type, isize alignment, char const *name) {
 gb_internal LLVMValueRef llvm_alloca(lbProcedure *p, LLVMTypeRef llvm_type, isize alignment, char const *name) {
 	LLVMPositionBuilderAtEnd(p->builder, p->decl_block->block);
 	LLVMPositionBuilderAtEnd(p->builder, p->decl_block->block);
@@ -874,14 +868,6 @@ gb_internal void lb_addr_store(lbProcedure *p, lbAddr addr, lbValue value) {
 	lb_emit_store(p, addr.addr, value);
 	lb_emit_store(p, addr.addr, value);
 }
 }
 
 
-gb_internal void lb_const_store(lbValue ptr, lbValue value) {
-	GB_ASSERT(lb_is_const(ptr));
-	GB_ASSERT(lb_is_const(value));
-	GB_ASSERT(is_type_pointer(ptr.type));
-	LLVMSetInitializer(ptr.value, value.value);
-}
-
-
 gb_internal bool lb_is_type_proc_recursive(Type *t) {
 gb_internal bool lb_is_type_proc_recursive(Type *t) {
 	for (;;) {
 	for (;;) {
 		if (t == nullptr) {
 		if (t == nullptr) {
@@ -1327,21 +1313,6 @@ gb_internal void lb_clone_struct_type(LLVMTypeRef dst, LLVMTypeRef src) {
 	LLVMStructSetBody(dst, fields, field_count, LLVMIsPackedStruct(src));
 	LLVMStructSetBody(dst, fields, field_count, LLVMIsPackedStruct(src));
 }
 }
 
 
-gb_internal LLVMTypeRef lb_alignment_prefix_type_hack(lbModule *m, i64 alignment) {
-	switch (alignment) {
-	case 1:
-		return LLVMArrayType(lb_type(m, t_u8), 0);
-	case 2:
-		return LLVMArrayType(lb_type(m, t_u16), 0);
-	case 4:
-		return LLVMArrayType(lb_type(m, t_u32), 0);
-	case 8:
-		return LLVMArrayType(lb_type(m, t_u64), 0);
-	default: case 16:
-		return LLVMArrayType(LLVMVectorType(lb_type(m, t_u32), 4), 0);
-	}
-}
-
 gb_internal String lb_mangle_name(lbModule *m, Entity *e) {
 gb_internal String lb_mangle_name(lbModule *m, Entity *e) {
 	String name = e->token.string;
 	String name = e->token.string;
 
 
@@ -2202,9 +2173,6 @@ gb_internal void lb_add_member(lbModule *m, String const &name, lbValue val) {
 		string_map_set(&m->members, name, val);
 		string_map_set(&m->members, name, val);
 	}
 	}
 }
 }
-gb_internal void lb_add_member(lbModule *m, StringHashKey const &key, lbValue val) {
-	string_map_set(&m->members, key, val);
-}
 gb_internal void lb_add_procedure_value(lbModule *m, lbProcedure *p) {
 gb_internal void lb_add_procedure_value(lbModule *m, lbProcedure *p) {
 	if (p->entity != nullptr) {
 	if (p->entity != nullptr) {
 		map_set(&m->procedure_values, p->value, p->entity);
 		map_set(&m->procedure_values, p->value, p->entity);
@@ -2493,42 +2461,6 @@ gb_internal lbValue lb_find_or_add_entity_string(lbModule *m, String const &str)
 	return res;
 	return res;
 }
 }
 
 
-gb_internal lbValue lb_find_or_add_entity_string_byte_slice(lbModule *m, String const &str) {
-	LLVMValueRef indices[2] = {llvm_zero(m), llvm_zero(m)};
-	LLVMValueRef data = LLVMConstStringInContext(m->ctx,
-		cast(char const *)str.text,
-		cast(unsigned)str.len,
-		false);
-
-
-	char *name = nullptr;
-	{
-		isize max_len = 7+8+1;
-		name = gb_alloc_array(permanent_allocator(), char, max_len);
-		u32 id = m->gen->global_array_index.fetch_add(1);
-		isize len = gb_snprintf(name, max_len, "csbs$%x", id);
-		len -= 1;
-	}
-	LLVMTypeRef type = LLVMTypeOf(data);
-	LLVMValueRef global_data = LLVMAddGlobal(m->mod, type, name);
-	LLVMSetInitializer(global_data, data);
-	lb_make_global_private_const(global_data);
-	LLVMSetAlignment(global_data, 1);
-
-	LLVMValueRef ptr = nullptr;
-	if (str.len != 0) {
-		ptr = LLVMConstInBoundsGEP2(type, global_data, indices, 2);
-	} else {
-		ptr = LLVMConstNull(lb_type(m, t_u8_ptr));
-	}
-	LLVMValueRef len = LLVMConstInt(lb_type(m, t_int), str.len, true);
-	LLVMValueRef values[2] = {ptr, len};
-
-	lbValue res = {};
-	res.value = llvm_const_named_struct(m, t_u8_slice, values, 2);
-	res.type = t_u8_slice;
-	return res;
-}
 gb_internal lbValue lb_find_or_add_entity_string_byte_slice_with_type(lbModule *m, String const &str, Type *slice_type) {
 gb_internal lbValue lb_find_or_add_entity_string_byte_slice_with_type(lbModule *m, String const &str, Type *slice_type) {
 	GB_ASSERT(is_type_slice(slice_type));
 	GB_ASSERT(is_type_slice(slice_type));
 	LLVMValueRef indices[2] = {llvm_zero(m), llvm_zero(m)};
 	LLVMValueRef indices[2] = {llvm_zero(m), llvm_zero(m)};

+ 10 - 10
src/llvm_backend_opt.cpp

@@ -37,16 +37,16 @@ gb_internal void lb_add_function_simplifcation_passes(LLVMPassManagerRef mpm, i3
 gb_internal void lb_populate_module_pass_manager(LLVMTargetMachineRef target_machine, LLVMPassManagerRef mpm, i32 optimization_level);
 gb_internal void lb_populate_module_pass_manager(LLVMTargetMachineRef target_machine, LLVMPassManagerRef mpm, i32 optimization_level);
 gb_internal void lb_populate_function_pass_manager_specific(lbModule *m, LLVMPassManagerRef fpm, i32 optimization_level);
 gb_internal void lb_populate_function_pass_manager_specific(lbModule *m, LLVMPassManagerRef fpm, i32 optimization_level);
 
 
-gb_internal LLVMBool lb_must_preserve_predicate_callback(LLVMValueRef value, void *user_data) {
-	lbModule *m = cast(lbModule *)user_data;
-	if (m == nullptr) {
-		return false;
-	}
-	if (value == nullptr) {
-		return false;
-	}
-	return LLVMIsAAllocaInst(value) != nullptr;
-}
+// gb_internal LLVMBool lb_must_preserve_predicate_callback(LLVMValueRef value, void *user_data) {
+// 	lbModule *m = cast(lbModule *)user_data;
+// 	if (m == nullptr) {
+// 		return false;
+// 	}
+// 	if (value == nullptr) {
+// 		return false;
+// 	}
+// 	return LLVMIsAAllocaInst(value) != nullptr;
+// }
 
 
 
 
 #if LLVM_VERSION_MAJOR < 12
 #if LLVM_VERSION_MAJOR < 12

+ 40 - 48
src/llvm_backend_proc.cpp

@@ -383,46 +383,46 @@ gb_internal lbProcedure *lb_create_dummy_procedure(lbModule *m, String link_name
 }
 }
 
 
 
 
-gb_internal lbValue lb_value_param(lbProcedure *p, Entity *e, Type *abi_type, i32 index, lbParamPasskind *kind_) {
-	lbParamPasskind kind = lbParamPass_Value;
-
-	if (e != nullptr && !are_types_identical(abi_type, e->type)) {
-		if (is_type_pointer(abi_type)) {
-			GB_ASSERT(e->kind == Entity_Variable);
-			Type *av = core_type(type_deref(abi_type));
-			if (are_types_identical(av, core_type(e->type))) {
-				kind = lbParamPass_Pointer;
-				if (e->flags&EntityFlag_Value) {
-					kind = lbParamPass_ConstRef;
-				}
-			} else {
-				kind = lbParamPass_BitCast;
-			}
-		} else if (is_type_integer(abi_type)) {
-			kind = lbParamPass_Integer;
-		} else if (abi_type == t_llvm_bool) {
-			kind = lbParamPass_Value;
-		} else if (is_type_boolean(abi_type)) {
-			kind = lbParamPass_Integer;
-		} else if (is_type_simd_vector(abi_type)) {
-			kind = lbParamPass_BitCast;
-		} else if (is_type_float(abi_type)) {
-			kind = lbParamPass_BitCast;
-		} else if (is_type_tuple(abi_type)) {
-			kind = lbParamPass_Tuple;
-		} else if (is_type_proc(abi_type)) {
-			kind = lbParamPass_Value;
-		} else {
-			GB_PANIC("Invalid abi type pass kind %s", type_to_string(abi_type));
-		}
-	}
-
-	if (kind_) *kind_ = kind;
-	lbValue res = {};
-	res.value = LLVMGetParam(p->value, cast(unsigned)index);
-	res.type = abi_type;
-	return res;
-}
+// gb_internal lbValue lb_value_param(lbProcedure *p, Entity *e, Type *abi_type, i32 index, lbParamPasskind *kind_) {
+// 	lbParamPasskind kind = lbParamPass_Value;
+
+// 	if (e != nullptr && !are_types_identical(abi_type, e->type)) {
+// 		if (is_type_pointer(abi_type)) {
+// 			GB_ASSERT(e->kind == Entity_Variable);
+// 			Type *av = core_type(type_deref(abi_type));
+// 			if (are_types_identical(av, core_type(e->type))) {
+// 				kind = lbParamPass_Pointer;
+// 				if (e->flags&EntityFlag_Value) {
+// 					kind = lbParamPass_ConstRef;
+// 				}
+// 			} else {
+// 				kind = lbParamPass_BitCast;
+// 			}
+// 		} else if (is_type_integer(abi_type)) {
+// 			kind = lbParamPass_Integer;
+// 		} else if (abi_type == t_llvm_bool) {
+// 			kind = lbParamPass_Value;
+// 		} else if (is_type_boolean(abi_type)) {
+// 			kind = lbParamPass_Integer;
+// 		} else if (is_type_simd_vector(abi_type)) {
+// 			kind = lbParamPass_BitCast;
+// 		} else if (is_type_float(abi_type)) {
+// 			kind = lbParamPass_BitCast;
+// 		} else if (is_type_tuple(abi_type)) {
+// 			kind = lbParamPass_Tuple;
+// 		} else if (is_type_proc(abi_type)) {
+// 			kind = lbParamPass_Value;
+// 		} else {
+// 			GB_PANIC("Invalid abi type pass kind %s", type_to_string(abi_type));
+// 		}
+// 	}
+
+// 	if (kind_) *kind_ = kind;
+// 	lbValue res = {};
+// 	res.value = LLVMGetParam(p->value, cast(unsigned)index);
+// 	res.type = abi_type;
+// 	return res;
+// }
 
 
 
 
 
 
@@ -1165,14 +1165,6 @@ gb_internal lbValue lb_emit_call(lbProcedure *p, lbValue value, Array<lbValue> c
 	return result;
 	return result;
 }
 }
 
 
-gb_internal LLVMValueRef llvm_splat_float(i64 count, LLVMTypeRef type, f64 value) {
-	LLVMValueRef v = LLVMConstReal(type, value);
-	LLVMValueRef *values = gb_alloc_array(temporary_allocator(), LLVMValueRef, count);
-	for (i64 i = 0; i < count; i++) {
-		values[i] = v;
-	}
-	return LLVMConstVector(values, cast(unsigned)count);
-}
 gb_internal LLVMValueRef llvm_splat_int(i64 count, LLVMTypeRef type, i64 value, bool is_signed=false) {
 gb_internal LLVMValueRef llvm_splat_int(i64 count, LLVMTypeRef type, i64 value, bool is_signed=false) {
 	LLVMValueRef v = LLVMConstInt(type, value, is_signed);
 	LLVMValueRef v = LLVMConstInt(type, value, is_signed);
 	LLVMValueRef *values = gb_alloc_array(temporary_allocator(), LLVMValueRef, count);
 	LLVMValueRef *values = gb_alloc_array(temporary_allocator(), LLVMValueRef, count);

+ 0 - 10
src/llvm_backend_stmt.cpp

@@ -378,16 +378,6 @@ gb_internal lbValue lb_map_cell_index_static(lbProcedure *p, Type *type, lbValue
 	return lb_emit_ptr_offset(p, elems_ptr, data_index);
 	return lb_emit_ptr_offset(p, elems_ptr, data_index);
 }
 }
 
 
-gb_internal void lb_map_kvh_data_static(lbProcedure *p, lbValue map_value, lbValue *ks_, lbValue *vs_, lbValue *hs_) {
-	lbValue capacity = lb_map_cap(p, map_value);
-	lbValue ks = lb_map_data_uintptr(p, map_value);
-	lbValue vs = {};
-	lbValue hs = {};
-	if (ks_) *ks_ = ks;
-	if (vs_) *vs_ = vs;
-	if (hs_) *hs_ = hs;
-}
-
 gb_internal lbValue lb_map_hash_is_valid(lbProcedure *p, lbValue hash) {
 gb_internal lbValue lb_map_hash_is_valid(lbProcedure *p, lbValue hash) {
 	// N :: size_of(uintptr)*8 - 1
 	// N :: size_of(uintptr)*8 - 1
 	// (hash != 0) & (hash>>N == 0)
 	// (hash != 0) & (hash>>N == 0)

+ 0 - 12
src/llvm_backend_utility.cpp

@@ -599,14 +599,6 @@ gb_internal lbValue lb_emit_reverse_bits(lbProcedure *p, lbValue x, Type *type)
 }
 }
 
 
 
 
-gb_internal lbValue lb_emit_bit_set_card(lbProcedure *p, lbValue x) {
-	GB_ASSERT(is_type_bit_set(x.type));
-	Type *underlying = bit_set_to_int(x.type);
-	lbValue card = lb_emit_count_ones(p, x, underlying);
-	return lb_emit_conv(p, card, t_int);
-}
-
-
 gb_internal lbValue lb_emit_union_cast_only_ok_check(lbProcedure *p, lbValue value, Type *type, TokenPos pos) {
 gb_internal lbValue lb_emit_union_cast_only_ok_check(lbProcedure *p, lbValue value, Type *type, TokenPos pos) {
 	GB_ASSERT(is_type_tuple(type));
 	GB_ASSERT(is_type_tuple(type));
 	lbModule *m = p->module;
 	lbModule *m = p->module;
@@ -1493,10 +1485,6 @@ gb_internal lbValue lb_dynamic_array_cap(lbProcedure *p, lbValue da) {
 	GB_ASSERT(is_type_dynamic_array(da.type));
 	GB_ASSERT(is_type_dynamic_array(da.type));
 	return lb_emit_struct_ev(p, da, 2);
 	return lb_emit_struct_ev(p, da, 2);
 }
 }
-gb_internal lbValue lb_dynamic_array_allocator(lbProcedure *p, lbValue da) {
-	GB_ASSERT(is_type_dynamic_array(da.type));
-	return lb_emit_struct_ev(p, da, 3);
-}
 
 
 gb_internal lbValue lb_map_len(lbProcedure *p, lbValue value) {
 gb_internal lbValue lb_map_len(lbProcedure *p, lbValue value) {
 	GB_ASSERT_MSG(is_type_map(value.type) || are_types_identical(value.type, t_raw_map), "%s", type_to_string(value.type));
 	GB_ASSERT_MSG(is_type_map(value.type) || are_types_identical(value.type, t_raw_map), "%s", type_to_string(value.type));

+ 9 - 68
src/main.cpp

@@ -3,7 +3,14 @@
 #include "common.cpp"
 #include "common.cpp"
 #include "timings.cpp"
 #include "timings.cpp"
 #include "tokenizer.cpp"
 #include "tokenizer.cpp"
+#if defined(GB_SYSTEM_WINDOWS)
+	#pragma warning(push)
+	#pragma warning(disable: 4505)
+#endif
 #include "big_int.cpp"
 #include "big_int.cpp"
+#if defined(GB_SYSTEM_WINDOWS)
+	#pragma warning(pop)
+#endif
 #include "exact_value.cpp"
 #include "exact_value.cpp"
 #include "build_settings.cpp"
 #include "build_settings.cpp"
 
 
@@ -58,7 +65,6 @@ gb_global Timings global_timings = {0};
 	#endif
 	#endif
 #endif
 #endif
 
 
-#include "query_data.cpp"
 #include "bug_report.cpp"
 #include "bug_report.cpp"
 
 
 // NOTE(bill): 'name' is used in debugging and profiling modes
 // NOTE(bill): 'name' is used in debugging and profiling modes
@@ -573,7 +579,6 @@ gb_internal void usage(String argv0) {
 	print_usage_line(1, "                  one must contain the program's entry point, all must be in the same package.");
 	print_usage_line(1, "                  one must contain the program's entry point, all must be in the same package.");
 	print_usage_line(1, "run               same as 'build', but also then runs the newly compiled executable.");
 	print_usage_line(1, "run               same as 'build', but also then runs the newly compiled executable.");
 	print_usage_line(1, "check             parse, and type check a directory of .odin files");
 	print_usage_line(1, "check             parse, and type check a directory of .odin files");
-	print_usage_line(1, "query             parse, type check, and output a .json file containing information about the program");
 	print_usage_line(1, "strip-semicolon   parse, type check, and remove unneeded semicolons from the entire program");
 	print_usage_line(1, "strip-semicolon   parse, type check, and remove unneeded semicolons from the entire program");
 	print_usage_line(1, "test              build and runs procedures with the attribute @(test) in the initial package");
 	print_usage_line(1, "test              build and runs procedures with the attribute @(test) in the initial package");
 	print_usage_line(1, "doc               generate documentation on a directory of .odin files");
 	print_usage_line(1, "doc               generate documentation on a directory of .odin files");
@@ -817,12 +822,6 @@ gb_internal bool parse_build_flags(Array<String> args) {
 
 
 	add_flag(&build_flags, BuildFlag_UseStaticMapCalls,       str_lit("use-static-map-calls"),      BuildFlagParam_None,    Command__does_check);
 	add_flag(&build_flags, BuildFlag_UseStaticMapCalls,       str_lit("use-static-map-calls"),      BuildFlagParam_None,    Command__does_check);
 
 
-
-	add_flag(&build_flags, BuildFlag_Compact,                 str_lit("compact"),                   BuildFlagParam_None,    Command_query);
-	add_flag(&build_flags, BuildFlag_GlobalDefinitions,       str_lit("global-definitions"),        BuildFlagParam_None,    Command_query);
-	add_flag(&build_flags, BuildFlag_GoToDefinitions,         str_lit("go-to-definitions"),         BuildFlagParam_None,    Command_query);
-
-
 	add_flag(&build_flags, BuildFlag_Short,                   str_lit("short"),                     BuildFlagParam_None,    Command_doc);
 	add_flag(&build_flags, BuildFlag_Short,                   str_lit("short"),                     BuildFlagParam_None,    Command_doc);
 	add_flag(&build_flags, BuildFlag_AllPackages,             str_lit("all-packages"),              BuildFlagParam_None,    Command_doc);
 	add_flag(&build_flags, BuildFlag_AllPackages,             str_lit("all-packages"),              BuildFlagParam_None,    Command_doc);
 	add_flag(&build_flags, BuildFlag_DocFormat,               str_lit("doc-format"),                BuildFlagParam_None,    Command_doc);
 	add_flag(&build_flags, BuildFlag_DocFormat,               str_lit("doc-format"),                BuildFlagParam_None,    Command_doc);
@@ -1445,39 +1444,6 @@ gb_internal bool parse_build_flags(Array<String> args) {
 							build_context.strict_style_init_only = true;
 							build_context.strict_style_init_only = true;
 							break;
 							break;
 						}
 						}
-						case BuildFlag_Compact: {
-							if (!build_context.query_data_set_settings.ok) {
-								gb_printf_err("Invalid use of -compact flag, only allowed with 'odin query'\n");
-								bad_flags = true;
-							} else {
-								build_context.query_data_set_settings.compact = true;
-							}
-							break;
-						}
-						case BuildFlag_GlobalDefinitions: {
-							if (!build_context.query_data_set_settings.ok) {
-								gb_printf_err("Invalid use of -global-definitions flag, only allowed with 'odin query'\n");
-								bad_flags = true;
-							} else if (build_context.query_data_set_settings.kind != QueryDataSet_Invalid) {
-								gb_printf_err("Invalid use of -global-definitions flag, a previous flag for 'odin query' was set\n");
-								bad_flags = true;
-							} else {
-								build_context.query_data_set_settings.kind = QueryDataSet_GlobalDefinitions;
-							}
-							break;
-						}
-						case BuildFlag_GoToDefinitions: {
-							if (!build_context.query_data_set_settings.ok) {
-								gb_printf_err("Invalid use of -go-to-definitions flag, only allowed with 'odin query'\n");
-								bad_flags = true;
-							} else if (build_context.query_data_set_settings.kind != QueryDataSet_Invalid) {
-								gb_printf_err("Invalid use of -global-definitions flag, a previous flag for 'odin query' was set\n");
-								bad_flags = true;
-							} else {
-								build_context.query_data_set_settings.kind = QueryDataSet_GoToDefinitions;
-							}
-							break;
-						}
 						case BuildFlag_Short:
 						case BuildFlag_Short:
 							build_context.cmd_doc_flags |= CmdDocFlag_Short;
 							build_context.cmd_doc_flags |= CmdDocFlag_Short;
 							break;
 							break;
@@ -1638,16 +1604,6 @@ gb_internal bool parse_build_flags(Array<String> args) {
 		gb_printf_err("`-export-timings:<format>` requires `-show-timings` or `-show-more-timings` to be present\n");
 		gb_printf_err("`-export-timings:<format>` requires `-show-timings` or `-show-more-timings` to be present\n");
 		bad_flags = true;
 		bad_flags = true;
 	}
 	}
-
-	if (build_context.query_data_set_settings.ok) {
-		if (build_context.query_data_set_settings.kind == QueryDataSet_Invalid) {
-			gb_printf_err("'odin query' requires a flag determining the kind of query data set to be returned\n");
-			gb_printf_err("\t-global-definitions : outputs a JSON file of global definitions\n");
-			gb_printf_err("\t-go-to-definitions  : outputs a OGTD binary file of go to definitions for identifiers within an Odin project\n");
-			bad_flags = true;
-		}
-	}
-
 	return !bad_flags;
 	return !bad_flags;
 }
 }
 
 
@@ -1931,8 +1887,6 @@ gb_internal void print_show_help(String const arg0, String const &command) {
 		print_usage_line(3, "odin check filename.odin -file  # Type check single-file package, must contain entry point.");
 		print_usage_line(3, "odin check filename.odin -file  # Type check single-file package, must contain entry point.");
 	} else if (command == "test") {
 	} else if (command == "test") {
 		print_usage_line(1, "test      Build ands runs procedures with the attribute @(test) in the initial package");
 		print_usage_line(1, "test      Build ands runs procedures with the attribute @(test) in the initial package");
-	} else if (command == "query") {
-		print_usage_line(1, "query     [experimental] Parse, type check, and output a .json file containing information about the program");
 	} else if (command == "doc") {
 	} else if (command == "doc") {
 		print_usage_line(1, "doc       generate documentation from a directory of .odin files");
 		print_usage_line(1, "doc       generate documentation from a directory of .odin files");
 		print_usage_line(2, "Examples:");
 		print_usage_line(2, "Examples:");
@@ -2627,15 +2581,6 @@ int main(int arg_count, char const **arg_ptr) {
 		build_context.command_kind = Command_strip_semicolon;
 		build_context.command_kind = Command_strip_semicolon;
 		build_context.no_output_files = true;
 		build_context.no_output_files = true;
 		init_filename = args[2];
 		init_filename = args[2];
-	} else if (command == "query") {
-		if (args.count < 3) {
-			usage(args[0]);
-			return 1;
-		}
-		build_context.command_kind = Command_query;
-		build_context.no_output_files = true;
-		build_context.query_data_set_settings.ok = true;
-		init_filename = args[2];
 	} else if (command == "doc") {
 	} else if (command == "doc") {
 		if (args.count < 3) {
 		if (args.count < 3) {
 			usage(args[0]);
 			usage(args[0]);
@@ -2824,12 +2769,8 @@ int main(int arg_count, char const **arg_ptr) {
 			print_show_unused(checker);
 			print_show_unused(checker);
 		}
 		}
 
 
-		if (build_context.query_data_set_settings.ok) {
-			generate_and_print_query_data(checker, &global_timings);
-		} else {
-			if (build_context.show_timings) {
-				show_timings(checker, &global_timings);
-			}
+		if (build_context.show_timings) {
+			show_timings(checker, &global_timings);
 		}
 		}
 
 
 		if (global_error_collector.count != 0) {
 		if (global_error_collector.count != 0) {

+ 0 - 36
src/parser.cpp

@@ -237,9 +237,6 @@ gb_internal Ast *clone_ast(Ast *node) {
 	case Ast_ExprStmt:
 	case Ast_ExprStmt:
 		n->ExprStmt.expr = clone_ast(n->ExprStmt.expr);
 		n->ExprStmt.expr = clone_ast(n->ExprStmt.expr);
 		break;
 		break;
-	case Ast_TagStmt:
-		n->TagStmt.stmt = clone_ast(n->TagStmt.stmt);
-		break;
 	case Ast_AssignStmt:
 	case Ast_AssignStmt:
 		n->AssignStmt.lhs = clone_ast_array(n->AssignStmt.lhs);
 		n->AssignStmt.lhs = clone_ast_array(n->AssignStmt.lhs);
 		n->AssignStmt.rhs = clone_ast_array(n->AssignStmt.rhs);
 		n->AssignStmt.rhs = clone_ast_array(n->AssignStmt.rhs);
@@ -497,14 +494,6 @@ gb_internal Ast *ast_tag_expr(AstFile *f, Token token, Token name, Ast *expr) {
 	return result;
 	return result;
 }
 }
 
 
-gb_internal Ast *ast_tag_stmt(AstFile *f, Token token, Token name, Ast *stmt) {
-	Ast *result = alloc_ast_node(f, Ast_TagStmt);
-	result->TagStmt.token = token;
-	result->TagStmt.name = name;
-	result->TagStmt.stmt = stmt;
-	return result;
-}
-
 gb_internal Ast *ast_unary_expr(AstFile *f, Token op, Ast *expr) {
 gb_internal Ast *ast_unary_expr(AstFile *f, Token op, Ast *expr) {
 	Ast *result = alloc_ast_node(f, Ast_UnaryExpr);
 	Ast *result = alloc_ast_node(f, Ast_UnaryExpr);
 	result->UnaryExpr.op = op;
 	result->UnaryExpr.op = op;
@@ -1308,16 +1297,6 @@ gb_internal Token advance_token(AstFile *f) {
 	return prev;
 	return prev;
 }
 }
 
 
-gb_internal bool peek_token_kind(AstFile *f, TokenKind kind) {
-	for (isize i = f->curr_token_index+1; i < f->tokens.count; i++) {
-		Token tok = f->tokens[i];
-		if (kind != Token_Comment && tok.kind == Token_Comment) {
-			continue;
-		}
-		return tok.kind == kind;
-	}
-	return false;
-}
 
 
 gb_internal Token peek_token(AstFile *f) {
 gb_internal Token peek_token(AstFile *f) {
 	for (isize i = f->curr_token_index+1; i < f->tokens.count; i++) {
 	for (isize i = f->curr_token_index+1; i < f->tokens.count; i++) {
@@ -1440,17 +1419,6 @@ gb_internal Token expect_operator(AstFile *f) {
 	return prev;
 	return prev;
 }
 }
 
 
-gb_internal Token expect_keyword(AstFile *f) {
-	Token prev = f->curr_token;
-	if (!gb_is_between(prev.kind, Token__KeywordBegin+1, Token__KeywordEnd-1)) {
-		String p = token_to_string(prev);
-		syntax_error(f->curr_token, "Expected a keyword, got '%.*s'",
-		             LIT(p));
-	}
-	advance_token(f);
-	return prev;
-}
-
 gb_internal bool allow_token(AstFile *f, TokenKind kind) {
 gb_internal bool allow_token(AstFile *f, TokenKind kind) {
 	Token prev = f->curr_token;
 	Token prev = f->curr_token;
 	if (prev.kind == kind) {
 	if (prev.kind == kind) {
@@ -1957,10 +1925,6 @@ gb_internal bool ast_on_same_line(Token const &x, Ast *yp) {
 	return x.pos.line == y.pos.line;
 	return x.pos.line == y.pos.line;
 }
 }
 
 
-gb_internal bool ast_on_same_line(Ast *x, Ast *y) {
-	return ast_on_same_line(ast_token(x), y);
-}
-
 gb_internal Ast *parse_force_inlining_operand(AstFile *f, Token token) {
 gb_internal Ast *parse_force_inlining_operand(AstFile *f, Token token) {
 	Ast *expr = parse_unary_expr(f, false);
 	Ast *expr = parse_unary_expr(f, false);
 	Ast *e = strip_or_return_expr(expr);
 	Ast *e = strip_or_return_expr(expr);

+ 0 - 5
src/parser.hpp

@@ -457,11 +457,6 @@ AST_KIND(_StmtBegin,     "", bool) \
 	AST_KIND(BadStmt,    "bad statement",                 struct { Token begin, end; }) \
 	AST_KIND(BadStmt,    "bad statement",                 struct { Token begin, end; }) \
 	AST_KIND(EmptyStmt,  "empty statement",               struct { Token token; }) \
 	AST_KIND(EmptyStmt,  "empty statement",               struct { Token token; }) \
 	AST_KIND(ExprStmt,   "expression statement",          struct { Ast *expr; } ) \
 	AST_KIND(ExprStmt,   "expression statement",          struct { Ast *expr; } ) \
-	AST_KIND(TagStmt,    "tag statement", struct { \
-		Token token; \
-		Token name; \
-		Ast * stmt; \
-	}) \
 	AST_KIND(AssignStmt, "assign statement", struct { \
 	AST_KIND(AssignStmt, "assign statement", struct { \
 		Token op; \
 		Token op; \
 		Slice<Ast *> lhs, rhs; \
 		Slice<Ast *> lhs, rhs; \

+ 0 - 2
src/parser_pos.cpp

@@ -53,7 +53,6 @@ gb_internal Token ast_token(Ast *node) {
 	case Ast_BadStmt:            return node->BadStmt.begin;
 	case Ast_BadStmt:            return node->BadStmt.begin;
 	case Ast_EmptyStmt:          return node->EmptyStmt.token;
 	case Ast_EmptyStmt:          return node->EmptyStmt.token;
 	case Ast_ExprStmt:           return ast_token(node->ExprStmt.expr);
 	case Ast_ExprStmt:           return ast_token(node->ExprStmt.expr);
-	case Ast_TagStmt:            return node->TagStmt.token;
 	case Ast_AssignStmt:         return node->AssignStmt.op;
 	case Ast_AssignStmt:         return node->AssignStmt.op;
 	case Ast_BlockStmt:          return node->BlockStmt.open;
 	case Ast_BlockStmt:          return node->BlockStmt.open;
 	case Ast_IfStmt:             return node->IfStmt.token;
 	case Ast_IfStmt:             return node->IfStmt.token;
@@ -197,7 +196,6 @@ Token ast_end_token(Ast *node) {
 	case Ast_BadStmt:            return node->BadStmt.end;
 	case Ast_BadStmt:            return node->BadStmt.end;
 	case Ast_EmptyStmt:          return node->EmptyStmt.token;
 	case Ast_EmptyStmt:          return node->EmptyStmt.token;
 	case Ast_ExprStmt:           return ast_end_token(node->ExprStmt.expr);
 	case Ast_ExprStmt:           return ast_end_token(node->ExprStmt.expr);
-	case Ast_TagStmt:            return ast_end_token(node->TagStmt.stmt);
 	case Ast_AssignStmt:
 	case Ast_AssignStmt:
 		if (node->AssignStmt.rhs.count > 0) {
 		if (node->AssignStmt.rhs.count > 0) {
 			return ast_end_token(node->AssignStmt.rhs[node->AssignStmt.rhs.count-1]);
 			return ast_end_token(node->AssignStmt.rhs[node->AssignStmt.rhs.count-1]);

+ 0 - 1030
src/query_data.cpp

@@ -1,1030 +0,0 @@
-struct QueryValue;
-struct QueryValuePair;
-
-gb_global gbAllocator query_value_allocator = {};
-
-enum QueryKind {
-	Query_Invalid,
-	Query_String,
-	Query_Boolean,
-	Query_Integer,
-	Query_Float,
-	Query_Array,
-	Query_Map,
-};
-
-struct QueryValuePair {
-	String key;
-	QueryValue *value;
-};
-
-
-struct QueryValue {
-	QueryKind kind;
-	bool packed;
-};
-
-struct QueryValueString : QueryValue {
-	QueryValueString(String const &v) {
-		kind = Query_String;
-		value = v;
-		packed = false;
-	}
-	String value;
-};
-
-struct QueryValueBoolean : QueryValue {
-	QueryValueBoolean(bool v) {
-		kind = Query_Boolean;
-		value = v;
-		packed = false;
-	}
-	bool value;
-};
-
-struct QueryValueInteger : QueryValue {
-	QueryValueInteger(i64 v) {
-		kind = Query_Integer;
-		value = v;
-		packed = false;
-	}
-	i64 value;
-};
-
-struct QueryValueFloat : QueryValue {
-	QueryValueFloat(f64 v) {
-		kind = Query_Float;
-		value = v;
-		packed = false;
-	}
-	f64 value;
-};
-
-struct QueryValueArray : QueryValue {
-	QueryValueArray() {
-		kind = Query_Array;
-		array_init(&value, query_value_allocator);
-		packed = false;
-	}
-	QueryValueArray(Array<QueryValue *> const &v) {
-		kind = Query_Array;
-		value = v;
-		packed = false;
-	}
-	Array<QueryValue *> value;
-
-	void reserve(isize cap) {
-		array_reserve(&value, cap);
-	}
-	void add(QueryValue *v) {
-		array_add(&value, v);
-	}
-	void add(char const *v) {
-		add(make_string_c(cast(char *)v));
-	}
-	void add(String const &v) {
-		auto val = gb_alloc_item(query_value_allocator, QueryValueString);
-		*val = QueryValueString(v);
-		add(val);
-	}
-	void add(bool v) {
-		auto val = gb_alloc_item(query_value_allocator, QueryValueBoolean);
-		*val = QueryValueBoolean(v);
-		add(val);
-	}
-	void add(i64 v) {
-		auto val = gb_alloc_item(query_value_allocator, QueryValueInteger);
-		*val = QueryValueInteger(v);
-		add(val);
-	}
-	void add(f64 v) {
-		auto val = gb_alloc_item(query_value_allocator, QueryValueFloat);
-		*val = QueryValueFloat(v);
-		add(val);
-	}
-};
-
-struct QueryValueMap : QueryValue {
-	QueryValueMap() {
-		kind = Query_Map;
-		array_init(&value, query_value_allocator);
-		packed = false;
-	}
-	QueryValueMap(Array<QueryValuePair> const &v) {
-		kind = Query_Map;
-		value = v;
-		packed = false;
-	}
-	Array<QueryValuePair> value;
-
-
-	void reserve(isize cap) {
-		array_reserve(&value, cap);
-	}
-	void add(char const *k, QueryValue *v) {
-		add(make_string_c(cast(char *)k), v);
-	}
-	void add(String const &k, QueryValue *v) {
-		QueryValuePair kv = {k, v};
-		array_add(&value, kv);
-	}
-
-	void add(char const *k, String const &v) {
-		auto val = gb_alloc_item(query_value_allocator, QueryValueString);
-		*val = QueryValueString(v);
-		add(k, val);
-	}
-	void add(char const *k, char const *v) {
-		add(k, make_string_c(cast(char *)v));
-	}
-	void add(char const *k, bool v) {
-		auto val = gb_alloc_item(query_value_allocator, QueryValueBoolean);
-		*val = QueryValueBoolean(v);
-		add(k, val);
-	}
-	void add(char const *k, i64 v) {
-		auto val = gb_alloc_item(query_value_allocator, QueryValueInteger);
-		*val = QueryValueInteger(v);
-		add(k, val);
-	}
-	void add(char const *k, f64 v) {
-		auto val = gb_alloc_item(query_value_allocator, QueryValueFloat);
-		*val = QueryValueFloat(v);
-		add(k, val);
-	}
-	void add(String const &k, String const &v) {
-		auto val = gb_alloc_item(query_value_allocator, QueryValueString);
-		*val = QueryValueString(v);
-		add(k, val);
-	}
-	void add(String const &k, char const *v) {
-		add(k, make_string_c(cast(char *)v));
-	}
-	void add(String const &k, bool v) {
-		auto val = gb_alloc_item(query_value_allocator, QueryValueBoolean);
-		*val = QueryValueBoolean(v);
-		add(k, val);
-	}
-	void add(String const &k, i64 v) {
-		auto val = gb_alloc_item(query_value_allocator, QueryValueInteger);
-		*val = QueryValueInteger(v);
-		add(k, val);
-	}
-	void add(String const &k, f64 v) {
-		auto val = gb_alloc_item(query_value_allocator, QueryValueFloat);
-		*val = QueryValueFloat(v);
-		add(k, val);
-	}
-};
-
-
-#define DEF_QUERY_PROC(TYPE, VALUETYPE, NAME) TYPE *NAME(VALUETYPE value) { \
-	auto v = gb_alloc_item(query_value_allocator, TYPE); \
-	*v = TYPE(value); \
-	return v; \
-}
-#define DEF_QUERY_PROC0(TYPE, NAME) TYPE *NAME() { \
-	auto v = gb_alloc_item(query_value_allocator, TYPE); \
-	*v = TYPE(); \
-	return v; \
-}
-
-gb_internal DEF_QUERY_PROC(QueryValueString,  String const &,                query_value_string);
-gb_internal DEF_QUERY_PROC(QueryValueBoolean, bool,                          query_value_boolean);
-gb_internal DEF_QUERY_PROC(QueryValueInteger, i64,                           query_value_integer);
-gb_internal DEF_QUERY_PROC(QueryValueFloat,   f64,                           query_value_float);
-gb_internal DEF_QUERY_PROC(QueryValueArray,   Array<QueryValue *> const &,   query_value_array);
-gb_internal DEF_QUERY_PROC(QueryValueMap,     Array<QueryValuePair> const &, query_value_map);
-gb_internal DEF_QUERY_PROC0(QueryValueArray,  query_value_array);
-gb_internal DEF_QUERY_PROC0(QueryValueMap,    query_value_map);
-
-gb_internal isize qprintf(bool format, isize indent, char const *fmt, ...) {
-	if (format) while (indent --> 0) {
-		gb_printf("\t");
-	}
-	va_list va;
-	va_start(va, fmt);
-	isize res = gb_printf_va(fmt, va);
-	va_end(va);
-	return res;
-}
-
-gb_internal bool qv_valid_char(u8 c) {
-	if (c >= 0x80) {
-		return false;
-	}
-
-	switch (c) {
-	case '\"':
-	case '\n':
-	case '\r':
-	case '\t':
-	case '\v':
-	case '\f':
-		return false;
-	}
-
-	return true;
-}
-
-gb_internal void print_query_data_as_json(QueryValue *value, bool format = true, isize indent = 0) {
-	if (value == nullptr) {
-		gb_printf("null");
-		return;
-	}
-	switch (value->kind) {
-	case Query_String: {
-		auto v = cast(QueryValueString *)value;
-		String name = v->value;
-		isize extra = 0;
-		for (isize i = 0; i < name.len; i++) {
-			u8 c = name[i];
-			if (!qv_valid_char(c)) {
-				extra += 5;
-			}
-		}
-
-		if (extra == 0) {
-			gb_printf("\"%.*s\"", LIT(name));
-			return;
-		}
-
-		char const hex_table[] = "0123456789ABCDEF";
-		isize buf_len = name.len + extra + 2 + 1;
-
-		u8 *buf = gb_alloc_array(temporary_allocator(), u8, buf_len);
-
-		isize j = 0;
-
-		for (isize i = 0; i < name.len; i++) {
-			u8 c = name[i];
-			if (qv_valid_char(c)) {
-				buf[j+0] = c;
-				j += 1;
-			} else if (c == '"') {
-				buf[j+0] = '\\';
-				buf[j+1] = '\"';
-				j += 2;
-			} else {
-				switch (c) {
-				case '\n': buf[j+0] = '\\'; buf[j+1] = 'n'; j += 2; break;
-				case '\r': buf[j+0] = '\\'; buf[j+1] = 'r'; j += 2; break;
-				case '\t': buf[j+0] = '\\'; buf[j+1] = 't'; j += 2; break;
-				case '\v': buf[j+0] = '\\'; buf[j+1] = 'v'; j += 2; break;
-				case '\f':
-				default:
-					buf[j+0] = '\\';
-					buf[j+1] = hex_table[0];
-					buf[j+2] = hex_table[0];
-					buf[j+3] = hex_table[c >> 4];
-					buf[j+4] = hex_table[c & 0x0f];
-					j += 5;
-					break;
-				}
-			}
-		}
-
-		gb_printf("\"%s\"", buf);
-		return;
-	}
-	case Query_Boolean: {
-		auto v = cast(QueryValueBoolean *)value;
-		if (v->value) {
-			gb_printf("true");
-		} else {
-			gb_printf("false");
-		}
-		return;
-	}
-	case Query_Integer: {
-		auto v = cast(QueryValueInteger *)value;
-		gb_printf("%lld", cast(long long)v->value);
-		return;
-	}
-	case Query_Float: {
-		auto v = cast(QueryValueFloat *)value;
-		gb_printf("%f", v->value);
-		return;
-	}
-	case Query_Array: {
-		auto v = cast(QueryValueArray *)value;
-		if (v->value.count > 0) {
-			bool ff = format && !v->packed;
-			gb_printf("[");
-			if (ff) gb_printf("\n");
-			for_array(i, v->value) {
-				qprintf(ff, indent+1, "");
-				print_query_data_as_json(v->value[i], ff, indent+1);
-				if (i < v->value.count-1) {
-					gb_printf(",");
-					if (!ff && format) {
-						gb_printf(" ");
-					}
-				}
-				if (ff) gb_printf("\n");
-			}
-			qprintf(ff, indent, "]");
-		} else {
-			gb_printf("[]");
-		}
-		return;
-	}
-	case Query_Map: {
-		auto v = cast(QueryValueMap *)value;
-		if (v->value.count > 0) {
-			bool ff = format && !v->packed;
-			gb_printf("{");
-			if (ff) gb_printf("\n");
-			for_array(i, v->value) {
-				auto kv = v->value[i];
-				qprintf(ff, indent+1, "\"%.*s\":", LIT(kv.key));
-				if (format) gb_printf(" ");
-				print_query_data_as_json(kv.value, ff, indent+1);
-				if (i < v->value.count-1) {
-					gb_printf(",");
-					if (!ff && format) {
-						gb_printf(" ");
-					}
-				}
-				if (ff) gb_printf("\n");
-			}
-			qprintf(ff, indent, "}");
-		} else {
-			gb_printf("{}");
-		}
-		return;
-	}
-	}
-}
-
-
-
-gb_internal int query_data_package_compare(void const *a, void const *b) {
-	AstPackage *x = *cast(AstPackage *const *)a;
-	AstPackage *y = *cast(AstPackage *const *)b;
-
-	if (x == y) {
-		return 0;
-	}
-
-	if (x != nullptr && y != nullptr) {
-		return string_compare(x->name, y->name);
-	} else if (x != nullptr && y == nullptr) {
-		return -1;
-	} else if (x == nullptr && y != nullptr) {
-		return +1;
-	}
-	return 0;
-}
-
-gb_internal int query_data_definition_compare(void const *a, void const *b) {
-	Entity *x = *cast(Entity *const *)a;
-	Entity *y = *cast(Entity *const *)b;
-
-	if (x == y) {
-		return 0;
-	} else if (x != nullptr && y == nullptr) {
-		return -1;
-	} else if (x == nullptr && y != nullptr) {
-		return +1;
-	}
-
-	if (x->pkg != y->pkg) {
-		i32 res = query_data_package_compare(&x->pkg, &y->pkg);
-		if (res != 0) {
-			return res;
-		}
-	}
-
-	return string_compare(x->token.string, y->token.string);
-}
-
-gb_internal int entity_name_compare(void const *a, void const *b) {
-	Entity *x = *cast(Entity *const *)a;
-	Entity *y = *cast(Entity *const *)b;
-	if (x == y) {
-		return 0;
-	} else if (x != nullptr && y == nullptr) {
-		return -1;
-	} else if (x == nullptr && y != nullptr) {
-		return +1;
-	}
-	return string_compare(x->token.string, y->token.string);
-}
-
-
-gb_internal void generate_and_print_query_data_global_definitions(Checker *c, Timings *timings);
-gb_internal void generate_and_print_query_data_go_to_definitions(Checker *c);
-
-gb_internal void generate_and_print_query_data(Checker *c, Timings *timings) {
-	query_value_allocator = heap_allocator();
-	switch (build_context.query_data_set_settings.kind) {
-	case QueryDataSet_GlobalDefinitions:
-		generate_and_print_query_data_global_definitions(c, timings);
-		return;
-	case QueryDataSet_GoToDefinitions:
-		generate_and_print_query_data_go_to_definitions(c);
-		return;
-	}
-}
-
-
-gb_internal void generate_and_print_query_data_global_definitions(Checker *c, Timings *timings) {
-	auto *root = query_value_map();
-
-	if (global_error_collector.errors.count > 0) {
-		auto *errors = query_value_array();
-		root->add("errors", errors);
-		for_array(i, global_error_collector.errors) {
-			String err = string_trim_whitespace(global_error_collector.errors[i]);
-			errors->add(err);
-		}
-
-	}
-
-	{ // Packages
-		auto *packages = query_value_array();
-		root->add("packages", packages);
-
-		auto sorted_packages = array_make<AstPackage *>(query_value_allocator, 0, c->info.packages.entries.count);
-		defer (array_free(&sorted_packages));
-
-		for (auto const &entry : c->info.packages) {
-			AstPackage *pkg = entry.value;
-			if (pkg != nullptr) {
-				array_add(&sorted_packages, pkg);
-			}
-		}
-		gb_sort_array(sorted_packages.data, sorted_packages.count, query_data_package_compare);
-		packages->reserve(sorted_packages.count);
-
-		for_array(i, sorted_packages) {
-			AstPackage *pkg = sorted_packages[i];
-			String name = pkg->name;
-			String fullpath = pkg->fullpath;
-
-			auto *files = query_value_array();
-			files->reserve(pkg->files.count);
-			for_array(j, pkg->files) {
-				AstFile *f = pkg->files[j];
-				files->add(f->fullpath);
-			}
-
-			auto *package = query_value_map();
-			package->reserve(3);
-			packages->add(package);
-
-			package->add("name", pkg->name);
-			package->add("fullpath", pkg->fullpath);
-			package->add("files", files);
-		}
-	}
-
-	if (c->info.definitions.count > 0) {
-		auto *definitions = query_value_array();
-		root->add("definitions", definitions);
-
-		auto sorted_definitions = array_make<Entity *>(query_value_allocator, 0, c->info.definitions.count);
-		defer (array_free(&sorted_definitions));
-
-		for_array(i, c->info.definitions) {
-			Entity *e = c->info.definitions[i];
-			String name = e->token.string;
-			if (is_blank_ident(name)) {
-				continue;
-			}
-			if ((e->scope->flags & (ScopeFlag_Pkg|ScopeFlag_File)) == 0) {
-				continue;
-			}
-			if (e->parent_proc_decl != nullptr) {
-				continue;
-			}
-			switch (e->kind) {
-			case Entity_Builtin:
-			case Entity_Nil:
-			case Entity_Label:
-				continue;
-			}
-			if (e->pkg == nullptr) {
-				continue;
-			}
-			if (e->token.pos.line == 0) {
-				continue;
-			}
-			if (e->kind == Entity_Procedure) {
-				Type *t = base_type(e->type);
-				if (t->kind != Type_Proc) {
-					continue;
-				}
-				if (t->Proc.is_poly_specialized) {
-					continue;
-				}
-			}
-			if (e->kind == Entity_TypeName) {
-				Type *t = base_type(e->type);
-				if (t->kind == Type_Struct) {
-					if (t->Struct.is_poly_specialized) {
-						continue;
-					}
-				}
-				if (t->kind == Type_Union) {
-					if (t->Union.is_poly_specialized) {
-						continue;
-					}
-				}
-			}
-
-			array_add(&sorted_definitions, e);
-		}
-
-		gb_sort_array(sorted_definitions.data, sorted_definitions.count, query_data_definition_compare);
-		definitions->reserve(sorted_definitions.count);
-
-		for_array(i, sorted_definitions) {
-			Entity *e = sorted_definitions[i];
-			String name = e->token.string;
-
-			auto *def = query_value_map();
-			def->reserve(16);
-			definitions->add(def);
-
-			def->add("package",     e->pkg->name);
-			def->add("name",        name);
-			def->add("filepath",    get_file_path_string(e->token.pos.file_id));
-			def->add("line",        cast(i64)e->token.pos.line);
-			def->add("column",      cast(i64)e->token.pos.column);
-			def->add("file_offset", cast(i64)e->token.pos.offset);
-
-			switch (e->kind) {
-			case Entity_Constant:    def->add("kind", str_lit("constant"));        break;
-			case Entity_Variable:    def->add("kind", str_lit("variable"));        break;
-			case Entity_TypeName:    def->add("kind", str_lit("type name"));       break;
-			case Entity_Procedure:   def->add("kind", str_lit("procedure"));       break;
-			case Entity_ProcGroup:   def->add("kind", str_lit("procedure group")); break;
-			case Entity_ImportName:  def->add("kind", str_lit("import name"));     break;
-			case Entity_LibraryName: def->add("kind", str_lit("library name"));    break;
-			default: GB_PANIC("Invalid entity kind to be added");
-			}
-
-
-			if (e->type != nullptr && e->type != t_invalid) {
-				Type *t = e->type;
-				Type *bt = t;
-
-				switch (e->kind) {
-				case Entity_TypeName:
-					if (!e->TypeName.is_type_alias) {
-						bt = base_type(t);
-					}
-					break;
-				}
-
-				{
-					gbString str = type_to_string(t);
-					String type_str = make_string(cast(u8 *)str, gb_string_length(str));
-					def->add("type", type_str);
-				}
-				if (t != bt) {
-					gbString str = type_to_string(bt);
-					String type_str = make_string(cast(u8 *)str, gb_string_length(str));
-					def->add("base_type", type_str);
-				}
-				{
-					String type_kind = {};
-					Type *bt = base_type(t);
-					switch (bt->kind) {
-					case Type_Pointer:      type_kind = str_lit("pointer");       break;
-					case Type_Array:        type_kind = str_lit("array");         break;
-					case Type_Slice:        type_kind = str_lit("slice");         break;
-					case Type_DynamicArray: type_kind = str_lit("dynamic array"); break;
-					case Type_Map:          type_kind = str_lit("map");           break;
-					case Type_Struct:       type_kind = str_lit("struct");        break;
-					case Type_Union:        type_kind = str_lit("union");         break;
-					case Type_Enum:         type_kind = str_lit("enum");          break;
-					case Type_Proc:         type_kind = str_lit("procedure");     break;
-					case Type_BitSet:       type_kind = str_lit("bit set");       break;
-					case Type_SimdVector:   type_kind = str_lit("simd vector");   break;
-
-					case Type_Generic:
-					case Type_Tuple:
-						GB_PANIC("Invalid definition type");
-						break;
-					}
-					if (type_kind.len > 0) {
-						def->add("type_kind", type_kind);
-					}
-				}
-			}
-
-			if (e->kind == Entity_TypeName) {
-				def->add("size",  type_size_of(e->type));
-				def->add("align", type_align_of(e->type));
-
-
-				if (is_type_struct(e->type)) {
-					auto *data = query_value_map();
-					data->reserve(6);
-
-					def->add("data", data);
-
-					Type *t = base_type(e->type);
-					GB_ASSERT(t->kind == Type_Struct);
-
-					if (t->Struct.is_polymorphic) {
-						data->add("polymorphic", cast(bool)t->Struct.is_polymorphic);
-					}
-					if (t->Struct.is_poly_specialized) {
-						data->add("polymorphic_specialized", cast(bool)t->Struct.is_poly_specialized);
-					}
-					if (t->Struct.is_packed) {
-						data->add("packed", cast(bool)t->Struct.is_packed);
-					}
-					if (t->Struct.is_raw_union) {
-						data->add("raw_union", cast(bool)t->Struct.is_raw_union);
-					}
-
-					auto *fields = query_value_array();
-					data->add("fields", fields);
-					fields->reserve(t->Struct.fields.count);
-					fields->packed = true;
-
-					for_array(j, t->Struct.fields) {
-						Entity *e = t->Struct.fields[j];
-						String name = e->token.string;
-						if (is_blank_ident(name)) {
-							continue;
-						}
-
-						fields->add(name);
-					}
-				} else if (is_type_union(e->type)) {
-					auto *data = query_value_map();
-					data->reserve(4);
-
-					def->add("data", data);
-					Type *t = base_type(e->type);
-					GB_ASSERT(t->kind == Type_Union);
-
-					if (t->Union.is_polymorphic) {
-						data->add("polymorphic", cast(bool)t->Union.is_polymorphic);
-					}
-					if (t->Union.is_poly_specialized) {
-						data->add("polymorphic_specialized", cast(bool)t->Union.is_poly_specialized);
-					}
-
-					auto *variants = query_value_array();
-					variants->reserve(t->Union.variants.count);
-					data->add("variants", variants);
-
-					for_array(j, t->Union.variants) {
-						Type *vt = t->Union.variants[j];
-
-						gbString str = type_to_string(vt);
-						String type_str = make_string(cast(u8 *)str, gb_string_length(str));
-						variants->add(type_str);
-					}
-				}
-			}
-
-			if (e->kind == Entity_Procedure) {
-				Type *t = base_type(e->type);
-				GB_ASSERT(t->kind == Type_Proc);
-
-				bool is_polymorphic = t->Proc.is_polymorphic;
-				bool is_poly_specialized = t->Proc.is_poly_specialized;
-				bool ok = is_polymorphic || is_poly_specialized;
-				if (ok) {
-					auto *data = query_value_map();
-					data->reserve(4);
-
-					def->add("data", data);
-					if (is_polymorphic) {
-						data->add("polymorphic", cast(bool)is_polymorphic);
-					}
-					if (is_poly_specialized) {
-						data->add("polymorphic_specialized", cast(bool)is_poly_specialized);
-					}
-				}
-			}
-
-			if (e->kind == Entity_ProcGroup) {
-				auto *procedures = query_value_array();
-				procedures->reserve(e->ProcGroup.entities.count);
-
-				for_array(j, e->ProcGroup.entities) {
-					Entity *p = e->ProcGroup.entities[j];
-
-					auto *procedure = query_value_map();
-					procedure->reserve(2);
-					procedure->packed = true;
-
-					procedures->add(procedure);
-
-					procedure->add("package", p->pkg->name);
-					procedure->add("name",    p->token.string);
-				}
-				def->add("procedures", procedures);
-			}
-
-			DeclInfo *di = e->decl_info;
-			if (di != nullptr) {
-				if (di->is_using) {
-					def->add("using", query_value_boolean(true));
-				}
-			}
-		}
-	}
-
-	if (build_context.show_timings) {
-		Timings *t = timings;
-		timings__stop_current_section(t);
-		t->total.finish = time_stamp_time_now();
-		isize max_len = gb_min(36, t->total.label.len);
-		for_array(i, t->sections) {
-			TimeStamp ts = t->sections[i];
-			max_len = gb_max(max_len, ts.label.len);
-		}
-		t->total_time_seconds = time_stamp_as_s(t->total, t->freq);
-
-		auto *tims = query_value_map();
-		tims->reserve(8);
-		root->add("timings", tims);
-		tims->add("time_unit", str_lit("s"));
-
-		tims->add(t->total.label, cast(f64)t->total_time_seconds);
-
-
-		Parser *p = c->parser;
-		if (p != nullptr) {
-			isize lines    = p->total_line_count;
-			isize tokens   = p->total_token_count;
-			isize files    = 0;
-			isize packages = p->packages.count;
-			isize total_file_size = 0;
-			for_array(i, p->packages) {
-				files += p->packages[i]->files.count;
-				for_array(j, p->packages[i]->files) {
-					AstFile *file = p->packages[i]->files[j];
-					total_file_size += file->tokenizer.end - file->tokenizer.start;
-				}
-			}
-
-			tims->add("total_lines",     cast(i64)lines);
-			tims->add("total_tokens",    cast(i64)tokens);
-			tims->add("total_files",     cast(i64)files);
-			tims->add("total_packages",  cast(i64)packages);
-			tims->add("total_file_size", cast(i64)total_file_size);
-
-			auto *sections = query_value_map();
-			sections->reserve(t->sections.count);
-			tims->add("sections", sections);
-			for_array(i, t->sections) {
-				TimeStamp ts = t->sections[i];
-				f64 section_time = time_stamp_as_s(ts, t->freq);
-
-				auto *section = query_value_map();
-				section->reserve(2);
-				sections->add(ts.label, section);
-				section->add("time", cast(f64)section_time);
-				section->add("total_fraction", cast(f64)(section_time/t->total_time_seconds));
-			}
-		}
-	}
-
-
-	print_query_data_as_json(root, !build_context.query_data_set_settings.compact);
-	gb_printf("\n");
-}
-
-
-
-template <typename T>
-struct BinaryArray {
-	u32 offset; // Offset in bytes from the top of the file
-	u32 length; // Number of elements in array of type T
-};
-
-template <typename T>
-gb_internal Array<T> binary_array_from_data(BinaryArray<T> ba, void *data) {
-	Array<T> res = {};
-	res.data     = cast(T *)(cast(u8 *)data + ba.offset);
-	res.count    = ba.length;
-	res.capacity = ba.length;
-	return res;
-}
-
-typedef BinaryArray<u8> BinaryString;
-
-struct GoToDefIdent {
-	u64 use_offset;  // offset of identifier use in bytes from the start of the file that contains it
-	u32 len;         // length in bytes of the identifier
-	u32 def_file_id;
-	u64 def_offset;  // offset of entity definition in bytes from the start of the file that contains it
-};
-
-struct GoToDefFile {
-	u32 id;
-	BinaryString path;
-	BinaryArray<GoToDefIdent> idents;
-};
-
-struct GoToDefHeader {
-	u8  magic[4]; // ogtd (odin-go-to-definitions)
-	u32 version;  // 1
-	BinaryArray<GoToDefFile> files;
-};
-
-struct GoToDefFileMap {
-	AstFile *f;
-	u32 id;
-	Array<Ast *> idents;
-};
-
-
-gb_internal int go_to_def_file_map_compare(void const *a, void const *b) {
-	GoToDefFileMap const *x = cast(GoToDefFileMap const *)a;
-	GoToDefFileMap const *y = cast(GoToDefFileMap const *)b;
-	if (x == y) {
-		return 0;
-	} else if (x != nullptr && y == nullptr) {
-		return -1;
-	} else if (x == nullptr && y != nullptr) {
-		return +1;
-	}
-	if (x->f->id < y->f->id) {
-		return -1;
-	} else if (x->f->id > y->f->id) {
-		return +1;
-	}
-	return 0;
-}
-
-gb_internal int quick_ident_compare(void const *a, void const *b) {
-	Ast *x = *cast(Ast **)a;
-	Ast *y = *cast(Ast **)b;
-
-	// NOTE(bill): This assumes that the file is same
-	if (x->Ident.token.pos.offset < y->Ident.token.pos.offset) {
-		return -1;
-	} else if (x->Ident.token.pos.offset > y->Ident.token.pos.offset) {
-		return +1;
-	}
-	return 0;
-}
-
-
-gb_internal void generate_and_print_query_data_go_to_definitions(Checker *c) {
-	GB_ASSERT(c->info.allow_identifier_uses);
-
-	gbAllocator a = query_value_allocator;
-
-	isize file_path_memory_needed = 0;
-	auto files = array_make<GoToDefFileMap>(a, 0, c->info.files.entries.count);
-	for (auto const &entry : c->info.files) {
-		AstFile *f = entry.value;
-		file_path_memory_needed += f->fullpath.len+1; // add NUL terminator
-
-
-		GoToDefFileMap x = {};
-		x.f = f;
-		array_init(&x.idents, a);
-		array_add(&files, x);
-	}
-	gb_sort_array(files.data, files.count, go_to_def_file_map_compare);
-
-	auto file_id_map_to_index = array_make<isize>(a, files[files.count-1].f->id + 1);
-	for_array(i, file_id_map_to_index) {
-		file_id_map_to_index[i] = -1;
-	}
-	for_array(i, files) {
-		file_id_map_to_index[files[i].f->id] = i;
-	}
-
-
-
-	for_array(i, c->info.identifier_uses) {
-		Ast *ast = c->info.identifier_uses[i];
-		GB_ASSERT(ast->kind == Ast_Ident);
-		TokenPos pos = ast->Ident.token.pos;
-		Entity *e = ast->Ident.entity;
-		if (e == nullptr) {
-			continue;
-		}
-
-
-		AstFile **use_file_found = string_map_get(&c->info.files, get_file_path_string(pos.file_id));
-		GB_ASSERT(use_file_found != nullptr);
-		AstFile *use_file = *use_file_found;
-		GB_ASSERT(use_file != nullptr);
-
-		if (e->scope == nullptr) {
-			GB_ASSERT(e->flags & EntityFlag_Field);
-			continue;
-		}
-		if (e->scope->flags & ScopeFlag_Global) {
-			continue;
-		}
-
-		isize idx = file_id_map_to_index[use_file->id];
-		if (idx >= 0) {
-			array_add(&files[idx].idents, ast);
-		} else {
-			// TODO(bill): Handle invalid map case?
-		}
-	}
-
-	for_array(i, files) {
-		GoToDefFileMap *f = &files[i];
-		gb_sort_array(f->idents.data, f->idents.count, quick_ident_compare);
-		// gb_printf_err("%lld %.*s -> %lld\n", f->f->id, LIT(f->f->fullpath), f->idents.count);
-	}
-
-
-
-	isize data_min_size = 0;
-
-	u32 header_offset = cast(u32)data_min_size; gb_unused(header_offset);
-	data_min_size += gb_size_of(GoToDefHeader);
-	data_min_size = align_formula_isize(data_min_size, 8);
-
-	u32 file_offset = cast(u32)data_min_size;
-	data_min_size += gb_size_of(GoToDefFile) * files.count;
-	data_min_size = align_formula_isize(data_min_size, 8);
-
-	u32 file_path_offset = cast(u32)data_min_size;
-	data_min_size += file_path_memory_needed;
-	data_min_size = align_formula_isize(data_min_size, 8);
-
-	u32 idents_offset = cast(u32)data_min_size;
-	data_min_size += gb_size_of(GoToDefIdent) * c->info.identifier_uses.count;
-
-
-	auto data = array_make<u8>(a, 0, data_min_size);
-	defer (array_free(&data));
-
-	GoToDefHeader header = {};
-	gb_memmove(header.magic, "ogtd", 4);
-	header.version = 1;
-	header.files.length = cast(u32)files.count;
-	header.files.offset = file_offset;
-
-	array_add_elems(&data, cast(u8 *)&header, gb_size_of(header));
-
-	array_resize(&data, data_min_size);
-
-	auto binary_files = binary_array_from_data(header.files, data.data);
-
-	u32 file_path_offset_index = file_path_offset;
-	u32 idents_offset_index = idents_offset;
-	for_array(i, files) {
-		GoToDefFileMap *f_map = &files[i];
-		AstFile *f = f_map->f;
-		binary_files[i].id = cast(u32)f->id;
-
-		binary_files[i].path.offset = file_path_offset_index;
-		binary_files[i].path.length = cast(u32)f->fullpath.len;
-
-		binary_files[i].idents.offset = idents_offset_index;
-		binary_files[i].idents.length = cast(u32)f_map->idents.count;
-
-		auto path = binary_array_from_data(binary_files[i].path, data.data);
-		gb_memmove(path.data, f->fullpath.text, f->fullpath.len);
-		path.data[f->fullpath.len] = 0;
-
-
-		auto idents = binary_array_from_data(binary_files[i].idents, data.data);
-		for_array(j, f_map->idents) {
-			Ast *ast = f_map->idents[j];
-			GB_ASSERT(ast->kind == Ast_Ident);
-
-			Entity *e = ast->Ident.entity;
-			TokenPos def = e->token.pos;
-			AstFile *def_file = e->file;
-
-			if (def_file == nullptr) {
-				auto *def_file_found = string_map_get(&c->info.files, get_file_path_string(e->token.pos.file_id));
-				if (def_file_found == nullptr) {
-					continue;
-				}
-				def_file = *def_file_found;
-			}
-
-			isize file_index = file_id_map_to_index[def_file->id];
-			GB_ASSERT(file_index >= 0);
-
-			idents[j].use_offset  = cast(u64)ast->Ident.token.pos.offset;
-			idents[j].len         = cast(u32)ast->Ident.token.string.len;
-			idents[j].def_file_id = cast(u32)def_file->id;
-			idents[j].def_offset  = cast(u64)e->token.pos.offset;
-
-			// gb_printf_err("%llu %llu %llu %llu\n", idents[j].len, idents[j].use_offset, idents[j].def_file_id, idents[j].def_offset);
-		}
-
-		file_path_offset_index += cast(u32)(f->fullpath.len + 1);
-		idents_offset_index += cast(u32)(f_map->idents.count * gb_size_of(GoToDefIdent));
-	}
-
-
-	gb_file_write(gb_file_get_standard(gbFileStandard_Output), data.data, data.count*gb_size_of(*data.data));
-}
-

+ 9 - 9
src/range_cache.cpp

@@ -59,12 +59,12 @@ gb_internal bool range_cache_add_range(RangeCache *c, i64 lo, i64 hi) {
 }
 }
 
 
 
 
-gb_internal bool range_cache_index_exists(RangeCache *c, i64 index) {
-	for_array(i, c->ranges) {
-		RangeValue v = c->ranges[i];
-		if (v.lo <= index && index <= v.hi) {
-			return true;
-		}
-	}
-	return false;
-}
+// gb_internal bool range_cache_index_exists(RangeCache *c, i64 index) {
+// 	for_array(i, c->ranges) {
+// 		RangeValue v = c->ranges[i];
+// 		if (v.lo <= index && index <= v.hi) {
+// 			return true;
+// 		}
+// 	}
+// 	return false;
+// }

+ 0 - 14
src/string.cpp

@@ -89,14 +89,6 @@ gb_internal char *alloc_cstring(gbAllocator a, String s) {
 	return c_str;
 	return c_str;
 }
 }
 
 
-gb_internal char *cstring_duplicate(gbAllocator a, char const *s) {
-	isize len = gb_strlen(s);
-	char *c_str = gb_alloc_array(a, char, len+1);
-	gb_memmove(c_str, s, len);
-	c_str[len] = '\0';
-	return c_str;
-}
-
 
 
 
 
 gb_internal gb_inline bool str_eq_ignore_case(String const &a, String const &b) {
 gb_internal gb_inline bool str_eq_ignore_case(String const &a, String const &b) {
@@ -166,12 +158,6 @@ gb_internal isize string_index_byte(String const &s, u8 x) {
 	return -1;
 	return -1;
 }
 }
 
 
-gb_internal GB_COMPARE_PROC(string_cmp_proc) {
-	String x = *(String *)a;
-	String y = *(String *)b;
-	return string_compare(x, y);
-}
-
 gb_internal gb_inline bool str_eq(String const &a, String const &b) {
 gb_internal gb_inline bool str_eq(String const &a, String const &b) {
 	if (a.len != b.len) return false;
 	if (a.len != b.len) return false;
 	return memcmp(a.text, b.text, a.len) == 0;
 	return memcmp(a.text, b.text, a.len) == 0;

+ 0 - 2
src/string_map.cpp

@@ -18,8 +18,6 @@ gb_internal gb_inline bool string_hash_key_equal(StringHashKey const &a, StringH
 	}
 	}
 	return false;
 	return false;
 }
 }
-gb_internal bool operator==(StringHashKey const &a, StringHashKey const &b) { return string_hash_key_equal(a, b); }
-gb_internal bool operator!=(StringHashKey const &a, StringHashKey const &b) { return !string_hash_key_equal(a, b); }
 
 
 template <typename T>
 template <typename T>
 struct StringMapEntry {
 struct StringMapEntry {

+ 8 - 42
src/threading.cpp

@@ -1,6 +1,10 @@
 #if defined(GB_SYSTEM_LINUX)
 #if defined(GB_SYSTEM_LINUX)
 #include <signal.h>
 #include <signal.h>
 #endif
 #endif
+#if defined(GB_SYSTEM_WINDOWS)
+	#pragma warning(push)
+	#pragma warning(disable: 4505)
+#endif
 
 
 struct BlockingMutex;
 struct BlockingMutex;
 struct RecursiveMutex;
 struct RecursiveMutex;
@@ -269,48 +273,6 @@ struct MutexGuard {
 		
 		
 	}
 	}
 #endif
 #endif
-	
-	
-struct Barrier {
-	BlockingMutex mutex;
-	Condition cond;
-	isize index;
-	isize generation_id;
-	isize thread_count;	
-};
-
-gb_internal void barrier_init(Barrier *b, isize thread_count) {
-	mutex_init(&b->mutex);
-	condition_init(&b->cond);
-	b->index = 0;
-	b->generation_id = 0;
-	b->thread_count = 0;
-}
-
-gb_internal void barrier_destroy(Barrier *b) {
-	condition_destroy(&b->cond);
-	mutex_destroy(&b->mutex);
-}
-
-// Returns true if it is the leader
-gb_internal bool barrier_wait(Barrier *b) {
-	mutex_lock(&b->mutex);
-	defer (mutex_unlock(&b->mutex));
-	isize local_gen = b->generation_id;
-	b->index += 1;
-	if (b->index < b->thread_count) {
-		while (local_gen == b->generation_id && b->index < b->thread_count) {
-			condition_wait(&b->cond, &b->mutex);
-		}
-		return false;
-	}
-	b->index = 0;
-	b->generation_id += 1;
-	condition_broadcast(&b->cond);
-	return true;
-}
-
-
 
 
 
 
 gb_internal u32 thread_current_id(void) {
 gb_internal u32 thread_current_id(void) {
@@ -494,3 +456,7 @@ gb_internal void thread_set_name(Thread *t, char const *name) {
 #endif
 #endif
 }
 }
 
 
+
+#if defined(GB_SYSTEM_WINDOWS)
+	#pragma warning(pop)
+#endif

+ 0 - 75
src/types.cpp

@@ -430,15 +430,6 @@ gb_internal Selection sub_selection(Selection const &sel, isize offset) {
 	return res;
 	return res;
 }
 }
 
 
-gb_internal Selection sub_selection_with_length(Selection const &sel, isize offset, isize len) {
-	Selection res = {};
-	res.index.data = sel.index.data + offset;
-	res.index.count = gb_max(len, gb_max(sel.index.count - offset, 0));
-	res.index.capacity = res.index.count;
-	return res;
-}
-
-
 
 
 gb_global Type basic_types[] = {
 gb_global Type basic_types[] = {
 	{Type_Basic, {Basic_Invalid,           0,                                          0, STR_LIT("invalid type")}},
 	{Type_Basic, {Basic_Invalid,           0,                                          0, STR_LIT("invalid type")}},
@@ -1089,15 +1080,6 @@ gb_internal Type *alloc_type_proc(Scope *scope, Type *params, isize param_count,
 
 
 gb_internal bool is_type_valid_for_keys(Type *t);
 gb_internal bool is_type_valid_for_keys(Type *t);
 
 
-gb_internal Type *alloc_type_map(i64 count, Type *key, Type *value) {
-	if (key != nullptr) {
-		GB_ASSERT(value != nullptr);
-	}
-	Type *t = alloc_type(Type_Map);
-	t->Map.key   = key;
-	t->Map.value = value;
-	return t;
-}
 
 
 gb_internal Type *alloc_type_bit_set() {
 gb_internal Type *alloc_type_bit_set() {
 	Type *t = alloc_type(Type_BitSet);
 	Type *t = alloc_type(Type_BitSet);
@@ -1152,19 +1134,6 @@ gb_internal bool is_type_named(Type *t) {
 	}
 	}
 	return t->kind == Type_Named;
 	return t->kind == Type_Named;
 }
 }
-gb_internal bool is_type_named_alias(Type *t) {
-	if (!is_type_named(t)) {
-		return false;
-	}
-	Entity *e = t->Named.type_name;
-	if (e == nullptr) {
-		return false;
-	}
-	if (e->kind != Entity_TypeName) {
-		return false;
-	}
-	return e->TypeName.is_type_alias;
-}
 
 
 gb_internal bool is_type_boolean(Type *t) {
 gb_internal bool is_type_boolean(Type *t) {
 	// t = core_type(t);
 	// t = core_type(t);
@@ -1329,27 +1298,6 @@ gb_internal bool is_type_complex_or_quaternion(Type *t) {
 	}
 	}
 	return false;
 	return false;
 }
 }
-gb_internal bool is_type_f16(Type *t) {
-	t = core_type(t);
-	if (t->kind == Type_Basic) {
-		return t->Basic.kind == Basic_f16;
-	}
-	return false;
-}
-gb_internal bool is_type_f32(Type *t) {
-	t = core_type(t);
-	if (t->kind == Type_Basic) {
-		return t->Basic.kind == Basic_f32;
-	}
-	return false;
-}
-gb_internal bool is_type_f64(Type *t) {
-	t = core_type(t);
-	if (t->kind == Type_Basic) {
-		return t->Basic.kind == Basic_f64;
-	}
-	return false;
-}
 gb_internal bool is_type_pointer(Type *t) {
 gb_internal bool is_type_pointer(Type *t) {
 	t = base_type(t);
 	t = base_type(t);
 	if (t->kind == Type_Basic) {
 	if (t->kind == Type_Basic) {
@@ -1550,10 +1498,6 @@ gb_internal bool is_type_asm_proc(Type *t) {
 	t = base_type(t);
 	t = base_type(t);
 	return t->kind == Type_Proc && t->Proc.calling_convention == ProcCC_InlineAsm;
 	return t->kind == Type_Proc && t->Proc.calling_convention == ProcCC_InlineAsm;
 }
 }
-gb_internal bool is_type_poly_proc(Type *t) {
-	t = base_type(t);
-	return t->kind == Type_Proc && t->Proc.is_polymorphic;
-}
 gb_internal bool is_type_simd_vector(Type *t) {
 gb_internal bool is_type_simd_vector(Type *t) {
 	t = base_type(t);
 	t = base_type(t);
 	return t->kind == Type_SimdVector;
 	return t->kind == Type_SimdVector;
@@ -1915,11 +1859,6 @@ gb_internal bool is_type_empty_union(Type *t) {
 	t = base_type(t);
 	t = base_type(t);
 	return t->kind == Type_Union && t->Union.variants.count == 0;
 	return t->kind == Type_Union && t->Union.variants.count == 0;
 }
 }
-gb_internal bool is_type_empty_struct(Type *t) {
-	t = base_type(t);
-	return t->kind == Type_Struct && !t->Struct.is_raw_union && t->Struct.fields.count == 0;
-}
-
 
 
 gb_internal bool is_type_valid_for_keys(Type *t) {
 gb_internal bool is_type_valid_for_keys(Type *t) {
 	t = core_type(t);
 	t = core_type(t);
@@ -4051,20 +3990,6 @@ gb_internal Type *reduce_tuple_to_single_type(Type *original_type) {
 	return original_type;
 	return original_type;
 }
 }
 
 
-
-gb_internal Type *alloc_type_struct_from_field_types(Type **field_types, isize field_count, bool is_packed) {
-	Type *t = alloc_type_struct();
-	t->Struct.fields = slice_make<Entity *>(heap_allocator(), field_count);
-
-	Scope *scope = nullptr;
-	for_array(i, t->Struct.fields) {
-		t->Struct.fields[i] = alloc_entity_field(scope, blank_token, field_types[i], false, cast(i32)i, EntityState_Resolved);
-	}
-	t->Struct.is_packed = is_packed;
-
-	return t;
-}
-
 gb_internal Type *alloc_type_tuple_from_field_types(Type **field_types, isize field_count, bool is_packed, bool must_be_tuple) {
 gb_internal Type *alloc_type_tuple_from_field_types(Type **field_types, isize field_count, bool is_packed, bool must_be_tuple) {
 	if (field_count == 0) {
 	if (field_count == 0) {
 		return nullptr;
 		return nullptr;