Esempio n. 1
0
File: dwarf.c Progetto: ozra/ponyc
void dwarf_basic(dwarf_t* dwarf, gentype_t* g)
{
  symbols_push_frame(dwarf->symbols, g);

  dwarf_meta_t meta;
  setup_dwarf(dwarf, &meta, g, false, false);

  symbols_basic(dwarf->symbols, &meta);
}
Esempio n. 2
0
File: dwarf.c Progetto: ozra/ponyc
void dwarf_forward(dwarf_t* dwarf, gentype_t* g)
{
  symbols_push_frame(dwarf->symbols, g);

  dwarf_meta_t meta;
  setup_dwarf(dwarf, &meta, g, true, false);

  symbols_declare(dwarf->symbols, &meta);
}
Esempio n. 3
0
File: dwarf.c Progetto: ozra/ponyc
void dwarf_composite(dwarf_t* dwarf, gentype_t* g)
{
  if(is_machine_word(g->ast) || is_pointer(g->ast))
    return;

  dwarf_meta_t meta;
  setup_dwarf(dwarf, &meta, g, false, false);

  symbols_composite(dwarf->symbols, &meta);
}
Esempio n. 4
0
File: dwarf.c Progetto: ozra/ponyc
void dwarf_trait(dwarf_t* dwarf, gentype_t* g)
{
  // Trait definitions have a scope, but are modeled
  // as opaque classes from which other classes may
  // inherit.
  dwarf_meta_t meta;
  setup_dwarf(dwarf, &meta, g, false, false);

  symbols_trait(dwarf->symbols, &meta);
}
Esempio n. 5
0
File: dwarf.c Progetto: ozra/ponyc
void dwarf_pointer(dwarf_t* dwarf, gentype_t* g, const char* typearg)
{
  symbols_push_frame(dwarf->symbols, g);

  dwarf_meta_t meta;
  setup_dwarf(dwarf, &meta, g, false, false);

  meta.typearg = typearg;
  symbols_pointer(dwarf->symbols, &meta);
}
Esempio n. 6
0
void dwarf_field(dwarf_t* dwarf, gentype_t* composite, gentype_t* field,
  int index)
{
  char buf[32];
  memset(buf, 0, sizeof(buf));

  dwarf_meta_t meta;
  setup_dwarf(dwarf, &meta, field, false, true);

  meta.typearg = field->type_name;

  if(composite->underlying == TK_TUPLETYPE)
  {
    meta.flags |= DWARF_CONSTANT;
    snprintf(buf, sizeof(buf), "_%d", index + 1);
    meta.name = buf;
  }
  else
  {
    ast_t* def = (ast_t*)ast_data(composite->ast);
    ast_t* members = ast_childidx(def, 4);
    ast_t* fld = ast_childidx(members, index);
    meta.name = ast_name(ast_child(fld));

    if(ast_id(fld) == TK_FLET)
      meta.flags |= DWARF_CONSTANT;
  }

  if(meta.name[0] == '_')
    meta.flags |= DWARF_PRIVATE;

  LLVMTypeRef structure = composite->primitive;
  int offset = 0;

  if(composite->underlying != TK_TUPLETYPE)
  {
    structure = composite->structure;

    if(composite->underlying != TK_STRUCT)
      offset++;

    if(composite->underlying == TK_ACTOR)
      offset++;
  }

  meta.offset = 8 * LLVMOffsetOfElement(dwarf->target_data, structure,
    offset + index);

  symbols_field(dwarf->symbols, &meta);
}