#include "ctf-meta-visitors.h"
static inline
-bt_field_class *ctf_field_class_to_ir(struct ctf_field_class *fc,
+bt_field_class *ctf_field_class_to_ir(bt_trace_class *ir_tc,
+ struct ctf_field_class *fc,
struct ctf_trace_class *tc,
struct ctf_stream_class *sc,
struct ctf_event_class *ec);
}
static inline
-bt_field_class *ctf_field_class_int_to_ir(
+bt_field_class *ctf_field_class_int_to_ir(bt_trace_class *ir_tc,
struct ctf_field_class_int *fc)
{
bt_field_class *ir_fc;
if (fc->is_signed) {
- ir_fc = bt_field_class_signed_integer_create();
+ ir_fc = bt_field_class_signed_integer_create(ir_tc);
} else {
- ir_fc = bt_field_class_unsigned_integer_create();
+ ir_fc = bt_field_class_unsigned_integer_create(ir_tc);
}
BT_ASSERT(ir_fc);
}
static inline
-bt_field_class *ctf_field_class_enum_to_ir(
+bt_field_class *ctf_field_class_enum_to_ir(bt_trace_class *ir_tc,
struct ctf_field_class_enum *fc)
{
int ret;
uint64_t i;
if (fc->base.is_signed) {
- ir_fc = bt_field_class_signed_enumeration_create();
+ ir_fc = bt_field_class_signed_enumeration_create(ir_tc);
} else {
- ir_fc = bt_field_class_unsigned_enumeration_create();
+ ir_fc = bt_field_class_unsigned_enumeration_create(ir_tc);
}
BT_ASSERT(ir_fc);
}
static inline
-bt_field_class *ctf_field_class_float_to_ir(
+bt_field_class *ctf_field_class_float_to_ir(bt_trace_class *ir_tc,
struct ctf_field_class_float *fc)
{
bt_field_class *ir_fc;
- ir_fc = bt_field_class_real_create();
+ ir_fc = bt_field_class_real_create(ir_tc);
BT_ASSERT(ir_fc);
if (fc->base.size == 32) {
}
static inline
-bt_field_class *ctf_field_class_string_to_ir(
+bt_field_class *ctf_field_class_string_to_ir(bt_trace_class *ir_tc,
struct ctf_field_class_string *fc)
{
- bt_field_class *ir_fc =
- bt_field_class_string_create();
+ bt_field_class *ir_fc = bt_field_class_string_create(ir_tc);
BT_ASSERT(ir_fc);
return ir_fc;
}
static inline
-bt_field_class *ctf_field_class_struct_to_ir(
+bt_field_class *ctf_field_class_struct_to_ir(bt_trace_class *ir_tc,
struct ctf_field_class_struct *fc,
struct ctf_trace_class *tc,
struct ctf_stream_class *sc,
struct ctf_event_class *ec)
{
int ret;
- bt_field_class *ir_fc =
- bt_field_class_structure_create();
+ bt_field_class *ir_fc = bt_field_class_structure_create(ir_tc);
uint64_t i;
BT_ASSERT(ir_fc);
continue;
}
- member_ir_fc = ctf_field_class_to_ir(named_fc->fc, tc, sc, ec);
+ member_ir_fc = ctf_field_class_to_ir(ir_tc, named_fc->fc,
+ tc, sc, ec);
BT_ASSERT(member_ir_fc);
ret = bt_field_class_structure_append_member(
ir_fc, named_fc->name->str, member_ir_fc);
}
static inline
-bt_field_class *borrow_ir_ft_from_field_path(
- struct ctf_field_path *field_path,
+bt_field_class *borrow_ir_ft_from_field_path(struct ctf_field_path *field_path,
struct ctf_trace_class *tc,
struct ctf_stream_class *sc,
struct ctf_event_class *ec)
}
static inline
-bt_field_class *ctf_field_class_variant_to_ir(
+bt_field_class *ctf_field_class_variant_to_ir(bt_trace_class *ir_tc,
struct ctf_field_class_variant *fc,
struct ctf_trace_class *tc,
struct ctf_stream_class *sc,
struct ctf_event_class *ec)
{
int ret;
- bt_field_class *ir_fc =
- bt_field_class_variant_create();
+ bt_field_class *ir_fc = bt_field_class_variant_create(ir_tc);
uint64_t i;
BT_ASSERT(ir_fc);
bt_field_class *option_ir_fc;
BT_ASSERT(named_fc->fc->in_ir);
- option_ir_fc = ctf_field_class_to_ir(named_fc->fc, tc, sc, ec);
+ option_ir_fc = ctf_field_class_to_ir(ir_tc, named_fc->fc,
+ tc, sc, ec);
BT_ASSERT(option_ir_fc);
ret = bt_field_class_variant_append_option(
ir_fc, named_fc->name->str, option_ir_fc);
}
static inline
-bt_field_class *ctf_field_class_array_to_ir(
+bt_field_class *ctf_field_class_array_to_ir(bt_trace_class *ir_tc,
struct ctf_field_class_array *fc,
struct ctf_trace_class *tc,
struct ctf_stream_class *sc,
bt_field_class *elem_ir_fc;
if (fc->base.is_text) {
- ir_fc = bt_field_class_string_create();
+ ir_fc = bt_field_class_string_create(ir_tc);
BT_ASSERT(ir_fc);
goto end;
}
- elem_ir_fc = ctf_field_class_to_ir(fc->base.elem_fc, tc, sc, ec);
+ elem_ir_fc = ctf_field_class_to_ir(ir_tc, fc->base.elem_fc, tc, sc, ec);
BT_ASSERT(elem_ir_fc);
- ir_fc = bt_field_class_static_array_create(elem_ir_fc,
+ ir_fc = bt_field_class_static_array_create(ir_tc, elem_ir_fc,
fc->length);
BT_ASSERT(ir_fc);
bt_field_class_put_ref(elem_ir_fc);
}
static inline
-bt_field_class *ctf_field_class_sequence_to_ir(
+bt_field_class *ctf_field_class_sequence_to_ir(bt_trace_class *ir_tc,
struct ctf_field_class_sequence *fc,
struct ctf_trace_class *tc,
struct ctf_stream_class *sc,
bt_field_class *elem_ir_fc;
if (fc->base.is_text) {
- ir_fc = bt_field_class_string_create();
+ ir_fc = bt_field_class_string_create(ir_tc);
BT_ASSERT(ir_fc);
goto end;
}
- elem_ir_fc = ctf_field_class_to_ir(fc->base.elem_fc, tc, sc, ec);
+ elem_ir_fc = ctf_field_class_to_ir(ir_tc, fc->base.elem_fc, tc, sc, ec);
BT_ASSERT(elem_ir_fc);
- ir_fc = bt_field_class_dynamic_array_create(elem_ir_fc);
+ ir_fc = bt_field_class_dynamic_array_create(ir_tc, elem_ir_fc);
BT_ASSERT(ir_fc);
bt_field_class_put_ref(elem_ir_fc);
BT_ASSERT(ir_fc);
}
static inline
-bt_field_class *ctf_field_class_to_ir(struct ctf_field_class *fc,
+bt_field_class *ctf_field_class_to_ir(bt_trace_class *ir_tc,
+ struct ctf_field_class *fc,
struct ctf_trace_class *tc,
struct ctf_stream_class *sc,
struct ctf_event_class *ec)
switch (fc->type) {
case CTF_FIELD_CLASS_TYPE_INT:
- ir_fc = ctf_field_class_int_to_ir((void *) fc);
+ ir_fc = ctf_field_class_int_to_ir(ir_tc, (void *) fc);
break;
case CTF_FIELD_CLASS_TYPE_ENUM:
- ir_fc = ctf_field_class_enum_to_ir((void *) fc);
+ ir_fc = ctf_field_class_enum_to_ir(ir_tc, (void *) fc);
break;
case CTF_FIELD_CLASS_TYPE_FLOAT:
- ir_fc = ctf_field_class_float_to_ir((void *) fc);
+ ir_fc = ctf_field_class_float_to_ir(ir_tc, (void *) fc);
break;
case CTF_FIELD_CLASS_TYPE_STRING:
- ir_fc = ctf_field_class_string_to_ir((void *) fc);
+ ir_fc = ctf_field_class_string_to_ir(ir_tc, (void *) fc);
break;
case CTF_FIELD_CLASS_TYPE_STRUCT:
- ir_fc = ctf_field_class_struct_to_ir((void *) fc, tc, sc, ec);
+ ir_fc = ctf_field_class_struct_to_ir(ir_tc, (void *) fc,
+ tc, sc, ec);
break;
case CTF_FIELD_CLASS_TYPE_ARRAY:
- ir_fc = ctf_field_class_array_to_ir((void *) fc, tc, sc, ec);
+ ir_fc = ctf_field_class_array_to_ir(ir_tc, (void *) fc,
+ tc, sc, ec);
break;
case CTF_FIELD_CLASS_TYPE_SEQUENCE:
- ir_fc = ctf_field_class_sequence_to_ir((void *) fc, tc, sc, ec);
+ ir_fc = ctf_field_class_sequence_to_ir(ir_tc, (void *) fc,
+ tc, sc, ec);
break;
case CTF_FIELD_CLASS_TYPE_VARIANT:
- ir_fc = ctf_field_class_variant_to_ir((void *) fc, tc, sc, ec);
+ ir_fc = ctf_field_class_variant_to_ir(ir_tc, (void *) fc,
+ tc, sc, ec);
break;
default:
abort();
}
static inline
-bt_field_class *scope_ctf_field_class_to_ir(struct ctf_field_class *fc,
- struct ctf_trace_class *tc,
- struct ctf_stream_class *sc,
- struct ctf_event_class *ec)
+bt_field_class *scope_ctf_field_class_to_ir(bt_trace_class *ir_tc,
+ struct ctf_field_class *fc,
+ struct ctf_trace_class *tc,
+ struct ctf_stream_class *sc,
+ struct ctf_event_class *ec)
{
bt_field_class *ir_fc = NULL;
goto end;
}
- ir_fc = ctf_field_class_to_ir(fc, tc, sc, ec);
+ ir_fc = ctf_field_class_to_ir(ir_tc, fc, tc, sc, ec);
end:
return ir_fc;
{
int ret;
bt_event_class *ir_ec = NULL;
+ bt_trace_class *ir_tc = bt_stream_class_borrow_trace_class(ir_sc);
if (ec->is_translated) {
ir_ec = bt_stream_class_borrow_event_class_by_id(
bt_event_class_put_ref(ir_ec);
if (ec->spec_context_fc) {
- bt_field_class *ir_fc = scope_ctf_field_class_to_ir(
+ bt_field_class *ir_fc = scope_ctf_field_class_to_ir(ir_tc,
ec->spec_context_fc, tc, sc, ec);
if (ir_fc) {
}
if (ec->payload_fc) {
- bt_field_class *ir_fc = scope_ctf_field_class_to_ir(
+ bt_field_class *ir_fc = scope_ctf_field_class_to_ir(ir_tc,
ec->payload_fc, tc, sc, ec);
if (ir_fc) {
bt_stream_class_put_ref(ir_sc);
if (sc->packet_context_fc) {
- bt_field_class *ir_fc = scope_ctf_field_class_to_ir(
+ bt_field_class *ir_fc = scope_ctf_field_class_to_ir(ir_tc,
sc->packet_context_fc, tc, sc, NULL);
if (ir_fc) {
}
if (sc->event_header_fc) {
- bt_field_class *ir_fc = scope_ctf_field_class_to_ir(
+ bt_field_class *ir_fc = scope_ctf_field_class_to_ir(ir_tc,
sc->event_header_fc, tc, sc, NULL);
if (ir_fc) {
}
if (sc->event_common_context_fc) {
- bt_field_class *ir_fc = scope_ctf_field_class_to_ir(
+ bt_field_class *ir_fc = scope_ctf_field_class_to_ir(ir_tc,
sc->event_common_context_fc, tc, sc, NULL);
if (ir_fc) {
}
if (tc->packet_header_fc) {
- bt_field_class *ir_fc = scope_ctf_field_class_to_ir(
+ bt_field_class *ir_fc = scope_ctf_field_class_to_ir(ir_tc,
tc->packet_header_fc, tc, NULL, NULL);
if (ir_fc) {