Exemplo n.º 1
0
void codegen_debugloc(compile_t* c, ast_t* ast)
{
  if(ast != NULL)
  {
    LLVMSetCurrentDebugLocation2(c->builder,
      (unsigned)ast_line(ast), (unsigned)ast_pos(ast), c->frame->di_scope);
  } else {
    LLVMSetCurrentDebugLocation2(c->builder, 0, 0, NULL);
  }
}
Exemplo n.º 2
0
void codegen_startfun(compile_t* c, LLVMValueRef fun, LLVMMetadataRef file,
  LLVMMetadataRef scope)
{
  compile_frame_t* frame = push_frame(c);

  frame->fun = fun;
  frame->is_function = true;
  frame->di_file = file;
  frame->di_scope = scope;

  if(LLVMCountBasicBlocks(fun) == 0)
  {
    LLVMBasicBlockRef block = codegen_block(c, "entry");
    LLVMPositionBuilderAtEnd(c->builder, block);
  }

  LLVMSetCurrentDebugLocation2(c->builder, 0, 0, NULL);
}