aboutsummaryrefslogtreecommitdiff
path: root/src/checker/entity.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2016-09-18 21:44:22 +0100
committerGinger Bill <bill@gingerbill.org>2016-09-18 21:44:22 +0100
commit828095afd1351b218cae6b60033200a92894921c (patch)
treeeca72ccef9a122f809cc824d47989ad03077b833 /src/checker/entity.cpp
parent2d6171f3e573c06dc9eb1c8fc3ada720998b24fa (diff)
Better name mangler for SSA generation
TODO: Define better name mangling rules and allow for explicit name overload
Diffstat (limited to 'src/checker/entity.cpp')
-rw-r--r--src/checker/entity.cpp36
1 files changed, 15 insertions, 21 deletions
diff --git a/src/checker/entity.cpp b/src/checker/entity.cpp
index fd9c5ce8a..dea0e2e0f 100644
--- a/src/checker/entity.cpp
+++ b/src/checker/entity.cpp
@@ -26,37 +26,37 @@ String const entity_strings[] = {
};
-typedef i64 EntityGuid;
typedef struct Type Type;
struct Entity {
EntityKind kind;
- EntityGuid guid;
- Scope *scope;
- Token token;
- Type *type;
- Entity *using_parent;
- AstNode *using_expr;
+ Scope * scope;
+ Token token;
+ Type * type;
+ Entity * using_parent;
+ AstNode * using_expr;
union {
- struct { ExactValue value; } Constant;
struct {
- b8 visited; // Cycle detection
- b8 used; // Variable is used
- b8 anonymous; // Variable is an anonymous
- b8 is_using; // `using` variable
+ ExactValue value;
+ } Constant;
+ struct {
+ b8 visited; // Cycle detection
+ b8 used; // Variable is used
+ b8 anonymous; // Variable is an anonymous
+ b8 is_using; // `using` variable
i32 field_index; // Order in source
b8 is_field; // Is struct field
} Variable;
struct {
- // struct DeclInfo *decl; // Usually NULL
} TypeName;
struct {
- b8 pure;
} Procedure;
- struct { BuiltinProcId id; } Builtin;
+ struct {
+ BuiltinProcId id;
+ } Builtin;
struct {
String path;
String name;
@@ -78,16 +78,10 @@ b32 is_entity_exported(Entity *e) {
return true;
}
-gb_global gbAtomic64 entity_guid_counter = {0};
-
-EntityGuid next_entity_guid(void) {
- return cast(EntityGuid)gb_atomic64_fetch_add(&entity_guid_counter, 1);
-}
Entity *alloc_entity(gbAllocator a, EntityKind kind, Scope *scope, Token token, Type *type) {
Entity *entity = gb_alloc_item(a, Entity);
entity->kind = kind;
- entity->guid = next_entity_guid();
entity->scope = scope;
entity->token = token;
entity->type = type;