mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-25 07:04:58 -07:00
Remove dead code
This commit is contained in:
+4
-3
@@ -329,6 +329,7 @@ void check_const_decl(CheckerContext *ctx, Entity *e, AstNode *type_expr, AstNod
|
||||
}
|
||||
|
||||
if (entity != nullptr) {
|
||||
// TODO(bill): Clean up aliasing code
|
||||
switch (entity->kind) {
|
||||
case Entity_Alias:
|
||||
e->kind = Entity_Alias;
|
||||
@@ -346,14 +347,14 @@ void check_const_decl(CheckerContext *ctx, Entity *e, AstNode *type_expr, AstNod
|
||||
e->ImportName.path = entity->ImportName.path;
|
||||
e->ImportName.name = entity->ImportName.path;
|
||||
e->ImportName.scope = entity->ImportName.scope;
|
||||
e->ImportName.used = false;
|
||||
e->flags &= ~EntityFlag_Used;
|
||||
return;
|
||||
case Entity_LibraryName:
|
||||
e->kind = Entity_LibraryName;
|
||||
e->type = entity->type;
|
||||
e->LibraryName.path = entity->LibraryName.path;
|
||||
e->LibraryName.name = entity->LibraryName.path;
|
||||
e->LibraryName.used = false;
|
||||
e->flags &= ~EntityFlag_Used;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -468,7 +469,7 @@ void init_entity_foreign_library(CheckerContext *ctx, Entity *e) {
|
||||
} else {
|
||||
// TODO(bill): Extra stuff to do with library names?
|
||||
*foreign_library = found;
|
||||
found->LibraryName.used = true;
|
||||
found->flags |= EntityFlag_Used;
|
||||
add_entity_use(ctx, ident, found);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-3
@@ -1287,7 +1287,7 @@ void add_dependency_to_set(Checker *c, Entity *entity) {
|
||||
Entity *fl = e->Procedure.foreign_library;
|
||||
if (fl != nullptr) {
|
||||
GB_ASSERT_MSG(fl->kind == Entity_LibraryName &&
|
||||
fl->LibraryName.used,
|
||||
(fl->flags&EntityFlag_Used),
|
||||
"%.*s", LIT(name));
|
||||
add_dependency_to_set(c, fl);
|
||||
}
|
||||
@@ -1296,7 +1296,7 @@ void add_dependency_to_set(Checker *c, Entity *entity) {
|
||||
Entity *fl = e->Variable.foreign_library;
|
||||
if (fl != nullptr) {
|
||||
GB_ASSERT_MSG(fl->kind == Entity_LibraryName &&
|
||||
fl->LibraryName.used,
|
||||
(fl->flags&EntityFlag_Used),
|
||||
"%.*s", LIT(name));
|
||||
add_dependency_to_set(c, fl);
|
||||
}
|
||||
@@ -2339,7 +2339,9 @@ String path_to_entity_name(String name, String fullpath) {
|
||||
}
|
||||
}
|
||||
|
||||
filename = substring(filename, 0, dot);
|
||||
if (dot > 0) {
|
||||
filename = substring(filename, 0, dot);
|
||||
}
|
||||
|
||||
if (is_string_an_identifier(filename)) {
|
||||
return filename;
|
||||
|
||||
+8
-17
@@ -50,13 +50,6 @@ enum EntityFlag {
|
||||
EntityFlag_CVarArg = 1<<20,
|
||||
};
|
||||
|
||||
// Zero value means the overloading process is not yet done
|
||||
enum OverloadKind {
|
||||
Overload_Unknown = 0,
|
||||
Overload_No = 1,
|
||||
Overload_Yes = 2,
|
||||
};
|
||||
|
||||
enum EntityState {
|
||||
EntityState_Unresolved = 0,
|
||||
EntityState_InProgress = 1,
|
||||
@@ -93,17 +86,18 @@ struct Entity {
|
||||
i32 field_index;
|
||||
i32 field_src_index;
|
||||
ExactValue default_value;
|
||||
String thread_local_model;
|
||||
Entity * foreign_library;
|
||||
AstNode * foreign_library_ident;
|
||||
String link_name;
|
||||
String link_prefix;
|
||||
String thread_local_model;
|
||||
bool is_foreign;
|
||||
bool is_export;
|
||||
|
||||
bool default_is_nil;
|
||||
bool default_is_undef;
|
||||
bool default_is_location;
|
||||
bool is_immutable;
|
||||
bool is_foreign;
|
||||
bool is_export;
|
||||
} Variable;
|
||||
struct {
|
||||
bool is_type_alias;
|
||||
@@ -111,14 +105,13 @@ struct Entity {
|
||||
String ir_mangled_name;
|
||||
} TypeName;
|
||||
struct {
|
||||
OverloadKind overload_kind;
|
||||
String link_name;
|
||||
String link_prefix;
|
||||
u64 tags;
|
||||
bool is_export;
|
||||
bool is_foreign;
|
||||
Entity * foreign_library;
|
||||
AstNode * foreign_library_ident;
|
||||
String link_name;
|
||||
String link_prefix;
|
||||
bool is_foreign;
|
||||
bool is_export;
|
||||
} Procedure;
|
||||
struct {
|
||||
Array<Entity *> entities;
|
||||
@@ -133,12 +126,10 @@ struct Entity {
|
||||
String path;
|
||||
String name;
|
||||
Scope *scope;
|
||||
bool used;
|
||||
} ImportName;
|
||||
struct {
|
||||
String path;
|
||||
String name;
|
||||
bool used;
|
||||
} LibraryName;
|
||||
i32 Nil;
|
||||
struct {
|
||||
|
||||
@@ -24,7 +24,6 @@ enum ExactValueKind {
|
||||
ExactValue_Pointer,
|
||||
ExactValue_Compound, // TODO(bill): Is this good enough?
|
||||
ExactValue_Procedure, // TODO(bill): Is this good enough?
|
||||
ExactValue_Entity, // TODO(bill): Is this good enough?
|
||||
|
||||
ExactValue_Count,
|
||||
};
|
||||
@@ -68,8 +67,6 @@ HashKey hash_exact_value(ExactValue v) {
|
||||
return hash_pointer(v.value_compound);
|
||||
case ExactValue_Procedure:
|
||||
return hash_pointer(v.value_procedure);
|
||||
case ExactValue_Entity:
|
||||
return hash_pointer(v.value_entity);
|
||||
}
|
||||
return hashing_proc(&v, gb_size_of(ExactValue));
|
||||
|
||||
@@ -132,12 +129,6 @@ ExactValue exact_value_procedure(AstNode *node) {
|
||||
return result;
|
||||
}
|
||||
|
||||
ExactValue exact_value_entity(Entity *entity) {
|
||||
ExactValue result = {ExactValue_Entity};
|
||||
result.value_entity = entity;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
ExactValue exact_value_integer_from_string(String string) {
|
||||
u64 u = u64_from_string(string);
|
||||
|
||||
+1
-1
@@ -1331,7 +1331,7 @@ void ir_add_foreign_library_path(irModule *m, Entity *e) {
|
||||
return;
|
||||
}
|
||||
GB_ASSERT(e->kind == Entity_LibraryName);
|
||||
GB_ASSERT(e->LibraryName.used);
|
||||
GB_ASSERT(e->flags & EntityFlag_Used);
|
||||
|
||||
String library_path = e->LibraryName.path;
|
||||
if (library_path.len == 0) {
|
||||
|
||||
Reference in New Issue
Block a user