aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/build_settings.cpp2
-rw-r--r--src/check_expr.cpp4
-rw-r--r--src/checker.cpp12
-rw-r--r--src/ir_print.cpp37
-rw-r--r--src/main.cpp4
5 files changed, 47 insertions, 12 deletions
diff --git a/src/build_settings.cpp b/src/build_settings.cpp
index 5c9b44cd3..a63ff7b4e 100644
--- a/src/build_settings.cpp
+++ b/src/build_settings.cpp
@@ -283,7 +283,7 @@ String get_fullpath_core(gbAllocator a, String path) {
}
-String const ODIN_VERSION = str_lit("0.6.1a");
+String const ODIN_VERSION = str_lit("0.6.2");
void init_build_context(void) {
BuildContext *bc = &build_context;
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index df2fe185e..c33d59bcf 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -8136,7 +8136,9 @@ ExprKind check_expr_base_internal(Checker *c, Operand *o, AstNode *node, Type *t
o->type = t->Pointer.elem;
} else {
gbString str = expr_to_string(o->expr);
- error(o->expr, "Cannot dereference `%s`", str);
+ gbString typ = type_to_string(o->type);
+ error(o->expr, "Cannot dereference `%s` of type `%s`", str, typ);
+ gb_string_free(typ);
gb_string_free(str);
o->mode = Addressing_Invalid;
o->expr = node;
diff --git a/src/checker.cpp b/src/checker.cpp
index 73539a214..d40e05bfa 100644
--- a/src/checker.cpp
+++ b/src/checker.cpp
@@ -1341,14 +1341,14 @@ void check_entity_decl(Checker *c, Entity *e, DeclInfo *d, Type *named_type);
void init_preload(Checker *c) {
if (t_type_info == nullptr) {
- Entity *type_info_entity = find_core_entity(c, str_lit("TypeInfo"));
+ Entity *type_info_entity = find_core_entity(c, str_lit("Type_Info"));
t_type_info = type_info_entity->type;
t_type_info_ptr = make_type_pointer(c->allocator, t_type_info);
GB_ASSERT(is_type_struct(type_info_entity->type));
TypeStruct *tis = &base_type(type_info_entity->type)->Struct;
- Entity *type_info_enum_value = find_sub_core_entity(tis, str_lit("EnumValue"));
+ Entity *type_info_enum_value = find_sub_core_entity(tis, str_lit("Enum_Value"));
t_type_info_enum_value = type_info_enum_value->type;
t_type_info_enum_value_ptr = make_type_pointer(c->allocator, t_type_info_enum_value);
@@ -1361,7 +1361,7 @@ void init_preload(Checker *c) {
TypeUnion *tiv = &tiv_type->Union;
if (tiv->variants.count != 20) {
- compiler_error("Invalid `TypeInfo` layout");
+ compiler_error("Invalid `Type_Info` layout");
}
t_type_info_named = tiv->variants[ 0];
t_type_info_integer = tiv->variants[ 1];
@@ -1420,18 +1420,18 @@ void init_preload(Checker *c) {
}
if (t_source_code_location == nullptr) {
- Entity *e = find_core_entity(c, str_lit("SourceCodeLocation"));
+ Entity *e = find_core_entity(c, str_lit("Source_Code_Location"));
t_source_code_location = e->type;
t_source_code_location_ptr = make_type_pointer(c->allocator, t_allocator);
}
if (t_map_key == nullptr) {
- Entity *e = find_core_entity(c, str_lit("__MapKey"));
+ Entity *e = find_core_entity(c, str_lit("__Map_Key"));
t_map_key = e->type;
}
if (t_map_header == nullptr) {
- Entity *e = find_core_entity(c, str_lit("__MapHeader"));
+ Entity *e = find_core_entity(c, str_lit("__Map_Header"));
t_map_header = e->type;
}
diff --git a/src/ir_print.cpp b/src/ir_print.cpp
index c7dc9e2d0..70afb29e5 100644
--- a/src/ir_print.cpp
+++ b/src/ir_print.cpp
@@ -293,7 +293,7 @@ void ir_print_type(irFileBuffer *f, irModule *m, Type *t) {
case Type_Union: {
if (t->Union.variants.count == 0) {
- ir_write_string(f, "%%..opaque");
+ ir_print_encoded_local(f, str_lit("..opaque"));
} else {
// NOTE(bill): The zero size array is used to fix the alignment used in a structure as
// LLVM takes the first element's alignment as the entire alignment (like C)
@@ -1723,10 +1723,41 @@ void ir_print_proc(irFileBuffer *f, irModule *m, irProcedure *proc) {
void ir_print_type_name(irFileBuffer *f, irModule *m, irValue *v) {
GB_ASSERT(v->kind == irValue_TypeName);
- Type *bt = base_type(ir_type(v));
+ Type *t = base_type(v->TypeName.type);
ir_print_encoded_local(f, v->TypeName.name);
ir_write_string(f, str_lit(" = type "));
- ir_print_type(f, m, base_type(v->TypeName.type));
+
+
+ switch (t->kind) {
+ case Type_Union:
+ if (t->Union.variants.count == 0) {
+ ir_write_string(f, str_lit("{}"));
+ } else {
+ ir_print_type(f, m, t);
+ }
+ break;
+ case Type_Struct:
+ if (t->Struct.fields.count == 0) {
+ if (t->Struct.is_packed) {
+ ir_write_byte(f, '<');
+ }
+ ir_write_byte(f, '{');
+ if (t->Struct.custom_align > 0) {
+ ir_fprintf(f, "[0 x <%lld x i8>]", t->Struct.custom_align);
+ }
+ ir_write_byte(f, '}');
+ if (t->Struct.is_packed) {
+ ir_write_byte(f, '>');
+ }
+ } else {
+ ir_print_type(f, m, t);
+ }
+ break;
+ default:
+ ir_print_type(f, m, t);
+ break;
+ }
+
ir_write_byte(f, '\n');
}
diff --git a/src/main.cpp b/src/main.cpp
index a3cd45283..729ba9fc5 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,6 +1,8 @@
#define USE_CUSTOM_BACKEND 0
-#define USE_THREADED_PARSER 1
// #define NO_ARRAY_BOUNDS_CHECK
+#if !defined(USE_THREADED_PARSER)
+#define USE_THREADED_PARSER 0
+#endif
#include "common.cpp"
#include "timings.cpp"