Browse Source

Remove unnecessary `typedef` usage

Ginger Bill 8 years ago
parent
commit
2b96be0ae8
18 changed files with 349 additions and 365 deletions
  1. 2 2
      src/build_settings.cpp
  2. 2 2
      src/check_decl.cpp
  3. 14 14
      src/check_expr.cpp
  4. 7 7
      src/check_stmt.cpp
  5. 36 37
      src/checker.cpp
  6. 0 2
      src/common.cpp
  7. 12 13
      src/entity.cpp
  8. 7 7
      src/exact_value.cpp
  9. 73 79
      src/ir.cpp
  10. 6 6
      src/ir_opt.cpp
  11. 2 2
      src/ir_print.cpp
  12. 118 119
      src/parser.cpp
  13. 27 31
      src/ssa.cpp
  14. 0 1
      src/ssa_op.cpp
  15. 4 4
      src/string.cpp
  16. 4 4
      src/timings.cpp
  17. 14 14
      src/tokenizer.cpp
  18. 21 21
      src/types.cpp

+ 2 - 2
src/build_settings.cpp

@@ -1,5 +1,5 @@
 // This stores the information for the specify architecture of this build
-typedef struct BuildContext {
+struct BuildContext {
 	// Constants
 	String ODIN_OS;      // target operating system
 	String ODIN_ARCH;    // target architecture
@@ -15,7 +15,7 @@ typedef struct BuildContext {
 	String llc_flags;
 	String link_flags;
 	bool   is_dll;
-} BuildContext;
+};
 
 
 gb_global BuildContext build_context = {0};

+ 2 - 2
src/check_decl.cpp

@@ -58,7 +58,7 @@ Type *check_init_variable(Checker *c, Entity *e, Operand *operand, String contex
 	return e->type;
 }
 
-void check_init_variables(Checker *c, Entity **lhs, isize lhs_count, AstNodeArray inits, String context_name) {
+void check_init_variables(Checker *c, Entity **lhs, isize lhs_count, Array<AstNode *> inits, String context_name) {
 	if ((lhs == NULL || lhs_count == 0) && inits.count == 0) {
 		return;
 	}
@@ -431,7 +431,7 @@ void check_var_decl(Checker *c, Entity *e, Entity **entities, isize entity_count
 		}
 	}
 
-	AstNodeArray inits;
+	Array<AstNode *> inits;
 	array_init(&inits, c->allocator, 1);
 	array_add(&inits, init_expr);
 	check_init_variables(c, entities, entity_count, inits, str_lit("variable declaration"));

+ 14 - 14
src/check_expr.cpp

@@ -16,7 +16,7 @@ void     update_expr_type               (Checker *c, AstNode *e, Type *type, boo
 bool     check_is_terminating           (AstNode *node);
 bool     check_has_break                (AstNode *stmt, bool implicit);
 void     check_stmt                     (Checker *c, AstNode *node, u32 flags);
-void     check_stmt_list                (Checker *c, AstNodeArray stmts, u32 flags);
+void     check_stmt_list                (Checker *c, Array<AstNode *> stmts, u32 flags);
 void     check_init_constant            (Checker *c, Entity *e, Operand *operand);
 bool     check_representable_as_constant(Checker *c, ExactValue in_value, Type *type, ExactValue *out_value);
 Type *   check_call_arguments           (Checker *c, Operand *operand, Type *proc_type, AstNode *call);
@@ -46,7 +46,7 @@ void error_operand_no_value(Operand *o) {
 }
 
 
-void check_scope_decls(Checker *c, AstNodeArray nodes, isize reserve_size) {
+void check_scope_decls(Checker *c, Array<AstNode *> nodes, isize reserve_size) {
 	Scope *s = c->context.scope;
 	GB_ASSERT(!s->is_file);
 
@@ -385,7 +385,7 @@ void populate_using_entity_map(Checker *c, AstNode *node, Type *t, MapEntity *en
 
 
 // Returns filled field_count
-isize check_fields(Checker *c, AstNode *node, AstNodeArray decls,
+isize check_fields(Checker *c, AstNode *node, Array<AstNode *> decls,
                    Entity **fields, isize field_count,
                    String context) {
 	gbTempArenaMemory tmp = gb_temp_arena_memory_begin(&c->tmp_arena);
@@ -692,7 +692,7 @@ void check_union_type(Checker *c, Type *union_type, AstNode *node) {
 			ast_node(fl, FieldList, f->list);
 
 			// NOTE(bill): Copy the contents for the common fields for now
-			AstNodeArray list = {};
+			Array<AstNode *> list = {};
 			array_init_count(&list, c->allocator, ut->fields.count+fl->list.count);
 			gb_memmove_array(list.data, ut->fields.data, ut->fields.count);
 			gb_memmove_array(list.data+ut->fields.count, fl->list.data, fl->list.count);
@@ -1033,7 +1033,7 @@ Type *check_get_params(Checker *c, Scope *scope, AstNode *_params, bool *is_vari
 		return NULL;
 	}
 	ast_node(field_list, FieldList, _params);
-	AstNodeArray params = field_list->list;
+	Array<AstNode *> params = field_list->list;
 
 	if (params.count == 0) {
 		return NULL;
@@ -1118,7 +1118,7 @@ Type *check_get_results(Checker *c, Scope *scope, AstNode *_results) {
 		return NULL;
 	}
 	ast_node(field_list, FieldList, _results);
-	AstNodeArray results = field_list->list;
+	Array<AstNode *> results = field_list->list;
 
 	if (results.count == 0) {
 		return NULL;
@@ -4698,7 +4698,7 @@ bool check_builtin_procedure(Checker *c, Operand *operand, AstNode *call, i32 id
 	return true;
 }
 
-typedef enum CallArgumentError {
+enum CallArgumentError {
 	CallArgumentError_None,
 	CallArgumentError_WrongTypes,
 	CallArgumentError_NonVariadicExpand,
@@ -4707,12 +4707,12 @@ typedef enum CallArgumentError {
 	CallArgumentError_ArgumentCount,
 	CallArgumentError_TooFewArguments,
 	CallArgumentError_TooManyArguments,
-} CallArgumentError;
+};
 
-typedef enum CallArgumentErrorMode {
+enum CallArgumentErrorMode {
 	CallArgumentMode_NoErrors,
 	CallArgumentMode_ShowErrors,
-} CallArgumentErrorMode;
+};
 
 CallArgumentError check_call_arguments_internal(Checker *c, AstNode *call, Type *proc_type, Operand *operands, isize operand_count,
                                                 CallArgumentErrorMode show_error_mode, i64 *score_) {
@@ -4823,10 +4823,10 @@ CallArgumentError check_call_arguments_internal(Checker *c, AstNode *call, Type
 	return err;
 }
 
-typedef struct ValidProcAndScore {
+struct ValidProcAndScore {
 	isize index;
 	i64   score;
-} ValidProcAndScore;
+};
 
 int valid_proc_and_score_cmp(void const *a, void const *b) {
 	i64 si = (cast(ValidProcAndScore const *)a)->score;
@@ -4834,7 +4834,7 @@ int valid_proc_and_score_cmp(void const *a, void const *b) {
 	return sj < si ? -1 : sj > si;
 }
 
-bool check_unpack_arguments(Checker *c, isize lhs_count, Array<Operand> *operands, AstNodeArray rhs, bool allow_ok) {
+bool check_unpack_arguments(Checker *c, isize lhs_count, Array<Operand> *operands, Array<AstNode *> rhs, bool allow_ok) {
 	bool optional_ok = false;
 	for_array(i, rhs) {
 		Operand o = {};
@@ -6139,7 +6139,7 @@ void check_expr_or_type(Checker *c, Operand *o, AstNode *e) {
 
 gbString write_expr_to_string(gbString str, AstNode *node);
 
-gbString write_record_fields_to_string(gbString str, AstNodeArray params) {
+gbString write_record_fields_to_string(gbString str, Array<AstNode *> params) {
 	for_array(i, params) {
 		if (i > 0) {
 			str = gb_string_appendc(str, ", ");

+ 7 - 7
src/check_stmt.cpp

@@ -1,4 +1,4 @@
-void check_stmt_list(Checker *c, AstNodeArray stmts, u32 flags) {
+void check_stmt_list(Checker *c, Array<AstNode *> stmts, u32 flags) {
 	if (stmts.count == 0) {
 		return;
 	}
@@ -40,7 +40,7 @@ void check_stmt_list(Checker *c, AstNodeArray stmts, u32 flags) {
 
 }
 
-bool check_is_terminating_list(AstNodeArray stmts) {
+bool check_is_terminating_list(Array<AstNode *> stmts) {
 	// Iterate backwards
 	for (isize n = stmts.count-1; n >= 0; n--) {
 		AstNode *stmt = stmts[n];
@@ -52,7 +52,7 @@ bool check_is_terminating_list(AstNodeArray stmts) {
 	return false;
 }
 
-bool check_has_break_list(AstNodeArray stmts, bool implicit) {
+bool check_has_break_list(Array<AstNode *> stmts, bool implicit) {
 	for_array(i, stmts) {
 		AstNode *stmt = stmts[i];
 		if (check_has_break(stmt, implicit)) {
@@ -340,11 +340,11 @@ Type *check_assignment_variable(Checker *c, Operand *rhs, AstNode *lhs_node) {
 	return rhs->type;
 }
 
-typedef enum MatchTypeKind {
+enum MatchTypeKind {
 	MatchType_Invalid,
 	MatchType_Union,
 	MatchType_Any,
-} MatchTypeKind;
+};
 
 MatchTypeKind check_valid_type_match_type(Type *type) {
 	type = type_deref(type);
@@ -384,10 +384,10 @@ void check_stmt(Checker *c, AstNode *node, u32 flags) {
 
 
 
-typedef struct TypeAndToken {
+struct TypeAndToken {
 	Type *type;
 	Token token;
-} TypeAndToken;
+};
 
 #define MAP_TYPE TypeAndToken
 #define MAP_PROC map_type_and_token_

+ 36 - 37
src/checker.cpp

@@ -1,27 +1,27 @@
 #include "exact_value.cpp"
 #include "entity.cpp"
 
-typedef enum ExprKind {
+enum ExprKind {
 	Expr_Expr,
 	Expr_Stmt,
-} ExprKind;
+};
 
 // Statements and Declarations
-typedef enum StmtFlag {
+enum StmtFlag {
 	Stmt_BreakAllowed       = 1<<0,
 	Stmt_ContinueAllowed    = 1<<1,
 	Stmt_FallthroughAllowed = 1<<2,
 
 	Stmt_CheckScopeDecls    = 1<<5,
-} StmtFlag;
+};
 
-typedef struct BuiltinProc {
+struct BuiltinProc {
 	String   name;
 	isize    arg_count;
 	bool     variadic;
 	ExprKind kind;
-} BuiltinProc;
-typedef enum BuiltinProcId {
+};
+enum BuiltinProcId {
 	BuiltinProc_Invalid,
 
 	BuiltinProc_len,
@@ -71,7 +71,7 @@ typedef enum BuiltinProcId {
 	BuiltinProc_transmute,
 
 	BuiltinProc_Count,
-} BuiltinProcId;
+};
 gb_global BuiltinProc builtin_procs[BuiltinProc_Count] = {
 	{STR_LIT(""),                 0, false, Expr_Stmt},
 
@@ -125,7 +125,7 @@ gb_global BuiltinProc builtin_procs[BuiltinProc_Count] = {
 
 #include "types.cpp"
 
-typedef enum AddressingMode {
+enum AddressingMode {
 	Addressing_Invalid,       // invalid addressing mode
 	Addressing_NoValue,       // no value (void in C)
 	Addressing_Value,         // computed value (rvalue)
@@ -139,14 +139,14 @@ typedef enum AddressingMode {
 	                          // 	lhs: acts like a Variable
 	                          // 	rhs: acts like OptionalOk
 	Addressing_OptionalOk,    // rhs: acts like a value with an optional boolean part (for existence check)
-} AddressingMode;
+};
 
 // Operand is used as an intermediate value whilst checking
 // Operands store an addressing mode, the expression being evaluated,
 // its type and node, and other specific information for certain
 // addressing modes
 // Its zero-value is a valid "invalid operand"
-typedef struct Operand {
+struct Operand {
 	AddressingMode mode;
 	Type *         type;
 	ExactValue     value;
@@ -154,13 +154,13 @@ typedef struct Operand {
 	BuiltinProcId  builtin_id;
 	isize          overload_count;
 	Entity **      overload_entities;
-} Operand;
+};
 
-typedef struct TypeAndValue {
+struct TypeAndValue {
 	AddressingMode mode;
 	Type *         type;
 	ExactValue     value;
-} TypeAndValue;
+};
 
 bool is_operand_value(Operand o) {
 	switch (o.mode) {
@@ -178,13 +178,12 @@ bool is_operand_nil(Operand o) {
 }
 
 
-typedef struct BlockLabel {
+struct BlockLabel {
 	String   name;
 	AstNode *label; //  AstNode_Label;
-} BlockLabel;
+};
 
 // DeclInfo is used to store information of certain declarations to allow for "any order" usage
-typedef struct DeclInfo DeclInfo;
 struct DeclInfo {
 	DeclInfo *        parent; // NOTE(bill): only used for procedure literals at the moment
 	Scope *           scope;
@@ -203,22 +202,22 @@ struct DeclInfo {
 // ProcedureInfo stores the information needed for checking a procedure
 
 
-typedef struct ProcedureInfo {
+struct ProcedureInfo {
 	AstFile *             file;
 	Token                 token;
 	DeclInfo *            decl;
 	Type *                type; // Type_Procedure
 	AstNode *             body; // AstNode_BlockStmt
 	u32                   tags;
-} ProcedureInfo;
+};
 
 // ExprInfo stores information used for "untyped" expressions
-typedef struct ExprInfo {
+struct ExprInfo {
 	bool           is_lhs; // Debug info
 	AddressingMode mode;
 	Type *         type; // Type_Basic
 	ExactValue     value;
-} ExprInfo;
+};
 
 ExprInfo make_expr_info(bool is_lhs, AddressingMode mode, Type *type, ExactValue value) {
 	ExprInfo ei = {is_lhs, mode, type, value};
@@ -232,7 +231,7 @@ ExprInfo make_expr_info(bool is_lhs, AddressingMode mode, Type *type, ExactValue
 #define MAP_NAME MapEntity
 #include "map.cpp"
 
-typedef struct Scope {
+struct Scope {
 	Scope *          parent;
 	Scope *          prev, *next;
 	Scope *          first_child;
@@ -248,7 +247,7 @@ typedef struct Scope {
 	bool             is_init;
 	bool             has_been_imported; // This is only applicable to file scopes
 	AstFile *        file;
-} Scope;
+};
 gb_global Scope *universal_scope = NULL;
 
 
@@ -280,19 +279,19 @@ gb_global Scope *universal_scope = NULL;
 #define MAP_NAME MapExprInfo
 #include "map.cpp"
 
-typedef struct DelayedDecl {
+struct DelayedDecl {
 	Scope *  parent;
 	AstNode *decl;
-} DelayedDecl;
+};
 
-typedef struct CheckerFileNode {
+struct CheckerFileNode {
 	i32        id;
 	Array<i32> wheres;
 	Array<i32> whats;
 	i32        score; // Higher the score, the better
-} CheckerFileNode;
+};
 
-typedef struct CheckerContext {
+struct CheckerContext {
 	Scope *    file_scope;
 	Scope *    scope;
 	DeclInfo * decl;
@@ -301,10 +300,10 @@ typedef struct CheckerContext {
 	String     proc_name;
 	Type *     type_hint;
 	DeclInfo * curr_proc_decl;
-} CheckerContext;
+};
 
 // CheckerInfo stores all the symbol information for a type-checked program
-typedef struct CheckerInfo {
+struct CheckerInfo {
 	MapTypeAndValue      types;           // Key: AstNode * | Expression -> Type (and value)
 	MapEntity            definitions;     // Key: AstNode * | Identifier -> Entity
 	MapEntity            uses;            // Key: AstNode * | Identifier -> Entity
@@ -316,9 +315,9 @@ typedef struct CheckerInfo {
 	MapAstFile           files;           // Key: String (full path)
 	MapIsize             type_info_map;   // Key: Type *
 	isize                type_info_count;
-} CheckerInfo;
+};
 
-typedef struct Checker {
+struct Checker {
 	Parser *    parser;
 	CheckerInfo info;
 
@@ -338,14 +337,14 @@ typedef struct Checker {
 
 	Array<Type *>          proc_stack;
 	bool                   done_preload;
-} Checker;
+};
 
 
-typedef struct DelayedEntity {
+struct DelayedEntity {
 	AstNode *   ident;
 	Entity *    entity;
 	DeclInfo *  decl;
-} DelayedEntity;
+};
 
 
 
@@ -1281,7 +1280,7 @@ void init_preload(Checker *c) {
 
 
 bool check_arity_match(Checker *c, AstNodeValueDecl *d);
-void check_collect_entities(Checker *c, AstNodeArray nodes, bool is_file_scope);
+void check_collect_entities(Checker *c, Array<AstNode *> nodes, bool is_file_scope);
 void check_collect_entities_from_when_stmt(Checker *c, AstNodeWhenStmt *ws, bool is_file_scope);
 
 bool check_is_entity_overloaded(Entity *e) {
@@ -1455,7 +1454,7 @@ void check_collect_entities_from_when_stmt(Checker *c, AstNodeWhenStmt *ws, bool
 }
 
 // NOTE(bill): If file_scopes == NULL, this will act like a local scope
-void check_collect_entities(Checker *c, AstNodeArray nodes, bool is_file_scope) {
+void check_collect_entities(Checker *c, Array<AstNode *> nodes, bool is_file_scope) {
 	// NOTE(bill): File scope and local scope are different kinds of scopes
 	if (is_file_scope) {
 		GB_ASSERT(c->context.scope->is_file);

+ 0 - 2
src/common.cpp

@@ -43,8 +43,6 @@ gbAllocator scratch_allocator(void) {
 	return gb_scratch_allocator(&scratch_memory);
 }
 
-typedef struct DynamicArenaBlock DynamicArenaBlock;
-typedef struct DynamicArena      DynamicArena;
 
 struct DynamicArenaBlock {
 	DynamicArenaBlock *prev;

+ 12 - 13
src/entity.cpp

@@ -1,7 +1,7 @@
-typedef struct Scope    Scope;
-typedef struct Checker  Checker;
-typedef struct Type     Type;
-typedef struct DeclInfo DeclInfo;
+struct Scope;
+struct Checker;
+struct Type;
+struct DeclInfo;
 // typedef enum BuiltinProcId BuiltinProcId;
 
 
@@ -19,12 +19,12 @@ typedef struct DeclInfo DeclInfo;
 	ENTITY_KIND(Nil) \
 	ENTITY_KIND(Label)
 
-typedef enum EntityKind {
+enum EntityKind {
 #define ENTITY_KIND(k) GB_JOIN2(Entity_, k),
 	ENTITY_KINDS
 #undef ENTITY_KIND
 	Entity_Count,
-} EntityKind;
+};
 
 String const entity_strings[] = {
 #define ENTITY_KIND(k) {cast(u8 *)#k, gb_size_of(#k)-1},
@@ -32,7 +32,7 @@ String const entity_strings[] = {
 #undef ENTITY_KIND
 };
 
-typedef enum EntityFlag {
+enum EntityFlag {
 	EntityFlag_Visited       = 1<<0,
 	EntityFlag_Used          = 1<<1,
 	EntityFlag_Using         = 1<<2,
@@ -45,24 +45,23 @@ typedef enum EntityFlag {
 	EntityFlag_Value         = 1<<9,
 	EntityFlag_Sret          = 1<<10,
 	EntityFlag_BitFieldValue = 1<<11,
-} EntityFlag;
+};
 
 // Zero value means the overloading process is not yet done
-typedef enum OverloadKind {
+enum OverloadKind {
 	Overload_Unknown,
 	Overload_No,
 	Overload_Yes,
-} OverloadKind;
+};
 
-typedef	enum EntityAliasKind {
+enum EntityAliasKind {
 	EntityAlias_Invalid,
 	EntityAlias_Type,
 	EntityAlias_Entity,
-} EntityAliasKind;
+};
 
 
 // An Entity is a named "thing" in the language
-typedef struct Entity Entity;
 struct Entity {
 	EntityKind kind;
 	u64        id;

+ 7 - 7
src/exact_value.cpp

@@ -3,13 +3,13 @@
 // TODO(bill): Big numbers
 // IMPORTANT TODO(bill): This needs to be completely fixed!!!!!!!!
 
-typedef struct AstNode AstNode;
+struct AstNode;
 
-typedef struct Complex128 {
+struct Complex128 {
 	f64 real, imag;
-} Complex128;
+};
 
-typedef enum ExactValueKind {
+enum ExactValueKind {
 	ExactValue_Invalid,
 
 	ExactValue_Bool,
@@ -21,9 +21,9 @@ typedef enum ExactValueKind {
 	ExactValue_Compound, // TODO(bill): Is this good enough?
 
 	ExactValue_Count,
-} ExactValueKind;
+};
 
-typedef struct ExactValue {
+struct ExactValue {
 	ExactValueKind kind;
 	union {
 		bool          value_bool;
@@ -34,7 +34,7 @@ typedef struct ExactValue {
 		Complex128    value_complex;
 		AstNode *     value_compound;
 	};
-} ExactValue;
+};
 
 gb_global ExactValue const empty_exact_value = {};
 

+ 73 - 79
src/ir.cpp

@@ -1,9 +1,7 @@
-typedef struct irProcedure irProcedure;
-typedef struct irBlock irBlock;
-typedef struct irValue irValue;
-typedef struct irDebugInfo irDebugInfo;
-
-typedef Array<irValue *> irValueArray;
+struct irProcedure;
+struct irBlock;
+struct irValue;
+struct irDebugInfo;
 
 #define MAP_TYPE irValue *
 #define MAP_PROC map_ir_value_
@@ -16,7 +14,7 @@ typedef Array<irValue *> irValueArray;
 #include "map.cpp"
 
 
-typedef struct irModule {
+struct irModule {
 	CheckerInfo * info;
 	gbArena       arena;
 	gbArena       tmp_arena;
@@ -42,20 +40,20 @@ typedef struct irModule {
 	Entity *              entry_point_entity;
 
 	Array<irProcedure *>  procs;             // NOTE(bill): All procedures with bodies
-	irValueArray          procs_to_generate; // NOTE(bill): Procedures to generate
+	Array<irValue *>      procs_to_generate; // NOTE(bill): Procedures to generate
 
 	Array<String>         foreign_library_paths; // Only the ones that were used
-} irModule;
+};
 
 // NOTE(bill): For more info, see https://en.wikipedia.org/wiki/Dominator_(graph_theory)
-typedef struct irDomNode {
+struct irDomNode {
 	irBlock *        idom; // Parent (Immediate Dominator)
 	Array<irBlock *> children;
 	i32              pre, post; // Ordering in tree
-} irDomNode;
+};
 
 
-typedef struct irBlock {
+struct irBlock {
 	i32          index;
 	String       label;
 	irProcedure *parent;
@@ -65,14 +63,13 @@ typedef struct irBlock {
 	irDomNode    dom;
 	i32          gaps;
 
-	irValueArray instrs;
-	irValueArray locals;
+	Array<irValue *> instrs;
+	Array<irValue *> locals;
 
 	Array<irBlock *> preds;
 	Array<irBlock *> succs;
-} irBlock;
+};
 
-typedef struct irTargetList irTargetList;
 struct irTargetList {
 	irTargetList *prev;
 	irBlock *     break_;
@@ -80,17 +77,17 @@ struct irTargetList {
 	irBlock *     fallthrough_;
 };
 
-typedef enum irDeferExitKind {
+enum irDeferExitKind {
 	irDeferExit_Default,
 	irDeferExit_Return,
 	irDeferExit_Branch,
-} irDeferExitKind;
-typedef enum irDeferKind {
+};
+enum irDeferKind {
 	irDefer_Node,
 	irDefer_Instr,
-} irDeferKind;
+};
 
-typedef struct irDefer {
+struct irDefer {
 	irDeferKind kind;
 	isize       scope_index;
 	irBlock *   block;
@@ -99,14 +96,14 @@ typedef struct irDefer {
 		// NOTE(bill): `instr` will be copied every time to create a new one
 		irValue *instr;
 	};
-} irDefer;
+};
 
 
-typedef struct irBranchBlocks {
+struct irBranchBlocks {
 	AstNode *label;
 	irBlock *break_;
 	irBlock *continue_;
-} irBranchBlocks;
+};
 
 
 struct irProcedure {
@@ -122,7 +119,7 @@ struct irProcedure {
 	u64                   tags;
 
 	irValue *             return_ptr;
-	irValueArray          params;
+	Array<irValue *>      params;
 	Array<irDefer>        defer_stmts;
 	Array<irBlock *>      blocks;
 	i32                   scope_index;
@@ -130,7 +127,7 @@ struct irProcedure {
 	irBlock *             entry_block;
 	irBlock *             curr_block;
 	irTargetList *        target_list;
-	irValueArray          referrers;
+	Array<irValue *>      referrers;
 
 	Array<irBranchBlocks> branch_blocks;
 
@@ -153,7 +150,7 @@ struct irProcedure {
 		Entity *     entity;                                          \
 		Type *       type;                                            \
 		bool         zero_initialized;                                \
-		irValueArray referrers;                                       \
+		Array<irValue *> referrers;                                       \
 		i64          alignment;                                       \
 	})                                                                \
 	IR_INSTR_KIND(ZeroInit, struct { irValue *address; })             \
@@ -205,7 +202,7 @@ struct irProcedure {
 		irValue *true_value;                                          \
 		irValue *false_value;                                         \
 	})                                                                \
-	IR_INSTR_KIND(Phi, struct { irValueArray edges; Type *type; })    \
+	IR_INSTR_KIND(Phi, struct { Array<irValue *> edges; Type *type; })    \
 	IR_INSTR_KIND(Unreachable, i32)                                   \
 	IR_INSTR_KIND(UnaryOp, struct {                                   \
 		Type *    type;                                               \
@@ -261,12 +258,12 @@ struct irProcedure {
 	IR_CONV_KIND(inttoptr) \
 	IR_CONV_KIND(bitcast)
 
-typedef enum irInstrKind {
+enum irInstrKind {
 	irInstr_Invalid,
 #define IR_INSTR_KIND(x, ...) GB_JOIN2(irInstr_, x),
 	IR_INSTR_KINDS
 #undef IR_INSTR_KIND
-} irInstrKind;
+};
 
 String const ir_instr_strings[] = {
 	{cast(u8 *)"Invalid", gb_size_of("Invalid")-1},
@@ -275,12 +272,12 @@ String const ir_instr_strings[] = {
 #undef IR_INSTR_KIND
 };
 
-typedef enum irConvKind {
+enum irConvKind {
 	irConv_Invalid,
 #define IR_CONV_KIND(x) GB_JOIN2(irConv_, x),
 	IR_CONV_KINDS
 #undef IR_CONV_KIND
-} irConvKind;
+};
 
 String const ir_conv_strings[] = {
 	{cast(u8 *)"Invalid", gb_size_of("Invalid")-1},
@@ -293,7 +290,6 @@ String const ir_conv_strings[] = {
 	IR_INSTR_KINDS
 #undef IR_INSTR_KIND
 
-typedef struct irInstr irInstr;
 struct irInstr {
 	irInstrKind kind;
 
@@ -308,7 +304,7 @@ struct irInstr {
 };
 
 
-typedef enum irValueKind {
+enum irValueKind {
 	irValue_Invalid,
 
 	irValue_Constant,
@@ -323,58 +319,58 @@ typedef enum irValueKind {
 	irValue_Instr,
 
 	irValue_Count,
-} irValueKind;
+};
 
-typedef struct irValueConstant {
+struct irValueConstant {
 	Type *     type;
 	ExactValue value;
-} irValueConstant;
+};
 
-typedef struct irValueConstantSlice {
+struct irValueConstantSlice {
 	Type *    type;
 	irValue *backing_array;
 	i64       count;
-} irValueConstantSlice;
+};
 
-typedef struct irValueNil {
+struct irValueNil {
 	Type *type;
-} irValueNil;
+};
 
-typedef struct irValueTypeName {
+struct irValueTypeName {
 	Type * type;
 	String name;
-} irValueTypeName;
+};
 
-typedef struct irValueGlobal {
+struct irValueGlobal {
 	String        name;
 	Entity *      entity;
 	Type *        type;
 	irValue *     value;
-	irValueArray  referrers;
+	Array<irValue *>  referrers;
 	bool          is_constant;
 	bool          is_private;
 	bool          is_thread_local;
 	bool          is_foreign;
 	bool          is_unnamed_addr;
-} irValueGlobal;
+};
 
 
-typedef enum irParamPasskind {
+enum irParamPasskind {
 	irParamPass_Value,   // Pass by value
 	irParamPass_Pointer, // Pass as a pointer rather than by value
 	irParamPass_Integer, // Pass as an integer of the same size
-} irParamPasskind;
+};
 
-typedef struct irValueParam {
+struct irValueParam {
 	irParamPasskind kind;
 	irProcedure *   parent;
 	Entity *        entity;
 	Type *          type;
 	Type *          original_type;
-	irValueArray    referrers;
-} irValueParam;
+	Array<irValue *>    referrers;
+};
 
-typedef struct irValue {
+struct irValue {
 	irValueKind kind;
 	i32         index;
 	bool        index_set;
@@ -389,7 +385,7 @@ typedef struct irValue {
 		irBlock              Block;
 		irInstr              Instr;
 	};
-} irValue;
+};
 
 gb_global irValue *v_zero    = NULL;
 gb_global irValue *v_one     = NULL;
@@ -400,14 +396,14 @@ gb_global irValue *v_false   = NULL;
 gb_global irValue *v_true    = NULL;
 gb_global irValue *v_raw_nil = NULL;
 
-typedef enum irAddrKind {
+enum irAddrKind {
 	irAddr_Default,
 	// irAddr_Vector,
 	irAddr_Map,
 	irAddr_BitField,
-} irAddrKind;
+};
 
-typedef struct irAddr {
+struct irAddr {
 	irAddrKind kind;
 	irValue *  addr;
 	union {
@@ -423,7 +419,7 @@ typedef struct irAddr {
 	// union {
 		// struct { irValue *index; } Vector;
 	// };
-} irAddr;
+};
 
 irAddr ir_addr(irValue *addr) {
 	irAddr v = {irAddr_Default, addr};
@@ -444,7 +440,7 @@ irAddr ir_addr_bit_field(irValue *addr, isize bit_field_value_index) {
 	return v;
 }
 
-typedef enum irDebugEncoding {
+enum irDebugEncoding {
 	irDebugBasicEncoding_Invalid       = 0,
 
 	irDebugBasicEncoding_address       = 1,
@@ -464,9 +460,9 @@ typedef enum irDebugEncoding {
 	irDebugBasicEncoding_structure_type   = 19,
 	irDebugBasicEncoding_union_type       = 23,
 
-} irDebugEncoding;
+};
 
-typedef enum irDebugInfoKind {
+enum irDebugInfoKind {
 	irDebugInfo_Invalid,
 
 	irDebugInfo_CompileUnit,
@@ -485,9 +481,8 @@ typedef enum irDebugInfoKind {
 
 
 	irDebugInfo_Count,
-} irDebugInfoKind;
+};
 
-typedef struct irDebugInfo irDebugInfo;
 struct irDebugInfo {
 	irDebugInfoKind kind;
 	i32 id;
@@ -569,14 +564,13 @@ struct irDebugInfo {
 };
 
 
-
-typedef struct irGen {
+struct irGen {
 	irModule module;
 	gbFile   output_file;
 	bool     opt_called;
 	String   output_base;
 	String   output_name;
-} irGen;
+};
 
 
 
@@ -698,7 +692,7 @@ void ir_set_instr_parent(irValue *instr, irBlock *parent) {
 	}
 }
 
-irValueArray *ir_value_referrers(irValue *v) {
+Array<irValue *> *ir_value_referrers(irValue *v) {
 	switch (v->kind) {
 	case irValue_Global:
 		return &v->Global.referrers;
@@ -969,7 +963,7 @@ irValue *ir_instr_if(irProcedure *p, irValue *cond, irBlock *true_block, irBlock
 }
 
 
-irValue *ir_instr_phi(irProcedure *p, irValueArray edges, Type *type) {
+irValue *ir_instr_phi(irProcedure *p, Array<irValue *> edges, Type *type) {
 	irValue *v = ir_alloc_instr(p, irInstr_Phi);
 	irInstr *i = &v->Instr;
 	i->Phi.edges = edges;
@@ -3387,7 +3381,7 @@ irValue *ir_emit_logical_binary_expr(irProcedure *proc, AstNode *expr) {
 		return ir_build_expr(proc, be->right);
 	}
 
-	irValueArray edges = {};
+	Array<irValue *> edges = {};
 	array_init(&edges, proc->module->allocator, done->preds.count+1);
 	for_array(i, done->preds) {
 		array_add(&edges, short_circuit);
@@ -3613,7 +3607,7 @@ irValue *ir_find_global_variable(irProcedure *proc, String name) {
 	return *value;
 }
 
-void ir_build_stmt_list(irProcedure *proc, AstNodeArray stmts);
+void ir_build_stmt_list(irProcedure *proc, Array<AstNode *> stmts);
 
 
 bool is_double_pointer(Type *t) {
@@ -3712,7 +3706,7 @@ irValue *ir_build_expr(irProcedure *proc, AstNode *expr) {
 	case_ast_node(te, TernaryExpr, expr);
 		ir_emit_comment(proc, str_lit("TernaryExpr"));
 
-		irValueArray edges = {};
+		Array<irValue *> edges = {};
 		array_init(&edges, proc->module->allocator, 2);
 
 		GB_ASSERT(te->y != NULL);
@@ -3752,7 +3746,7 @@ irValue *ir_build_expr(irProcedure *proc, AstNode *expr) {
 			ir_build_stmt(proc, ie->init);
 		}
 
-		irValueArray edges = {};
+		Array<irValue *> edges = {};
 		array_init(&edges, proc->module->allocator, 2);
 
 		GB_ASSERT(ie->else_expr != NULL);
@@ -5450,7 +5444,7 @@ irValue *ir_build_cond(irProcedure *proc, AstNode *cond, irBlock *true_block, ir
 
 
 
-void ir_build_stmt_list(irProcedure *proc, AstNodeArray stmts) {
+void ir_build_stmt_list(irProcedure *proc, Array<AstNode *> stmts) {
 	for_array(i, stmts) {
 		ir_build_stmt(proc, stmts[i]);
 	}
@@ -5787,7 +5781,7 @@ void ir_build_stmt_internal(irProcedure *proc, AstNode *node) {
 				}
 			} else { // Tuple(s)
 				Array<irAddr> lvals = {};
-				irValueArray  inits = {};
+				Array<irValue *>  inits = {};
 				array_init(&lvals, m->tmp_allocator, vd->names.count);
 				array_init(&inits, m->tmp_allocator, vd->names.count);
 
@@ -5943,7 +5937,7 @@ void ir_build_stmt_internal(irProcedure *proc, AstNode *node) {
 					irValue *init = ir_build_expr(proc, rhs);
 					ir_addr_store(proc, lvals[0], init);
 				} else {
-					irValueArray inits;
+					Array<irValue *> inits;
 					array_init(&inits, m->tmp_allocator, lvals.count);
 
 					for_array(i, as->rhs) {
@@ -5956,7 +5950,7 @@ void ir_build_stmt_internal(irProcedure *proc, AstNode *node) {
 					}
 				}
 			} else {
-				irValueArray inits;
+				Array<irValue *> inits;
 				array_init(&inits, m->tmp_allocator, lvals.count);
 
 				for_array(i, as->rhs) {
@@ -6029,7 +6023,7 @@ void ir_build_stmt_internal(irProcedure *proc, AstNode *node) {
 		} else {
 			gbTempArenaMemory tmp = gb_temp_arena_memory_begin(&proc->module->tmp_arena);
 
-			irValueArray results;
+			Array<irValue *> results;
 			array_init(&results, proc->module->tmp_allocator, return_count);
 
 			for_array(res_index, rs->results) {
@@ -6338,7 +6332,7 @@ void ir_build_stmt_internal(irProcedure *proc, AstNode *node) {
 
 		ast_node(body, BlockStmt, ms->body);
 
-		AstNodeArray default_stmts = {};
+		Array<AstNode *> default_stmts = {};
 		irBlock *default_fall = NULL;
 		irBlock *default_block = NULL;
 
@@ -7116,10 +7110,10 @@ void ir_gen_tree(irGen *s) {
 		}
 	}
 
-	typedef struct irGlobalVariable {
+	struct irGlobalVariable {
 		irValue *var, *init;
 		DeclInfo *decl;
-	} irGlobalVariable;
+	};
 	Array<irGlobalVariable> global_variables;
 	array_init(&global_variables, m->tmp_allocator, global_variable_max_count);
 

+ 6 - 6
src/ir_opt.cpp

@@ -1,6 +1,6 @@
 // Optimizations for the IR code
 
-void ir_opt_add_operands(irValueArray *ops, irInstr *i) {
+void ir_opt_add_operands(Array<irValue *> *ops, irInstr *i) {
 	switch (i->kind) {
 	case irInstr_Comment:
 		break;
@@ -126,8 +126,8 @@ bool ir_opt_block_has_phi(irBlock *b) {
 
 
 
-irValueArray ir_get_block_phi_nodes(irBlock *b) {
-	irValueArray phis = {0};
+Array<irValue *> ir_get_block_phi_nodes(irBlock *b) {
+	Array<irValue *> phis = {0};
 	for_array(i, b->instrs) {
 		irInstr *instr = &b->instrs[i]->Instr;
 		if (instr->kind != irInstr_Phi) {
@@ -140,7 +140,7 @@ irValueArray ir_get_block_phi_nodes(irBlock *b) {
 }
 
 void ir_remove_pred(irBlock *b, irBlock *p) {
-	irValueArray phis = ir_get_block_phi_nodes(b);
+	Array<irValue *> phis = ir_get_block_phi_nodes(b);
 	isize i = 0;
 	for_array(j, b->preds) {
 		irBlock *pred = b->preds[j];
@@ -273,7 +273,7 @@ void ir_opt_blocks(irProcedure *proc) {
 void ir_opt_build_referrers(irProcedure *proc) {
 	gbTempArenaMemory tmp = gb_temp_arena_memory_begin(&proc->module->tmp_arena);
 
-	irValueArray ops = {0}; // NOTE(bill): Act as a buffer
+	Array<irValue *> ops = {0}; // NOTE(bill): Act as a buffer
 	array_init(&ops, proc->module->tmp_allocator, 64); // HACK(bill): This _could_ overflow the temp arena
 	for_array(i, proc->blocks) {
 		irBlock *b = proc->blocks[i];
@@ -286,7 +286,7 @@ void ir_opt_build_referrers(irProcedure *proc) {
 				if (op == NULL) {
 					continue;
 				}
-				irValueArray *refs = ir_value_referrers(op);
+				Array<irValue *> *refs = ir_value_referrers(op);
 				if (refs != NULL) {
 					array_add(refs, instr);
 				}

+ 2 - 2
src/ir_print.cpp

@@ -1,8 +1,8 @@
-typedef struct irFileBuffer {
+struct irFileBuffer {
 	gbVirtualMemory vm;
 	isize           offset;
 	gbFile *        output;
-} irFileBuffer;
+};
 
 void ir_file_buffer_init(irFileBuffer *f, gbFile *output) {
 	isize size = 8*gb_virtual_memory_page_size(NULL);

+ 118 - 119
src/parser.cpp

@@ -1,8 +1,8 @@
-typedef struct AstNode AstNode;
-typedef struct Scope Scope;
-typedef struct DeclInfo DeclInfo;
+struct AstNode;
+struct Scope;
+struct DeclInfo;
 
-typedef enum ParseFileError {
+enum ParseFileError {
 	ParseFile_None,
 
 	ParseFile_WrongExtension,
@@ -13,11 +13,10 @@ typedef enum ParseFileError {
 	ParseFile_InvalidToken,
 
 	ParseFile_Count,
-} ParseFileError;
+};
 
-typedef Array<AstNode *> AstNodeArray;
 
-typedef struct AstFile {
+struct AstFile {
 	i32            id;
 	gbArena        arena;
 	Tokenizer      tokenizer;
@@ -32,8 +31,8 @@ typedef struct AstFile {
 	isize          expr_level;
 	bool           allow_range; // NOTE(bill): Ranges are only allowed in certain cases
 
-	AstNodeArray   decls;
-	bool           is_global_scope;
+	Array<AstNode *> decls;
+	bool             is_global_scope;
 
 	AstNode *      curr_proc;
 	isize          scope_level;
@@ -44,15 +43,15 @@ typedef struct AstFile {
 #define PARSER_MAX_FIX_COUNT 6
 	isize    fix_count;
 	TokenPos fix_prev_pos;
-} AstFile;
+};
 
-typedef struct ImportedFile {
+struct ImportedFile {
 	String   path;
 	String   rel_path;
 	TokenPos pos; // #import
-} ImportedFile;
+};
 
-typedef struct Parser {
+struct Parser {
 	String              init_fullpath;
 	Array<AstFile>      files;
 	Array<ImportedFile> imports;
@@ -60,9 +59,9 @@ typedef struct Parser {
 	isize               total_token_count;
 	isize               total_line_count;
 	gbMutex             mutex;
-} Parser;
+};
 
-typedef enum ProcTag {
+enum ProcTag {
 	ProcTag_bounds_check    = 1<<0,
 	ProcTag_no_bounds_check = 1<<1,
 
@@ -75,47 +74,47 @@ typedef enum ProcTag {
 	ProcTag_no_inline       = 1<<14,
 	// ProcTag_dll_import      = 1<<15,
 	// ProcTag_dll_export      = 1<<16,
-} ProcTag;
+};
 
-typedef enum ProcCallingConvention {
+enum ProcCallingConvention {
 	ProcCC_Odin = 0,
 	ProcCC_C    = 1,
 	ProcCC_Std  = 2,
 	ProcCC_Fast = 3,
 
 	ProcCC_Invalid,
-} ProcCallingConvention;
+};
 
-typedef enum VarDeclFlag {
+enum VarDeclFlag {
 	VarDeclFlag_using            = 1<<0,
 	VarDeclFlag_immutable        = 1<<1,
 	VarDeclFlag_thread_local     = 1<<2,
-} VarDeclFlag;
+};
 
-typedef enum StmtStateFlag {
+enum StmtStateFlag {
 	StmtStateFlag_bounds_check    = 1<<0,
 	StmtStateFlag_no_bounds_check = 1<<1,
-} StmtStateFlag;
+};
 
-typedef enum FieldFlag {
+enum FieldFlag {
 	FieldFlag_ellipsis  = 1<<0,
 	FieldFlag_using     = 1<<1,
 	FieldFlag_no_alias  = 1<<2,
 	FieldFlag_immutable = 1<<3,
 
 	FieldFlag_Signature = FieldFlag_ellipsis|FieldFlag_using|FieldFlag_no_alias|FieldFlag_immutable,
-} FieldListTag;
+};
 
-typedef enum StmtAllowFlag {
+enum StmtAllowFlag {
 	StmtAllowFlag_None  = 0,
 	StmtAllowFlag_In    = 1<<0,
 	StmtAllowFlag_Label = 1<<1,
-} StmtAllowFlag;
+};
 
 
 
-AstNodeArray make_ast_node_array(AstFile *f) {
-	AstNodeArray a;
+Array<AstNode *> make_ast_node_array(AstFile *f) {
+	Array<AstNode *> a;
 	// array_init(&a, gb_arena_allocator(&f->arena));
 	array_init(&a, heap_allocator());
 	return a;
@@ -147,7 +146,7 @@ AstNodeArray make_ast_node_array(AstFile *f) {
 	}) \
 	AST_NODE_KIND(CompoundLit, "compound literal", struct { \
 		AstNode *type; \
-		AstNodeArray elems; \
+		Array<AstNode *> elems; \
 		Token open, close; \
 	}) \
 	AST_NODE_KIND(Alias, "alias", struct { \
@@ -174,7 +173,7 @@ AST_NODE_KIND(_ExprBegin,  "",  i32) \
 	}) \
 	AST_NODE_KIND(CallExpr,     "call expression", struct { \
 		AstNode *    proc; \
-		AstNodeArray args; \
+		Array<AstNode *> args; \
 		Token        open; \
 		Token        close; \
 		Token        ellipsis; \
@@ -182,7 +181,7 @@ AST_NODE_KIND(_ExprBegin,  "",  i32) \
 	AST_NODE_KIND(MacroCallExpr, "macro call expression", struct { \
 		AstNode *    macro; \
 		Token        bang; \
-		AstNodeArray args; \
+		Array<AstNode *> args; \
 		Token        open; \
 		Token        close; \
 	}) \
@@ -201,7 +200,7 @@ AST_NODE_KIND(_StmtBegin,     "", i32) \
 	}) \
 	AST_NODE_KIND(AssignStmt, "assign statement", struct { \
 		Token op; \
-		AstNodeArray lhs, rhs; \
+		Array<AstNode *> lhs, rhs; \
 	}) \
 	AST_NODE_KIND(IncDecStmt, "increment decrement statement", struct { \
 		Token op; \
@@ -209,7 +208,7 @@ AST_NODE_KIND(_StmtBegin,     "", i32) \
 	}) \
 AST_NODE_KIND(_ComplexStmtBegin, "", i32) \
 	AST_NODE_KIND(BlockStmt, "block statement", struct { \
-		AstNodeArray stmts; \
+		Array<AstNode *> stmts; \
 		Token open, close; \
 	}) \
 	AST_NODE_KIND(IfStmt, "if statement", struct { \
@@ -227,7 +226,7 @@ AST_NODE_KIND(_ComplexStmtBegin, "", i32) \
 	}) \
 	AST_NODE_KIND(ReturnStmt, "return statement", struct { \
 		Token token; \
-		AstNodeArray results; \
+		Array<AstNode *> results; \
 	}) \
 	AST_NODE_KIND(ForStmt, "for statement", struct { \
 		Token    token; \
@@ -248,8 +247,8 @@ AST_NODE_KIND(_ComplexStmtBegin, "", i32) \
 	}) \
 	AST_NODE_KIND(CaseClause, "case clause", struct { \
 		Token token;        \
-		AstNodeArray list;  \
-		AstNodeArray stmts; \
+		Array<AstNode *> list;  \
+		Array<AstNode *> stmts; \
 	}) \
 	AST_NODE_KIND(MatchStmt, "match statement", struct { \
 		Token token;   \
@@ -268,7 +267,7 @@ AST_NODE_KIND(_ComplexStmtBegin, "", i32) \
 	AST_NODE_KIND(BranchStmt, "branch statement", struct { Token token; AstNode *label; }) \
 	AST_NODE_KIND(UsingStmt,  "using statement",  struct { \
 		Token token;   \
-		AstNodeArray list; \
+		Array<AstNode *> list; \
 	}) \
 	AST_NODE_KIND(AsmOperand, "assembly operand", struct { \
 		Token string;     \
@@ -300,9 +299,9 @@ AST_NODE_KIND(_DeclBegin,      "", i32) \
 	AST_NODE_KIND(BadDecl,     "bad declaration",     struct { Token begin, end; }) \
 	AST_NODE_KIND(ValueDecl, "value declaration", struct { \
 		bool         is_var; \
-		AstNodeArray names;  \
+		Array<AstNode *> names;  \
 		AstNode *    type;   \
-		AstNodeArray values; \
+		Array<AstNode *> values; \
 		u32          flags;  \
 	}) \
 	AST_NODE_KIND(ImportDecl, "import declaration", struct { \
@@ -327,13 +326,13 @@ AST_NODE_KIND(_DeclBegin,      "", i32) \
 	}) \
 AST_NODE_KIND(_DeclEnd,   "", i32) \
 	AST_NODE_KIND(Field, "field", struct { \
-		AstNodeArray names;    \
+		Array<AstNode *> names;    \
 		AstNode *    type;     \
 		u32          flags;    \
 	}) \
 	AST_NODE_KIND(FieldList, "field list", struct { \
 		Token token; \
-		AstNodeArray list; \
+		Array<AstNode *> list; \
 	}) \
 	AST_NODE_KIND(UnionField, "union field", struct { \
 		AstNode *name; \
@@ -375,7 +374,7 @@ AST_NODE_KIND(_TypeBegin, "", i32) \
 	}) \
 	AST_NODE_KIND(StructType, "struct type", struct { \
 		Token token; \
-		AstNodeArray fields; \
+		Array<AstNode *> fields; \
 		isize field_count; \
 		bool is_packed; \
 		bool is_ordered; \
@@ -383,23 +382,23 @@ AST_NODE_KIND(_TypeBegin, "", i32) \
 	}) \
 	AST_NODE_KIND(UnionType, "union type", struct { \
 		Token        token; \
-		AstNodeArray fields; \
+		Array<AstNode *> fields; \
 		isize        field_count; \
-		AstNodeArray variants; \
+		Array<AstNode *> variants; \
 	}) \
 	AST_NODE_KIND(RawUnionType, "raw union type", struct { \
 		Token token; \
-		AstNodeArray fields; \
+		Array<AstNode *> fields; \
 		isize field_count; \
 	}) \
 	AST_NODE_KIND(EnumType, "enum type", struct { \
 		Token token; \
 		AstNode *base_type; \
-		AstNodeArray fields; /* FieldValue */ \
+		Array<AstNode *> fields; /* FieldValue */ \
 	}) \
 	AST_NODE_KIND(BitFieldType, "bit field type", struct { \
 		Token token; \
-		AstNodeArray fields; /* FieldValue with : */ \
+		Array<AstNode *> fields; /* FieldValue with : */ \
 		AstNode *align; \
 	}) \
 	AST_NODE_KIND(MapType, "map type", struct { \
@@ -410,13 +409,13 @@ AST_NODE_KIND(_TypeBegin, "", i32) \
 	}) \
 AST_NODE_KIND(_TypeEnd,  "", i32)
 
-typedef enum AstNodeKind {
+enum AstNodeKind {
 	AstNode_Invalid,
 #define AST_NODE_KIND(_kind_name_, ...) GB_JOIN2(AstNode_, _kind_name_),
 	AST_NODE_KINDS
 #undef AST_NODE_KIND
 	AstNode_Count,
-} AstNodeKind;
+};
 
 String const ast_node_strings[] = {
 	{cast(u8 *)"invalid node", gb_size_of("invalid node")},
@@ -429,7 +428,7 @@ String const ast_node_strings[] = {
 	AST_NODE_KINDS
 #undef AST_NODE_KIND
 
-typedef struct AstNode {
+struct AstNode {
 	AstNodeKind kind;
 	u32 stmt_state_flags;
 	union {
@@ -437,7 +436,7 @@ typedef struct AstNode {
 	AST_NODE_KINDS
 #undef AST_NODE_KIND
 	};
-} AstNode;
+};
 
 
 #define ast_node(n_, Kind_, node_) GB_JOIN2(AstNode, Kind_) *n_ = &(node_)->Kind_; GB_ASSERT((node_)->kind == GB_JOIN2(AstNode_, Kind_))
@@ -560,8 +559,8 @@ Token ast_node_token(AstNode *node) {
 }
 
 AstNode *clone_ast_node(gbAllocator a, AstNode *node);
-AstNodeArray clone_ast_node_array(gbAllocator a, AstNodeArray array) {
-	AstNodeArray result = {};
+Array<AstNode *> clone_ast_node_array(gbAllocator a, Array<AstNode *> array) {
+	Array<AstNode *> result = {};
 	if (array.count > 0) {
 		array_init_count(&result, a, array.count);
 		for_array(i, array) {
@@ -933,7 +932,7 @@ AstNode *ast_paren_expr(AstFile *f, AstNode *expr, Token open, Token close) {
 	return result;
 }
 
-AstNode *ast_call_expr(AstFile *f, AstNode *proc, AstNodeArray args, Token open, Token close, Token ellipsis) {
+AstNode *ast_call_expr(AstFile *f, AstNode *proc, Array<AstNode *> args, Token open, Token close, Token ellipsis) {
 	AstNode *result = make_ast_node(f, AstNode_CallExpr);
 	result->CallExpr.proc     = proc;
 	result->CallExpr.args     = args;
@@ -943,7 +942,7 @@ AstNode *ast_call_expr(AstFile *f, AstNode *proc, AstNodeArray args, Token open,
 	return result;
 }
 
-AstNode *ast_macro_call_expr(AstFile *f, AstNode *macro, Token bang, AstNodeArray args, Token open, Token close) {
+AstNode *ast_macro_call_expr(AstFile *f, AstNode *macro, Token bang, Array<AstNode *> args, Token open, Token close) {
 	AstNode *result = make_ast_node(f, AstNode_MacroCallExpr);
 	result->MacroCallExpr.macro = macro;
 	result->MacroCallExpr.bang  = bang;
@@ -1048,7 +1047,7 @@ AstNode *ast_field_value(AstFile *f, AstNode *field, AstNode *value, Token eq) {
 	return result;
 }
 
-AstNode *ast_compound_lit(AstFile *f, AstNode *type, AstNodeArray elems, Token open, Token close) {
+AstNode *ast_compound_lit(AstFile *f, AstNode *type, Array<AstNode *> elems, Token open, Token close) {
 	AstNode *result = make_ast_node(f, AstNode_CompoundLit);
 	result->CompoundLit.type = type;
 	result->CompoundLit.elems = elems;
@@ -1101,7 +1100,7 @@ AstNode *ast_expr_stmt(AstFile *f, AstNode *expr) {
 	return result;
 }
 
-AstNode *ast_assign_stmt(AstFile *f, Token op, AstNodeArray lhs, AstNodeArray rhs) {
+AstNode *ast_assign_stmt(AstFile *f, Token op, Array<AstNode *> lhs, Array<AstNode *> rhs) {
 	AstNode *result = make_ast_node(f, AstNode_AssignStmt);
 	result->AssignStmt.op = op;
 	result->AssignStmt.lhs = lhs;
@@ -1119,7 +1118,7 @@ AstNode *ast_inc_dec_stmt(AstFile *f, Token op, AstNode *expr) {
 
 
 
-AstNode *ast_block_stmt(AstFile *f, AstNodeArray stmts, Token open, Token close) {
+AstNode *ast_block_stmt(AstFile *f, Array<AstNode *> stmts, Token open, Token close) {
 	AstNode *result = make_ast_node(f, AstNode_BlockStmt);
 	result->BlockStmt.stmts = stmts;
 	result->BlockStmt.open = open;
@@ -1147,7 +1146,7 @@ AstNode *ast_when_stmt(AstFile *f, Token token, AstNode *cond, AstNode *body, As
 }
 
 
-AstNode *ast_return_stmt(AstFile *f, Token token, AstNodeArray results) {
+AstNode *ast_return_stmt(AstFile *f, Token token, Array<AstNode *> results) {
 	AstNode *result = make_ast_node(f, AstNode_ReturnStmt);
 	result->ReturnStmt.token = token;
 	result->ReturnStmt.results = results;
@@ -1194,7 +1193,7 @@ AstNode *ast_type_match_stmt(AstFile *f, Token token, AstNode *tag, AstNode *bod
 	return result;
 }
 
-AstNode *ast_case_clause(AstFile *f, Token token, AstNodeArray list, AstNodeArray stmts) {
+AstNode *ast_case_clause(AstFile *f, Token token, Array<AstNode *> list, Array<AstNode *> stmts) {
 	AstNode *result = make_ast_node(f, AstNode_CaseClause);
 	result->CaseClause.token = token;
 	result->CaseClause.list  = list;
@@ -1217,7 +1216,7 @@ AstNode *ast_branch_stmt(AstFile *f, Token token, AstNode *label) {
 	return result;
 }
 
-AstNode *ast_using_stmt(AstFile *f, Token token, AstNodeArray list) {
+AstNode *ast_using_stmt(AstFile *f, Token token, Array<AstNode *> list) {
 	AstNode *result = make_ast_node(f, AstNode_UsingStmt);
 	result->UsingStmt.token = token;
 	result->UsingStmt.list  = list;
@@ -1277,7 +1276,7 @@ AstNode *ast_bad_decl(AstFile *f, Token begin, Token end) {
 	return result;
 }
 
-AstNode *ast_field(AstFile *f, AstNodeArray names, AstNode *type, u32 flags) {
+AstNode *ast_field(AstFile *f, Array<AstNode *> names, AstNode *type, u32 flags) {
 	AstNode *result = make_ast_node(f, AstNode_Field);
 	result->Field.names = names;
 	result->Field.type = type;
@@ -1285,7 +1284,7 @@ AstNode *ast_field(AstFile *f, AstNodeArray names, AstNode *type, u32 flags) {
 	return result;
 }
 
-AstNode *ast_field_list(AstFile *f, Token token, AstNodeArray list) {
+AstNode *ast_field_list(AstFile *f, Token token, Array<AstNode *> list) {
 	AstNode *result = make_ast_node(f, AstNode_FieldList);
 	result->FieldList.token = token;
 	result->FieldList.list  = list;
@@ -1354,7 +1353,7 @@ AstNode *ast_vector_type(AstFile *f, Token token, AstNode *count, AstNode *elem)
 	return result;
 }
 
-AstNode *ast_struct_type(AstFile *f, Token token, AstNodeArray fields, isize field_count,
+AstNode *ast_struct_type(AstFile *f, Token token, Array<AstNode *> fields, isize field_count,
                          bool is_packed, bool is_ordered, AstNode *align) {
 	AstNode *result = make_ast_node(f, AstNode_StructType);
 	result->StructType.token       = token;
@@ -1367,7 +1366,7 @@ AstNode *ast_struct_type(AstFile *f, Token token, AstNodeArray fields, isize fie
 }
 
 
-AstNode *ast_union_type(AstFile *f, Token token, AstNodeArray fields, isize field_count, AstNodeArray variants) {
+AstNode *ast_union_type(AstFile *f, Token token, Array<AstNode *> fields, isize field_count, Array<AstNode *> variants) {
 	AstNode *result = make_ast_node(f, AstNode_UnionType);
 	result->UnionType.token = token;
 	result->UnionType.fields = fields;
@@ -1376,7 +1375,7 @@ AstNode *ast_union_type(AstFile *f, Token token, AstNodeArray fields, isize fiel
 	return result;
 }
 
-AstNode *ast_raw_union_type(AstFile *f, Token token, AstNodeArray fields, isize field_count) {
+AstNode *ast_raw_union_type(AstFile *f, Token token, Array<AstNode *> fields, isize field_count) {
 	AstNode *result = make_ast_node(f, AstNode_RawUnionType);
 	result->RawUnionType.token = token;
 	result->RawUnionType.fields = fields;
@@ -1385,7 +1384,7 @@ AstNode *ast_raw_union_type(AstFile *f, Token token, AstNodeArray fields, isize
 }
 
 
-AstNode *ast_enum_type(AstFile *f, Token token, AstNode *base_type, AstNodeArray fields) {
+AstNode *ast_enum_type(AstFile *f, Token token, AstNode *base_type, Array<AstNode *> fields) {
 	AstNode *result = make_ast_node(f, AstNode_EnumType);
 	result->EnumType.token = token;
 	result->EnumType.base_type = base_type;
@@ -1393,7 +1392,7 @@ AstNode *ast_enum_type(AstFile *f, Token token, AstNode *base_type, AstNodeArray
 	return result;
 }
 
-AstNode *ast_bit_field_type(AstFile *f, Token token, AstNodeArray fields, AstNode *align) {
+AstNode *ast_bit_field_type(AstFile *f, Token token, Array<AstNode *> fields, AstNode *align) {
 	AstNode *result = make_ast_node(f, AstNode_BitFieldType);
 	result->BitFieldType.token = token;
 	result->BitFieldType.fields = fields;
@@ -1411,7 +1410,7 @@ AstNode *ast_map_type(AstFile *f, Token token, AstNode *count, AstNode *key, Ast
 }
 
 
-AstNode *ast_value_decl(AstFile *f, bool is_var, AstNodeArray names, AstNode *type, AstNodeArray values) {
+AstNode *ast_value_decl(AstFile *f, bool is_var, Array<AstNode *> names, AstNode *type, Array<AstNode *> values) {
 	AstNode *result = make_ast_node(f, AstNode_ValueDecl);
 	result->ValueDecl.is_var = is_var;
 	result->ValueDecl.names  = names;
@@ -1693,7 +1692,7 @@ void expect_semicolon(AstFile *f, AstNode *s) {
 
 AstNode *    parse_expr(AstFile *f, bool lhs);
 AstNode *    parse_proc_type(AstFile *f, AstNode **foreign_library, String *foreign_name, String *link_name);
-AstNodeArray parse_stmt_list(AstFile *f);
+Array<AstNode *> parse_stmt_list(AstFile *f);
 AstNode *    parse_stmt(AstFile *f);
 AstNode *    parse_body(AstFile *f);
 
@@ -1731,8 +1730,8 @@ AstNode *unparen_expr(AstNode *node) {
 
 AstNode *parse_value(AstFile *f);
 
-AstNodeArray parse_element_list(AstFile *f) {
-	AstNodeArray elems = make_ast_node_array(f);
+Array<AstNode *> parse_element_list(AstFile *f) {
+	Array<AstNode *> elems = make_ast_node_array(f);
 
 	while (f->curr_token.kind != Token_CloseBrace &&
 	       f->curr_token.kind != Token_EOF) {
@@ -1754,7 +1753,7 @@ AstNodeArray parse_element_list(AstFile *f) {
 }
 
 AstNode *parse_literal_value(AstFile *f, AstNode *type) {
-	AstNodeArray elems = {};
+	Array<AstNode *> elems = {};
 	Token open = expect_token(f, Token_OpenBrace);
 	f->expr_level++;
 	if (f->curr_token.kind != Token_CloseBrace) {
@@ -1946,8 +1945,8 @@ void parse_proc_tags(AstFile *f, u64 *tags, AstNode **foreign_library_token, Str
 }
 
 
-AstNodeArray parse_lhs_expr_list(AstFile *f);
-AstNodeArray parse_rhs_expr_list(AstFile *f);
+Array<AstNode *> parse_lhs_expr_list(AstFile *f);
+Array<AstNode *> parse_rhs_expr_list(AstFile *f);
 AstNode *    parse_simple_stmt  (AstFile *f, StmtAllowFlag flags);
 AstNode *    parse_type         (AstFile *f);
 
@@ -2109,7 +2108,7 @@ bool is_literal_type(AstNode *node) {
 }
 
 AstNode *parse_call_expr(AstFile *f, AstNode *operand) {
-	AstNodeArray args = make_ast_node_array(f);
+	Array<AstNode *> args = make_ast_node_array(f);
 	Token open_paren, close_paren;
 	Token ellipsis = {};
 
@@ -2144,7 +2143,7 @@ AstNode *parse_call_expr(AstFile *f, AstNode *operand) {
 
 
 AstNode *parse_macro_call_expr(AstFile *f, AstNode *operand) {
-	AstNodeArray args = make_ast_node_array(f);
+	Array<AstNode *> args = make_ast_node_array(f);
 	Token bang, open_paren, close_paren;
 
 	bang = expect_token(f, Token_Not);
@@ -2411,8 +2410,8 @@ AstNode *parse_expr(AstFile *f, bool lhs) {
 }
 
 
-AstNodeArray parse_expr_list(AstFile *f, bool lhs) {
-	AstNodeArray list = make_ast_node_array(f);
+Array<AstNode *> parse_expr_list(AstFile *f, bool lhs) {
+	Array<AstNode *> list = make_ast_node_array(f);
 	for (;;) {
 		AstNode *e = parse_expr(f, lhs);
 		array_add(&list, e);
@@ -2426,16 +2425,16 @@ AstNodeArray parse_expr_list(AstFile *f, bool lhs) {
 	return list;
 }
 
-AstNodeArray parse_lhs_expr_list(AstFile *f) {
+Array<AstNode *> parse_lhs_expr_list(AstFile *f) {
 	return parse_expr_list(f, true);
 }
 
-AstNodeArray parse_rhs_expr_list(AstFile *f) {
+Array<AstNode *> parse_rhs_expr_list(AstFile *f) {
 	return parse_expr_list(f, false);
 }
 
-AstNodeArray parse_ident_list(AstFile *f) {
-	AstNodeArray list = make_ast_node_array(f);
+Array<AstNode *> parse_ident_list(AstFile *f) {
+	Array<AstNode *> list = make_ast_node_array(f);
 
 	do {
 		array_add(&list, parse_ident(f));
@@ -2470,9 +2469,9 @@ AstNode *parse_type(AstFile *f) {
 }
 
 
-AstNode *parse_value_decl(AstFile *f, AstNodeArray lhs) {
+AstNode *parse_value_decl(AstFile *f, Array<AstNode *> lhs) {
 	AstNode *type = NULL;
-	AstNodeArray values = {};
+	Array<AstNode *> values = {};
 	bool is_mutable = true;
 
 	if (allow_token(f, Token_Colon)) {
@@ -2516,7 +2515,7 @@ AstNode *parse_value_decl(AstFile *f, AstNodeArray lhs) {
 		values = make_ast_node_array(f);
 	}
 
-	AstNodeArray specs = {};
+	Array<AstNode *> specs = {};
 	array_init(&specs, heap_allocator(), 1);
 	return ast_value_decl(f, is_mutable, lhs, type, values);
 }
@@ -2524,7 +2523,7 @@ AstNode *parse_value_decl(AstFile *f, AstNodeArray lhs) {
 
 
 AstNode *parse_simple_stmt(AstFile *f, StmtAllowFlag flags) {
-	AstNodeArray lhs = parse_lhs_expr_list(f);
+	Array<AstNode *> lhs = parse_lhs_expr_list(f);
 	Token token = f->curr_token;
 	switch (token.kind) {
 	case Token_Eq:
@@ -2548,7 +2547,7 @@ AstNode *parse_simple_stmt(AstFile *f, StmtAllowFlag flags) {
 			return ast_bad_stmt(f, f->curr_token, f->curr_token);
 		}
 		next_token(f);
-		AstNodeArray rhs = parse_rhs_expr_list(f);
+		Array<AstNode *> rhs = parse_rhs_expr_list(f);
 		if (rhs.count == 0) {
 			syntax_error(token, "No right-hand side in assignment statement.");
 			return ast_bad_stmt(f, token, f->curr_token);
@@ -2564,7 +2563,7 @@ AstNode *parse_simple_stmt(AstFile *f, StmtAllowFlag flags) {
 			AstNode *expr = parse_expr(f, false);
 			f->allow_range = prev_allow_range;
 
-			AstNodeArray rhs = {};
+			Array<AstNode *> rhs = {};
 			array_init_count(&rhs, heap_allocator(), 1);
 			rhs[0] = expr;
 
@@ -2638,8 +2637,8 @@ AstNode *parse_results(AstFile *f) {
 
 	if (f->curr_token.kind != Token_OpenParen) {
 		Token begin_token = f->curr_token;
-		AstNodeArray empty_names = {};
-		AstNodeArray list = make_ast_node_array(f);
+		Array<AstNode *> empty_names = {};
+		Array<AstNode *> list = make_ast_node_array(f);
 		AstNode *type = parse_type(f);
 		array_add(&list, ast_field(f, empty_names, type, 0));
 		return ast_field_list(f, begin_token, list);
@@ -2698,13 +2697,13 @@ AstNode *parse_var_type(AstFile *f, bool allow_ellipsis) {
 }
 
 
-typedef enum FieldPrefixKind {
+enum FieldPrefixKind {
 	FieldPrefix_Invalid,
 
 	FieldPrefix_Using,
 	FieldPrefix_Immutable,
 	FieldPrefix_NoAlias,
-} FieldPrefixKind;
+};
 
 FieldPrefixKind is_token_field_prefix(AstFile *f) {
 	switch (f->curr_token.kind) {
@@ -2781,13 +2780,13 @@ u32 check_field_prefixes(AstFile *f, isize name_count, u32 allowed_flags, u32 se
 	return set_flags;
 }
 
-typedef struct AstNodeAndFlags {
+struct AstNodeAndFlags {
 	AstNode *node;
 	u32      flags;
-} AstNodeAndFlags;
+};
 
-AstNodeArray convert_to_ident_list(AstFile *f, Array<AstNodeAndFlags> list, bool ignore_flags) {
-	AstNodeArray idents = {};
+Array<AstNode *> convert_to_ident_list(AstFile *f, Array<AstNodeAndFlags> list, bool ignore_flags) {
+	Array<AstNode *> idents = {};
 	array_init(&idents, heap_allocator(), list.count);
 	// Convert to ident list
 	for_array(i, list) {
@@ -2831,7 +2830,7 @@ AstNode *parse_field_list(AstFile *f, isize *name_count_, u32 allowed_flags, Tok
 	TokenKind separator = Token_Comma;
 	Token start_token = f->curr_token;
 
-	AstNodeArray params = make_ast_node_array(f);
+	Array<AstNode *> params = make_ast_node_array(f);
 	Array<AstNodeAndFlags> list = {}; array_init(&list, heap_allocator()); // LEAK(bill):
 	isize total_name_count = 0;
 	bool allow_ellipsis = allowed_flags&FieldFlag_ellipsis;
@@ -2850,7 +2849,7 @@ AstNode *parse_field_list(AstFile *f, isize *name_count_, u32 allowed_flags, Tok
 	}
 
 	if (f->curr_token.kind == Token_Colon) {
-		AstNodeArray names = convert_to_ident_list(f, list, true); // Copy for semantic reasons
+		Array<AstNode *> names = convert_to_ident_list(f, list, true); // Copy for semantic reasons
 		if (names.count == 0) {
 			syntax_error(f->curr_token, "Empty field declaration");
 		}
@@ -2871,7 +2870,7 @@ AstNode *parse_field_list(AstFile *f, isize *name_count_, u32 allowed_flags, Tok
 		while (f->curr_token.kind != follow &&
 		       f->curr_token.kind != Token_EOF) {
 			u32 set_flags = parse_field_prefixes(f);
-			AstNodeArray names = parse_ident_list(f);
+			Array<AstNode *> names = parse_ident_list(f);
 			if (names.count == 0) {
 				syntax_error(f->curr_token, "Empty field declaration");
 				break;
@@ -2894,7 +2893,7 @@ AstNode *parse_field_list(AstFile *f, isize *name_count_, u32 allowed_flags, Tok
 	}
 
 	for_array(i, list) {
-		AstNodeArray names = {};
+		Array<AstNode *> names = {};
 		AstNode *type = list[i].node;
 		Token token = blank_token;
 
@@ -3052,7 +3051,7 @@ AstNode *parse_type_or_ident(AstFile *f) {
 		AstNode *fields = parse_record_fields(f, &decl_count, FieldFlag_using, str_lit("struct"));
 		Token close = expect_token(f, Token_CloseBrace);
 
-		AstNodeArray decls = {};
+		Array<AstNode *> decls = {};
 		if (fields != NULL) {
 			GB_ASSERT(fields->kind == AstNode_FieldList);
 			decls = fields->FieldList.list;
@@ -3064,15 +3063,15 @@ AstNode *parse_type_or_ident(AstFile *f) {
 	case Token_union: {
 		Token token = expect_token(f, Token_union);
 		Token open = expect_token_after(f, Token_OpenBrace, "union");
-		AstNodeArray decls    = make_ast_node_array(f);
-		AstNodeArray variants = make_ast_node_array(f);
+		Array<AstNode *> decls    = make_ast_node_array(f);
+		Array<AstNode *> variants = make_ast_node_array(f);
 		isize total_decl_name_count = 0;
 
 		while (f->curr_token.kind != Token_CloseBrace &&
 		       f->curr_token.kind != Token_EOF) {
 			u32 decl_flags = parse_field_prefixes(f);
 			if (decl_flags != 0) {
-				AstNodeArray names = parse_ident_list(f);
+				Array<AstNode *> names = parse_ident_list(f);
 				if (names.count == 0) {
 					syntax_error(f->curr_token, "Empty field declaration");
 				}
@@ -3082,7 +3081,7 @@ AstNode *parse_type_or_ident(AstFile *f) {
 				AstNode *type = parse_var_type(f, false);
 				array_add(&decls, ast_field(f, names, type, set_flags));
 			} else {
-				AstNodeArray names = parse_ident_list(f);
+				Array<AstNode *> names = parse_ident_list(f);
 				if (names.count == 0) {
 					break;
 				}
@@ -3121,7 +3120,7 @@ AstNode *parse_type_or_ident(AstFile *f) {
 		AstNode *fields = parse_record_fields(f, &decl_count, FieldFlag_using, str_lit("raw_union"));
 		Token close = expect_token(f, Token_CloseBrace);
 
-		AstNodeArray decls = {};
+		Array<AstNode *> decls = {};
 		if (fields != NULL) {
 			GB_ASSERT(fields->kind == AstNode_FieldList);
 			decls = fields->FieldList.list;
@@ -3138,7 +3137,7 @@ AstNode *parse_type_or_ident(AstFile *f) {
 		}
 		Token open = expect_token(f, Token_OpenBrace);
 
-		AstNodeArray values = parse_element_list(f);
+		Array<AstNode *> values = parse_element_list(f);
 		Token close = expect_token(f, Token_CloseBrace);
 
 		return ast_enum_type(f, token, base_type, values);
@@ -3146,7 +3145,7 @@ AstNode *parse_type_or_ident(AstFile *f) {
 
 	case Token_bit_field: {
 		Token token = expect_token(f, Token_bit_field);
-		AstNodeArray fields = make_ast_node_array(f);
+		Array<AstNode *> fields = make_ast_node_array(f);
 		AstNode *align = NULL;
 		Token open, close;
 
@@ -3212,7 +3211,7 @@ AstNode *parse_type_or_ident(AstFile *f) {
 
 
 AstNode *parse_body(AstFile *f) {
-	AstNodeArray stmts = {};
+	Array<AstNode *> stmts = {};
 	Token open, close;
 	isize prev_expr_level = f->expr_level;
 
@@ -3328,7 +3327,7 @@ AstNode *parse_return_stmt(AstFile *f) {
 	}
 
 	Token token = expect_token(f, Token_return);
-	AstNodeArray results;
+	Array<AstNode *> results;
 	if (f->curr_token.kind != Token_Semicolon && f->curr_token.kind != Token_CloseBrace) {
 		results = parse_rhs_expr_list(f);
 	} else {
@@ -3355,7 +3354,7 @@ AstNode *parse_return_stmt(AstFile *f) {
 // 	}
 
 // 	Token token = expect_token(f, Token_give);
-// 	AstNodeArray results;
+// 	Array<AstNode *> results;
 // 	if (f->curr_token.kind != Token_Semicolon && f->curr_token.kind != Token_CloseBrace) {
 // 		results = parse_rhs_expr_list(f);
 // 	} else {
@@ -3440,7 +3439,7 @@ AstNode *parse_for_stmt(AstFile *f) {
 
 AstNode *parse_case_clause(AstFile *f, bool is_type) {
 	Token token = f->curr_token;
-	AstNodeArray list = make_ast_node_array(f);
+	Array<AstNode *> list = make_ast_node_array(f);
 	expect_token(f, Token_case);
 	bool prev_allow_range = f->allow_range;
 	f->allow_range = !is_type;
@@ -3449,7 +3448,7 @@ AstNode *parse_case_clause(AstFile *f, bool is_type) {
 	}
 	f->allow_range = prev_allow_range;
 	expect_token(f, Token_Colon); // TODO(bill): Is this the best syntax?
-	AstNodeArray stmts = parse_stmt_list(f);
+	Array<AstNode *> stmts = parse_stmt_list(f);
 
 	return ast_case_clause(f, token, list, stmts);
 }
@@ -3467,7 +3466,7 @@ AstNode *parse_match_stmt(AstFile *f) {
 	AstNode *body = NULL;
 	Token open, close;
 	bool is_type_match = false;
-	AstNodeArray list = make_ast_node_array(f);
+	Array<AstNode *> list = make_ast_node_array(f);
 
 	if (f->curr_token.kind != Token_OpenBrace) {
 		isize prev_level = f->expr_level;
@@ -3607,7 +3606,7 @@ AstNode *parse_stmt(AstFile *f) {
 	case Token_using: {
 		// TODO(bill): Make using statements better
 		Token token = expect_token(f, Token_using);
-		AstNodeArray list = parse_lhs_expr_list(f);
+		Array<AstNode *> list = parse_lhs_expr_list(f);
 		if (list.count == 0) {
 			syntax_error(token, "Illegal use of `using` statement");
 			expect_semicolon(f, NULL);
@@ -3878,8 +3877,8 @@ AstNode *parse_stmt(AstFile *f) {
 	return ast_bad_stmt(f, token, f->curr_token);
 }
 
-AstNodeArray parse_stmt_list(AstFile *f) {
-	AstNodeArray list = make_ast_node_array(f);
+Array<AstNode *> parse_stmt_list(AstFile *f) {
+	Array<AstNode *> list = make_ast_node_array(f);
 
 	while (f->curr_token.kind != Token_case &&
 	       f->curr_token.kind != Token_CloseBrace &&
@@ -4042,7 +4041,7 @@ bool is_import_path_valid(String path) {
 	return false;
 }
 
-void parse_setup_file_decls(Parser *p, AstFile *f, String base_dir, AstNodeArray decls) {
+void parse_setup_file_decls(Parser *p, AstFile *f, String base_dir, Array<AstNode *> decls) {
 	for_array(i, decls) {
 		AstNode *node = decls[i];
 		if (!is_ast_node_decl(node) &&

+ 27 - 31
src/ssa.cpp

@@ -1,15 +1,15 @@
-typedef struct ssaModule           ssaModule;
-typedef struct ssaValue            ssaValue;
-typedef struct ssaValueArgs        ssaValueArgs;
-typedef struct ssaDefer            ssaDefer;
-typedef struct ssaBlock            ssaBlock;
-typedef struct ssaProc             ssaProc;
-typedef struct ssaEdge             ssaEdge;
-typedef struct ssaRegister         ssaRegister;
-typedef struct ssaTargetList       ssaTargetList;
-typedef enum   ssaBlockKind        ssaBlockKind;
-typedef enum   ssaBranchPrediction ssaBranchPrediction;
-typedef enum   ssaDeferExitKind    ssaDeferExitKind;
+struct ssaModule;
+struct ssaValue;
+struct ssaValueArgs;
+struct ssaDefer;
+struct ssaBlock;
+struct ssaProc;
+struct ssaEdge;
+struct ssaRegister;
+struct ssaTargetList;
+enum   ssaBlockKind;
+enum   ssaBranchPrediction;
+enum   ssaDeferExitKind;
 
 
 String ssa_mangle_name(ssaModule *m, String path, Entity *e);
@@ -19,8 +19,6 @@ String ssa_mangle_name(ssaModule *m, String path, Entity *e);
 #define MAP_NAME MapSsaValue
 #include "map.cpp"
 
-typedef Array<ssaValue *> ssaValueArray;
-
 #include "ssa_op.cpp"
 
 #define SSA_DEFAULT_VALUE_ARG_CAPACITY 8
@@ -76,10 +74,10 @@ enum ssaBranchPrediction {
 	ssaBranch_Unlikely = -1,
 };
 
-typedef enum ssaDeferKind {
+enum ssaDeferKind {
 	ssaDefer_Node,
 	ssaDefer_Instr,
-} ssaDeferKind;
+};
 
 struct ssaDefer {
 	ssaDeferKind     kind;
@@ -106,8 +104,6 @@ struct ssaEdge {
 	isize     index;
 };
 
-typedef Array<ssaEdge> ssaEdgeArray;
-
 struct ssaBlock {
 	i32                  id;   // Unique identifier but the pointer could be used too
 	ssaBlockKind         kind;
@@ -124,9 +120,9 @@ struct ssaBlock {
 	//  - BlockExit will be a memory control value
 	ssaValue *control;
 
-	ssaValueArray values;
-	ssaEdgeArray  preds;
-	ssaEdgeArray  succs;
+	Array<ssaValue *> values;
+	Array<ssaEdge>  preds;
+	Array<ssaEdge>  succs;
 };
 
 struct ssaTargetList {
@@ -182,18 +178,18 @@ struct ssaModule {
 	u32 stmt_state_flags;
 
 	Array<ssaProc *>  procs;
-	ssaValueArray     procs_to_generate;
+	Array<ssaValue *>     procs_to_generate;
 };
 
-typedef enum ssaAddrKind {
+enum ssaAddrKind {
 	ssaAddr_Default,
 	ssaAddr_Map,
-} ssaAddrKind;
+};
 
-typedef struct ssaAddr {
+struct ssaAddr {
 	ssaValue *  addr;
 	ssaAddrKind kind;
-} ssaAddr;
+};
 
 
 
@@ -408,7 +404,7 @@ ssaValue *ssa_const_int(ssaProc *p, Type *t, i64 c) {
 ssaAddr   ssa_build_addr     (ssaProc *p, AstNode *expr);
 ssaValue *ssa_build_expr     (ssaProc *p, AstNode *expr);
 void      ssa_build_stmt     (ssaProc *p, AstNode *node);
-void      ssa_build_stmt_list(ssaProc *p, AstNodeArray nodes);
+void      ssa_build_stmt_list(ssaProc *p, Array<AstNode *> nodes);
 ssaValue *ssa_emit_deep_field_ptr_index(ssaProc *p, ssaValue *e, Selection sel);
 
 
@@ -1870,7 +1866,7 @@ ssaValue *ssa_build_expr(ssaProc *p, AstNode *expr) {
 
 
 
-void ssa_build_stmt_list(ssaProc *p, AstNodeArray nodes) {
+void ssa_build_stmt_list(ssaProc *p, Array<AstNode *> nodes) {
 	for_array(i, nodes) {
 		ssa_build_stmt(p, nodes[i]);
 	}
@@ -1989,7 +1985,7 @@ void ssa_build_stmt_internal(ssaProc *p, AstNode *node) {
 				}
 			} else {
 				Array<ssaAddr> lvals = {0};
-				ssaValueArray  inits = {0};
+				Array<ssaValue *>  inits = {0};
 				array_init(&lvals, m->tmp_allocator, vd->names.count);
 				array_init(&inits, m->tmp_allocator, vd->names.count);
 
@@ -2057,7 +2053,7 @@ void ssa_build_stmt_internal(ssaProc *p, AstNode *node) {
 					ssaValue *init = ssa_build_expr(p, rhs);
 					ssa_addr_store(p, lvals[0], init);
 				} else {
-					ssaValueArray inits;
+					Array<ssaValue *> inits;
 					array_init(&inits, m->tmp_allocator, lvals.count);
 
 					for_array(i, as->rhs) {
@@ -2070,7 +2066,7 @@ void ssa_build_stmt_internal(ssaProc *p, AstNode *node) {
 					}
 				}
 			} else {
-				ssaValueArray inits;
+				Array<ssaValue *> inits;
 				array_init(&inits, m->tmp_allocator, lvals.count);
 
 				for_array(i, as->rhs) {

+ 0 - 1
src/ssa_op.cpp

@@ -267,7 +267,6 @@ enum ssaOp {
 	SSA_OPS
 #undef SSA_OP
 };
-typedef enum ssaOp ssaOp;
 
 String const ssa_op_strings[] = {
 #define SSA_OP(k) {cast(u8 *)#k, gb_size_of(#k)-1},

+ 4 - 4
src/string.cpp

@@ -9,7 +9,7 @@ void init_string_buffer_memory(void) {
 
 
 // NOTE(bill): Used for UTF-8 strings
-typedef struct String {
+struct String {
 	u8 *  text;
 	isize len;
 
@@ -21,7 +21,7 @@ typedef struct String {
 		GB_ASSERT(0 <= i && i < len);
 		return text[i];
 	}
-} String;
+};
 // NOTE(bill): used for printf style arguments
 #define LIT(x) ((int)(x).len), (x).text
 #define STR_LIT(c_str) {cast(u8 *)c_str, gb_size_of(c_str)-1}
@@ -29,7 +29,7 @@ typedef struct String {
 
 
 // NOTE(bill): String16 is only used for Windows due to its file directories
-typedef struct String16 {
+struct String16 {
 	wchar_t *text;
 	isize    len;
 	wchar_t &operator[](isize i) {
@@ -40,7 +40,7 @@ typedef struct String16 {
 		GB_ASSERT(0 <= i && i < len);
 		return text[i];
 	}
-} String16;
+};
 
 
 gb_inline String make_string(u8 *text, isize len) {

+ 4 - 4
src/timings.cpp

@@ -1,14 +1,14 @@
-typedef struct TimeStamp {
+struct TimeStamp {
 	u64    start;
 	u64    finish;
 	String label;
-} TimeStamp;
+};
 
-typedef struct Timings {
+struct Timings {
 	TimeStamp        total;
 	Array<TimeStamp> sections;
 	u64              freq;
-} Timings;
+};
 
 
 #if defined(GB_SYSTEM_WINDOWS)

+ 14 - 14
src/tokenizer.cpp

@@ -117,11 +117,11 @@ TOKEN_KIND(Token__KeywordBegin, "_KeywordBegin"), \
 TOKEN_KIND(Token__KeywordEnd, "_KeywordEnd"), \
 	TOKEN_KIND(Token_Count, "")
 
-typedef enum TokenKind {
+enum TokenKind {
 #define TOKEN_KIND(e, s) e
 	TOKEN_KINDS
 #undef TOKEN_KIND
-} TokenKind;
+};
 
 String const token_strings[] = {
 #define TOKEN_KIND(e, s) {cast(u8 *)s, gb_size_of(s)-1}
@@ -130,11 +130,11 @@ String const token_strings[] = {
 };
 
 
-typedef struct TokenPos {
+struct TokenPos {
 	String file;
 	isize  line;
 	isize  column;
-} TokenPos;
+};
 
 i32 token_pos_cmp(TokenPos a, TokenPos b) {
 	if (a.line == b.line) {
@@ -152,11 +152,11 @@ bool token_pos_eq(TokenPos a, TokenPos b) {
 	return token_pos_cmp(a, b) == 0;
 }
 
-typedef struct Token {
+struct Token {
 	TokenKind kind;
 	String string;
 	TokenPos pos;
-} Token;
+};
 
 Token empty_token = {Token_Invalid};
 Token blank_token = {Token_Ident, {cast(u8 *)"_", 1}};
@@ -167,12 +167,12 @@ Token make_token_ident(String s) {
 }
 
 
-typedef struct ErrorCollector {
+struct ErrorCollector {
 	TokenPos prev;
 	i64     count;
 	i64     warning_count;
 	gbMutex mutex;
-} ErrorCollector;
+};
 
 gb_global ErrorCollector global_error_collector;
 
@@ -306,7 +306,7 @@ gb_inline bool token_is_shift(TokenKind t) {
 gb_inline void print_token(Token t) { gb_printf("%.*s\n", LIT(t.string)); }
 
 
-typedef enum TokenizerInitError {
+enum TokenizerInitError {
 	TokenizerInit_None,
 
 	TokenizerInit_Invalid,
@@ -315,18 +315,18 @@ typedef enum TokenizerInitError {
 	TokenizerInit_Empty,
 
 	TokenizerInit_Count,
-} TokenizerInitError;
+};
 
 
-typedef struct TokenizerState {
+struct TokenizerState {
 	Rune  curr_rune;   // current character
 	u8 *  curr;        // character pos
 	u8 *  read_curr;   // pos from start
 	u8 *  line;        // current line pos
 	isize line_count;
-} TokenizerState;
+};
 
-typedef struct Tokenizer {
+struct Tokenizer {
 	String fullpath;
 	u8 *start;
 	u8 *end;
@@ -339,7 +339,7 @@ typedef struct Tokenizer {
 
 	isize error_count;
 	Array<String> allocated_strings;
-} Tokenizer;
+};
 
 
 TokenizerState save_tokenizer_state(Tokenizer *t) {

+ 21 - 21
src/types.cpp

@@ -1,6 +1,6 @@
-typedef struct Scope Scope;
+struct Scope;
 
-typedef enum BasicKind {
+enum BasicKind {
 	Basic_Invalid,
 	Basic_bool,
 	Basic_i8,
@@ -41,9 +41,9 @@ typedef enum BasicKind {
 	Basic_COUNT,
 
 	Basic_byte = Basic_u8,
-} BasicKind;
+};
 
-typedef enum BasicFlag {
+enum BasicFlag {
 	BasicFlag_Boolean     = GB_BIT(0),
 	BasicFlag_Integer     = GB_BIT(1),
 	BasicFlag_Unsigned    = GB_BIT(2),
@@ -57,16 +57,16 @@ typedef enum BasicFlag {
 	BasicFlag_Numeric      = BasicFlag_Integer | BasicFlag_Float   | BasicFlag_Complex,
 	BasicFlag_Ordered      = BasicFlag_Integer | BasicFlag_Float   | BasicFlag_String  | BasicFlag_Pointer | BasicFlag_Rune,
 	BasicFlag_ConstantType = BasicFlag_Boolean | BasicFlag_Numeric | BasicFlag_String  | BasicFlag_Pointer | BasicFlag_Rune,
-} BasicFlag;
+};
 
-typedef struct BasicType {
+struct BasicType {
 	BasicKind kind;
 	u32       flags;
 	i64       size; // -1 if arch. dep.
 	String    name;
-} BasicType;
+};
 
-typedef enum TypeRecordKind {
+enum TypeRecordKind {
 	TypeRecord_Invalid,
 
 	TypeRecord_Struct,
@@ -75,9 +75,9 @@ typedef enum TypeRecordKind {
 	TypeRecord_Enum,
 
 	TypeRecord_Count,
-} TypeRecordKind;
+};
 
-typedef struct TypeRecord {
+struct TypeRecord {
 	TypeRecordKind kind;
 
 	// All record types
@@ -109,7 +109,7 @@ typedef struct TypeRecord {
 	Entity * enum_count;
 	Entity * enum_min_value;
 	Entity * enum_max_value;
-} TypeRecord;
+};
 
 #define TYPE_KINDS                                        \
 	TYPE_KIND(Basic,   BasicType)                         \
@@ -164,13 +164,13 @@ typedef struct TypeRecord {
 
 
 
-typedef enum TypeKind {
+enum TypeKind {
 	Type_Invalid,
 #define TYPE_KIND(k, ...) GB_JOIN2(Type_, k),
 	TYPE_KINDS
 #undef TYPE_KIND
 	Type_Count,
-} TypeKind;
+};
 
 String const type_strings[] = {
 	{cast(u8 *)"Invalid", gb_size_of("Invalid")},
@@ -183,7 +183,7 @@ String const type_strings[] = {
 	TYPE_KINDS
 #undef TYPE_KIND
 
-typedef struct Type {
+struct Type {
 	TypeKind kind;
 	union {
 #define TYPE_KIND(k, ...) GB_JOIN2(Type, k) k;
@@ -191,16 +191,16 @@ typedef struct Type {
 #undef TYPE_KIND
 	};
 	bool failure;
-} Type;
+};
 
 
 // TODO(bill): Should I add extra information here specifying the kind of selection?
 // e.g. field, constant, vector field, type field, etc.
-typedef struct Selection {
+struct Selection {
 	Entity *   entity;
 	Array<i32> index;
 	bool       indirect; // Set if there was a pointer deref anywhere down the line
-} Selection;
+};
 Selection empty_selection = {0};
 
 Selection make_selection(Entity *entity, Array<i32> index, bool indirect) {
@@ -1199,7 +1199,7 @@ bool is_type_cte_safe(Type *type) {
 	return false;
 }
 
-typedef enum ProcTypeOverloadKind {
+enum ProcTypeOverloadKind {
 	ProcOverload_Identical, // The types are identical
 
 	ProcOverload_CallingConvention,
@@ -1211,7 +1211,7 @@ typedef enum ProcTypeOverloadKind {
 
 	ProcOverload_NotProcedure,
 
-} ProcTypeOverloadKind;
+};
 
 ProcTypeOverloadKind are_proc_types_overload_safe(Type *x, Type *y) {
 	if (x == NULL && y == NULL) return ProcOverload_NotProcedure;
@@ -1508,10 +1508,10 @@ Selection lookup_field_with_selection(gbAllocator a, Type *type_, String field_n
 }
 
 
-typedef struct TypePath {
+struct TypePath {
 	Array<Type *> path; // Entity_TypeName;
 	bool failure;
-} TypePath;
+};
 
 void type_path_init(TypePath *tp) {
 	// TODO(bill): Use an allocator that uses a backing array if it can and then use alternative allocator when exhausted