codegen/gen_src.cpp fixes for building with metaprogram clang

This commit is contained in:
ed
2024-05-05 00:12:11 -04:00
parent bc45aa80b6
commit f727f3ccb1
+5 -1
View File
@@ -1,3 +1,5 @@
#pragma clang diagnostic ignored "-Wswitch"
#define GEN_DEFINE_LIBRARY_CODE_CONSTANTS #define GEN_DEFINE_LIBRARY_CODE_CONSTANTS
#define GEN_ENFORCE_STRING_CODE_TYPES #define GEN_ENFORCE_STRING_CODE_TYPES
#define GEN_EXPOSE_BACKEND #define GEN_EXPOSE_BACKEND
@@ -246,9 +248,10 @@ int gen_main()
{ {
CodeStruct code_struct = code.cast<CodeStruct>(); CodeStruct code_struct = code.cast<CodeStruct>();
if (code->Name.starts_with(txt("Ast"))) if (code->Name.starts_with(txt("Ast")))
for (Code ast_code : code_struct->Body) switch (ast_code->Type) for (Code ast_code : code_struct->Body) switch (ast_code->Type)
{ {
case ECode::Union: case ECode::Union:
{
// Swap out the union's contents with the generated member definitions // Swap out the union's contents with the generated member definitions
CodeBody body_swap = def_body(ECode::Union_Body); CodeBody body_swap = def_body(ECode::Union_Body);
for (Odin_AstKind kind : ast_kinds) for (Odin_AstKind kind : ast_kinds)
@@ -256,6 +259,7 @@ int gen_main()
Ast<name> <name>; Ast<name> <name>;
)))); ))));
ast_code->Body = rcast(AST*, body_swap.ast); ast_code->Body = rcast(AST*, body_swap.ast);
}
break; break;
default: default:
continue; continue;