diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-04-09 16:52:52 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-04-09 16:52:52 -0700 |
| commit | 7eb6af1d3e92510cb558d43ac80c45964f183bb7 (patch) | |
| tree | e542ce10e3355773a1c238fb760a6104ec82aa7b /src/codegen.cpp | |
| parent | 21eca6478f80f871f839b20044869cead55582a5 (diff) | |
| download | zig-7eb6af1d3e92510cb558d43ac80c45964f183bb7.tar.gz zig-7eb6af1d3e92510cb558d43ac80c45964f183bb7.zip | |
add @breakpoint()
Diffstat (limited to 'src/codegen.cpp')
| -rw-r--r-- | src/codegen.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp index dbab8ddd9b..89bfc4d294 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -513,6 +513,8 @@ static LLVMValueRef gen_builtin_fn_call_expr(CodeGen *g, AstNode *node) { return nullptr; case BuiltinFnIdErrName: return gen_err_name(g, node); + case BuiltinFnIdBreakpoint: + return LLVMBuildCall(g->builder, g->trap_fn_val, nullptr, 0, ""); } zig_unreachable(); } @@ -3790,9 +3792,15 @@ static BuiltinFnEntry *create_builtin_fn_with_arg_count(CodeGen *g, BuiltinFnId static void define_builtin_fns(CodeGen *g) { { + BuiltinFnEntry *builtin_fn = create_builtin_fn_with_arg_count(g, BuiltinFnIdBreakpoint, "breakpoint", 0); + builtin_fn->return_type = g->builtin_types.entry_void; + builtin_fn->ref_count = 1; + LLVMTypeRef fn_type = LLVMFunctionType(LLVMVoidType(), nullptr, 0, false); - g->trap_fn_val = LLVMAddFunction(g->module, "llvm.debugtrap", fn_type); - assert(LLVMGetIntrinsicID(g->trap_fn_val)); + builtin_fn->fn_val = LLVMAddFunction(g->module, "llvm.debugtrap", fn_type); + assert(LLVMGetIntrinsicID(builtin_fn->fn_val)); + + g->trap_fn_val = builtin_fn->fn_val; } { BuiltinFnEntry *builtin_fn = create_builtin_fn(g, BuiltinFnIdMemcpy, "memcpy"); |
