X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=plugins%2Fctf%2Fcommon%2Fmetadata%2Fctf-meta-update-in-ir.c;h=806a9197368245abde9b665ccd86033d91e75a3d;hb=68b66a256a54d32992dfefeaad11eea88b7df234;hp=ed5d23bfd25b060b0311dae7e81df95ac2ed0d0a;hpb=83ebb7f1751a20c7ba771442487f863331c754ef;p=babeltrace.git diff --git a/plugins/ctf/common/metadata/ctf-meta-update-in-ir.c b/plugins/ctf/common/metadata/ctf-meta-update-in-ir.c index ed5d23bf..806a9197 100644 --- a/plugins/ctf/common/metadata/ctf-meta-update-in-ir.c +++ b/plugins/ctf/common/metadata/ctf-meta-update-in-ir.c @@ -15,14 +15,15 @@ #define BT_LOG_TAG "PLUGIN-CTF-METADATA-META-UPDATE-IN-IR" #include "logging.h" -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include #include +#include #include "ctf-meta-visitors.h" @@ -99,14 +100,16 @@ void update_field_class_in_ir(struct ctf_field_class *fc, { struct ctf_field_class_int *int_fc = (void *) fc; - if (int_fc->mapped_clock_class || - int_fc->meaning == CTF_FIELD_CLASS_MEANING_NONE || + /* + * 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)) { - /* - * Field class does not update a clock, has no - * special meaning, and no sequence/variant - * field class which is part of IR depends on it. - */ fc->in_ir = true; } @@ -116,6 +119,14 @@ void update_field_class_in_ir(struct ctf_field_class *fc, { struct ctf_field_class_struct *struct_fc = (void *) 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 =