aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-01-27 14:49:48 -0700
committerAndrew Kelley <superjoe30@gmail.com>2016-01-27 14:49:48 -0700
commitb50844185991a86bac462346413341b87eda14cd (patch)
tree9e6c23c5db7785ae6abba756758345768d523a4f /src/codegen.cpp
parent0a265867242757accd9a8dafee2f6cce7c738f29 (diff)
downloadzig-b50844185991a86bac462346413341b87eda14cd.tar.gz
zig-b50844185991a86bac462346413341b87eda14cd.zip
fix `%%` prefix operator codegen for simple values
closes #93
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index 008ec9b395..78592e4d09 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -916,11 +916,12 @@ static LLVMValueRef gen_prefix_op_expr(CodeGen *g, AstNode *node) {
TypeTableEntry *child_type = expr_type->data.error.child_type;
// TODO in debug mode, put a panic here if the error is not 0
if (child_type->size_in_bits > 0) {
+ add_debug_source_node(g, node);
LLVMValueRef child_val_ptr = LLVMBuildStructGEP(g->builder, expr_val, 1, "");
if (handle_is_ptr(child_type)) {
return child_val_ptr;
} else {
- return expr_val;
+ return LLVMBuildLoad(g->builder, child_val_ptr, "");
}
} else {
return nullptr;