- int64_t i;
-
- if (!fc) {
- goto end;
- }
-
- switch (fc->type) {
- case CTF_FIELD_CLASS_TYPE_INT:
- case CTF_FIELD_CLASS_TYPE_ENUM:
- {
- struct ctf_field_class_int *int_fc = ctf_field_class_as_int(fc);
-
- /*
- * Conditions to be in trace IR; one of:
- *
- * 1. Does NOT have a mapped clock class AND does not
- * have a special meaning.
- * 2. Another field class depends on it.
- */
- if ((!int_fc->mapped_clock_class &&
- int_fc->meaning == CTF_FIELD_CLASS_MEANING_NONE) ||
- bt_g_hash_table_contains(ft_dependents, fc)) {
- fc->in_ir = true;
- }
-
- break;
- }
- case CTF_FIELD_CLASS_TYPE_STRUCT:
- {
- struct ctf_field_class_struct *struct_fc = ctf_field_class_as_struct(fc);
-
- /*
- * Make it part of IR if it's empty because it was
- * originally empty.
- */
- if (struct_fc->members->len == 0) {
- fc->in_ir = true;
- }
-
- /* Reverse order */
- for (i = (int64_t) struct_fc->members->len - 1; i >= 0; i--) {
- struct ctf_named_field_class *named_fc =
- ctf_field_class_struct_borrow_member_by_index(
- struct_fc, i);
-
- update_field_class_in_ir(named_fc->fc, ft_dependents);
-
- if (named_fc->fc->in_ir) {
- /* At least one member is part of IR */
- fc->in_ir = true;
- }
- }
-
- break;
- }
- case CTF_FIELD_CLASS_TYPE_VARIANT:
- {
- struct ctf_named_field_class *named_fc;
- struct ctf_field_class_variant *var_fc = ctf_field_class_as_variant(fc);
-
- /*
- * Reverse order, although it is not important for this
- * loop because a field class within a variant field
- * type's option cannot depend on a field class in
- * another option of the same variant field class.
- */
- for (i = (int64_t) var_fc->options->len - 1; i >= 0; i--) {
- named_fc =
- ctf_field_class_variant_borrow_option_by_index(
- var_fc, i);
-
- update_field_class_in_ir(named_fc->fc, ft_dependents);
-
- if (named_fc->fc->in_ir) {
- /* At least one option is part of IR */
- fc->in_ir = true;
- }
- }
-
- if (fc->in_ir) {
- /*
- * At least one option will make it to IR. In
- * this case, make all options part of IR
- * because the variant's tag could still select
- * (dynamically) a removed option. This can mean
- * having an empty structure as an option, for
- * example, but at least all the options are
- * selectable.
- */
- for (i = 0; i < var_fc->options->len; i++) {
- ctf_field_class_variant_borrow_option_by_index(
- var_fc, i)->fc->in_ir = true;
- }
-
- /*
- * This variant field class is part of IR and
- * depends on a tag field class (which must also
- * be part of IR).
- */
- g_hash_table_insert(ft_dependents, var_fc->tag_fc,
- var_fc->tag_fc);
- }
-
- break;
- }
- case CTF_FIELD_CLASS_TYPE_ARRAY:
- case CTF_FIELD_CLASS_TYPE_SEQUENCE:
- {
- struct ctf_field_class_array_base *array_fc = ctf_field_class_as_array_base(fc);
-
- update_field_class_in_ir(array_fc->elem_fc, ft_dependents);
- fc->in_ir = array_fc->elem_fc->in_ir;
-
- if (fc->type == CTF_FIELD_CLASS_TYPE_ARRAY) {
- struct ctf_field_class_array *arr_fc = ctf_field_class_as_array(fc);
-
- assert(arr_fc->meaning == CTF_FIELD_CLASS_MEANING_NONE ||
- arr_fc->meaning == CTF_FIELD_CLASS_MEANING_UUID);
-
- /*
- * UUID field class: nothing depends on this, so
- * it's not part of IR.
- */
- if (arr_fc->meaning == CTF_FIELD_CLASS_MEANING_UUID) {
- fc->in_ir = false;
- array_fc->elem_fc->in_ir = false;
- }
- } else if (fc->type == CTF_FIELD_CLASS_TYPE_SEQUENCE) {
- if (fc->in_ir) {
- struct ctf_field_class_sequence *seq_fc = ctf_field_class_as_sequence(fc);
-
- /*
- * This sequence field class is part of
- * IR and depends on a length field class
- * (which must also be part of IR).
- */
- g_hash_table_insert(ft_dependents,
- seq_fc->length_fc, seq_fc->length_fc);
- }
- }
-
- break;
- }
- default:
- fc->in_ir = true;
- break;
- }
+ int64_t i;
+
+ if (!fc) {
+ goto end;
+ }
+
+ switch (fc->type) {
+ case CTF_FIELD_CLASS_TYPE_INT:
+ case CTF_FIELD_CLASS_TYPE_ENUM:
+ {
+ struct ctf_field_class_int *int_fc = ctf_field_class_as_int(fc);
+
+ /*
+ * Conditions to be in trace IR; one of:
+ *
+ * 1. Does NOT have a mapped clock class AND does not
+ * have a special meaning.
+ * 2. Another field class depends on it.
+ */
+ if ((!int_fc->mapped_clock_class && int_fc->meaning == CTF_FIELD_CLASS_MEANING_NONE) ||
+ bt_g_hash_table_contains(ft_dependents, fc)) {
+ fc->in_ir = true;
+ }
+
+ break;
+ }
+ case CTF_FIELD_CLASS_TYPE_STRUCT:
+ {
+ struct ctf_field_class_struct *struct_fc = ctf_field_class_as_struct(fc);
+
+ /*
+ * Make it part of IR if it's empty because it was
+ * originally empty.
+ */
+ if (struct_fc->members->len == 0) {
+ fc->in_ir = true;
+ }
+
+ /* Reverse order */
+ for (i = (int64_t) struct_fc->members->len - 1; i >= 0; i--) {
+ struct ctf_named_field_class *named_fc =
+ ctf_field_class_struct_borrow_member_by_index(struct_fc, i);
+
+ update_field_class_in_ir(named_fc->fc, ft_dependents);
+
+ if (named_fc->fc->in_ir) {
+ /* At least one member is part of IR */
+ fc->in_ir = true;
+ }
+ }
+
+ break;
+ }
+ case CTF_FIELD_CLASS_TYPE_VARIANT:
+ {
+ struct ctf_named_field_class *named_fc;
+ struct ctf_field_class_variant *var_fc = ctf_field_class_as_variant(fc);
+
+ /*
+ * Reverse order, although it is not important for this
+ * loop because a field class within a variant field
+ * type's option cannot depend on a field class in
+ * another option of the same variant field class.
+ */
+ for (i = (int64_t) var_fc->options->len - 1; i >= 0; i--) {
+ named_fc = ctf_field_class_variant_borrow_option_by_index(var_fc, i);
+
+ update_field_class_in_ir(named_fc->fc, ft_dependents);
+
+ if (named_fc->fc->in_ir) {
+ /* At least one option is part of IR */
+ fc->in_ir = true;
+ }
+ }
+
+ if (fc->in_ir) {
+ /*
+ * At least one option will make it to IR. In
+ * this case, make all options part of IR
+ * because the variant's tag could still select
+ * (dynamically) a removed option. This can mean
+ * having an empty structure as an option, for
+ * example, but at least all the options are
+ * selectable.
+ */
+ for (i = 0; i < var_fc->options->len; i++) {
+ ctf_field_class_variant_borrow_option_by_index(var_fc, i)->fc->in_ir = true;
+ }
+
+ /*
+ * This variant field class is part of IR and
+ * depends on a tag field class (which must also
+ * be part of IR).
+ */
+ g_hash_table_insert(ft_dependents, var_fc->tag_fc, var_fc->tag_fc);
+ }
+
+ break;
+ }
+ case CTF_FIELD_CLASS_TYPE_ARRAY:
+ case CTF_FIELD_CLASS_TYPE_SEQUENCE:
+ {
+ struct ctf_field_class_array_base *array_fc = ctf_field_class_as_array_base(fc);
+
+ update_field_class_in_ir(array_fc->elem_fc, ft_dependents);
+ fc->in_ir = array_fc->elem_fc->in_ir;
+
+ if (fc->type == CTF_FIELD_CLASS_TYPE_ARRAY) {
+ struct ctf_field_class_array *arr_fc = ctf_field_class_as_array(fc);
+
+ assert(arr_fc->meaning == CTF_FIELD_CLASS_MEANING_NONE ||
+ arr_fc->meaning == CTF_FIELD_CLASS_MEANING_UUID);
+
+ /*
+ * UUID field class: nothing depends on this, so
+ * it's not part of IR.
+ */
+ if (arr_fc->meaning == CTF_FIELD_CLASS_MEANING_UUID) {
+ fc->in_ir = false;
+ array_fc->elem_fc->in_ir = false;
+ }
+ } else if (fc->type == CTF_FIELD_CLASS_TYPE_SEQUENCE) {
+ if (fc->in_ir) {
+ struct ctf_field_class_sequence *seq_fc = ctf_field_class_as_sequence(fc);
+
+ /*
+ * This sequence field class is part of
+ * IR and depends on a length field class
+ * (which must also be part of IR).
+ */
+ g_hash_table_insert(ft_dependents, seq_fc->length_fc, seq_fc->length_fc);
+ }
+ }
+
+ break;
+ }
+ default:
+ fc->in_ir = true;
+ break;
+ }