ir: validate sequence length fields and variant tags of event classes
[babeltrace.git] / formats / ctf / ir / stream-class.c
index aba76cd17229dbc452c45312670ff0950705b0c8..72b07b84c14cb26b98d983e908f4e88c18635dd3 100644 (file)
@@ -34,6 +34,7 @@
 #include <babeltrace/ctf-ir/event-fields-internal.h>
 #include <babeltrace/ctf-writer/stream.h>
 #include <babeltrace/ctf-ir/stream-class-internal.h>
+#include <babeltrace/ctf-ir/visitor-internal.h>
 #include <babeltrace/ctf-writer/functor-internal.h>
 #include <babeltrace/ctf-ir/utils.h>
 #include <babeltrace/compiler.h>
@@ -340,6 +341,20 @@ int bt_ctf_stream_class_add_event_class(
                goto end;
        }
 
+       /*
+        * Resolve the event's sequence length and variant tags if the
+        * stream is already associated with a trace. Otherwise, this
+        * validation will be performed once the stream is registered
+        * to a trace.
+        */
+       if (stream_class->trace) {
+               ret = bt_ctf_event_class_resolve_types(event_class,
+                       stream_class->trace, stream_class);
+               if (ret) {
+                       goto end;
+               }
+       }
+
        /* Only set an event id if none was explicitly set before */
        event_id = bt_ctf_event_class_get_id(event_class);
        if (event_id < 0) {
This page took 0.023346 seconds and 4 git commands to generate.