File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -423,11 +423,22 @@ class Crystal::CodeGenVisitor
423423 def codegen_primitive_pointer_malloc (node, target_def, call_args)
424424 type = node.type.as(PointerInstanceType )
425425 llvm_type = llvm_embedded_type(type .element_type)
426+
427+ old_debug_location = @current_debug_location
428+ if @debug .line_numbers? && (location = node.location)
429+ set_current_debug_location(node.location)
430+ end
431+
426432 if type .element_type.has_inner_pointers?
427433 last = array_malloc(llvm_type, call_args[1 ])
428434 else
429435 last = array_malloc_atomic(llvm_type, call_args[1 ])
430436 end
437+
438+ if @debug .line_numbers?
439+ set_current_debug_location(old_debug_location)
440+ end
441+
431442 last
432443 end
433444
Original file line number Diff line number Diff line change @@ -355,7 +355,10 @@ class Crystal::TopLevelVisitor < Crystal::SemanticVisitor
355355 node.raise " method marked as Primitive must have an empty body"
356356 end
357357
358- node.body = Primitive .new(value)
358+ primitive = Primitive .new(value)
359+ primitive.location = node.location
360+
361+ node.body = primitive
359362 end
360363
361364 def visit (node : Include )
You can’t perform that action at this time.
0 commit comments