aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-06-19 03:50:38 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-06-19 03:50:38 -0400
commita3ddd0826bd9c799768c0c707de72c21befa742a (patch)
tree685b621eb041c178af40c0044c74f689d8d6af7b /src/codegen.cpp
parent626b73e8beeaae1cab23f883f877d89d64bbfa39 (diff)
downloadzig-a3ddd0826bd9c799768c0c707de72c21befa742a.tar.gz
zig-a3ddd0826bd9c799768c0c707de72c21befa742a.zip
remove enum to/from int casting syntax; add `@enumToInt`/`@intToEnum`
see #1061
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index c9b4ade4c6..21520e0dd0 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -4730,6 +4730,7 @@ static LLVMValueRef ir_render_instruction(CodeGen *g, IrExecutable *executable,
case IrInstructionIdErrSetCast:
case IrInstructionIdFromBytes:
case IrInstructionIdToBytes:
+ case IrInstructionIdEnumToInt:
zig_unreachable();
case IrInstructionIdReturn:
@@ -6325,6 +6326,8 @@ static void define_builtin_fns(CodeGen *g) {
create_builtin_fn(g, BuiltinFnIdBoolToInt, "boolToInt", 1);
create_builtin_fn(g, BuiltinFnIdErrToInt, "errorToInt", 1);
create_builtin_fn(g, BuiltinFnIdIntToErr, "intToError", 1);
+ create_builtin_fn(g, BuiltinFnIdEnumToInt, "enumToInt", 1);
+ create_builtin_fn(g, BuiltinFnIdIntToEnum, "intToEnum", 2);
create_builtin_fn(g, BuiltinFnIdCompileErr, "compileError", 1);
create_builtin_fn(g, BuiltinFnIdCompileLog, "compileLog", SIZE_MAX);
create_builtin_fn(g, BuiltinFnIdIntType, "IntType", 2); // TODO rename to Int