- current, end, session_attributes, next_ust_ctl_field,
- [&choices, typed_enumeration, &selector_field](
- lst::field::uptr field) {
- /*
- * Find the enumeration mapping that matches the
- * field's name.
- */
- const auto mapping_it = std::find_if(
- typed_enumeration._mappings->begin(),
- typed_enumeration._mappings->end(),
- [&field](const typename std::remove_reference<
- decltype(typed_enumeration)>::type::
- mapping& mapping) {
- return mapping.name == field->name;
- });
-
- if (mapping_it == typed_enumeration._mappings->end()) {
- LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
- "Invalid variant choice: `{}` does not match any mapping in `{}` enumeration",
- field->name, selector_field.name));
- }
-
- choices.emplace_back(*mapping_it, field->move_type());
- },
- lookup_field, lookup_root, current_field_location_elements);
+ current,
+ end,
+ session_attributes,
+ next_ust_ctl_field,
+ [&choices, typed_enumeration, &selector_field, quirks](
+ lst::field::uptr field) {
+ /*
+ * Find the enumeration mapping that matches the
+ * field's name.
+ */
+ const auto mapping_it = std::find_if(
+ typed_enumeration.mappings_->begin(),
+ typed_enumeration.mappings_->end(),
+ [&field,
+ quirks](const typename std::remove_reference<
+ decltype(typed_enumeration)>::type::mapping&
+ mapping) {
+ if (static_cast<bool>(
+ quirks &
+ lsu::ctl_field_quirks::
+ UNDERSCORE_PREFIXED_VARIANT_TAG_MAPPINGS)) {
+ /*
+ * Check if they match with
+ * a prepended underscore
+ * and, if not, perform the
+ * regular check.
+ */
+ if ((std::string("_") + field->name) ==
+ mapping.name) {
+ return true;
+ }
+ }
+
+ return mapping.name == field->name;
+ });
+
+ if (mapping_it == typed_enumeration.mappings_->end()) {
+ LTTNG_THROW_PROTOCOL_ERROR(fmt::format(
+ "Invalid variant choice: `{}` does not match any mapping in `{}` enumeration",
+ field->name,
+ selector_field.name));
+ }
+
+ choices.emplace_back(*mapping_it, field->move_type());
+ },
+ lookup_field,
+ lookup_root,
+ current_field_location_elements,
+ quirks);