#include <set>
#include <stack>
#include <unordered_set>
+#include <utility>
namespace lst = lttng::sessiond::trace;
namespace tsdl = lttng::sessiond::tsdl;
variant_tsdl_keyword_sanitizer(tsdl::details::type_overrider& type_overrides,
type_lookup_function lookup_type) :
- _type_overrides{ type_overrides }, _lookup_type(lookup_type)
+ _type_overrides(type_overrides), _lookup_type(std::move(lookup_type))
{
}
};
using unsafe_names = std::set<const char *, _c_string_comparator>;
- virtual void visit(const lst::field& field) override final
+ void visit(const lst::field& field) final
{
_type_overrides.type(field.get_type()).accept(*this);
}
- virtual void visit(const lst::integer_type& type __attribute__((unused))) override final
+ void visit(const lst::integer_type& type __attribute__((unused))) final
{
}
- virtual void visit(const lst::floating_point_type& type
- __attribute__((unused))) override final
+ void visit(const lst::floating_point_type& type __attribute__((unused))) final
{
}
- virtual void visit(const lst::signed_enumeration_type& type
- __attribute__((unused))) override final
+ void visit(const lst::signed_enumeration_type& type __attribute__((unused))) final
{
}
- virtual void visit(const lst::unsigned_enumeration_type& type
- __attribute__((unused))) override final
+ void visit(const lst::unsigned_enumeration_type& type __attribute__((unused))) final
{
}
- virtual void visit(const lst::static_length_array_type& type
- __attribute__((unused))) override final
+ void visit(const lst::static_length_array_type& type __attribute__((unused))) final
{
}
- virtual void visit(const lst::dynamic_length_array_type& type
- __attribute__((unused))) override final
+ void visit(const lst::dynamic_length_array_type& type __attribute__((unused))) final
{
}
- virtual void visit(const lst::static_length_blob_type& type
- __attribute__((unused))) override final
+ void visit(const lst::static_length_blob_type& type __attribute__((unused))) final
{
}
- virtual void visit(const lst::dynamic_length_blob_type& type
- __attribute__((unused))) override final
+ void visit(const lst::dynamic_length_blob_type& type __attribute__((unused))) final
{
}
- virtual void visit(const lst::null_terminated_string_type& type
- __attribute__((unused))) override final
+ void visit(const lst::null_terminated_string_type& type __attribute__((unused))) final
{
}
- virtual void visit(const lst::structure_type& type) override final
+ void visit(const lst::structure_type& type) final
{
/* Recurse into structure attributes. */
for (const auto& field : type.fields_) {
_type_overrides.publish(type, std::move(sanitized_variant_type));
}
- virtual void visit(const lst::variant_type<
- lst::signed_enumeration_type::mapping::range_t::range_integer_t>& type)
- override final
+ void visit(const lst::variant_type<
+ lst::signed_enumeration_type::mapping::range_t::range_integer_t>& type) final
{
visit_variant(type);
}
- virtual void visit(const lst::variant_type<
- lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>& type)
- override final
+ void visit(const lst::variant_type<
+ lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>& type) final
{
visit_variant(type);
}
- virtual void visit(const lst::static_length_string_type& type
- __attribute__((unused))) override final
+ void visit(const lst::static_length_string_type& type __attribute__((unused))) final
{
}
- virtual void visit(const lst::dynamic_length_string_type& type
- __attribute__((unused))) override final
+ void visit(const lst::dynamic_length_string_type& type __attribute__((unused))) final
{
}
const tsdl::details::type_overrider& type_overrides,
const nonstd::optional<std::string>& in_default_clock_class_name =
nonstd::nullopt) :
- _indentation_level{ indentation_level },
- _trace_abi{ abi },
- _bypass_identifier_escape{ false },
- _default_clock_class_name{ in_default_clock_class_name ?
- in_default_clock_class_name->c_str() :
- nullptr },
- _type_overrides{ type_overrides }
+ _indentation_level(indentation_level),
+ _trace_abi(abi),
+
+ _default_clock_class_name(in_default_clock_class_name ?
+ in_default_clock_class_name->c_str() :
+ nullptr),
+ _type_overrides(type_overrides)
{
}
}
private:
- virtual void visit(const lst::field& field) override final
+ void visit(const lst::field& field) final
{
/*
* Hack: keep the name of the field being visited since
_description += ";";
}
- virtual void visit(const lst::integer_type& type) override final
+ void visit(const lst::integer_type& type) final
{
_description += "integer { ";
_description += " }";
}
- virtual void visit(const lst::floating_point_type& type) override final
+ void visit(const lst::floating_point_type& type) final
{
_description += fmt::format(
"floating_point {{ align = {alignment}; mant_dig = {mantissa_digits}; exp_dig = {exponent_digits};",
_description += "}";
}
- virtual void visit(const lst::signed_enumeration_type& type) override final
+ void visit(const lst::signed_enumeration_type& type) final
{
visit_enumeration(type);
}
- virtual void visit(const lst::unsigned_enumeration_type& type) override final
+ void visit(const lst::unsigned_enumeration_type& type) final
{
visit_enumeration(type);
}
- virtual void visit(const lst::static_length_array_type& type) override final
+ void visit(const lst::static_length_array_type& type) final
{
if (type.alignment != 0) {
LTTNG_ASSERT(_current_field_name.size() > 0);
_type_suffixes.emplace(fmt::format("[{}]", type.length));
}
- virtual void visit(const lst::dynamic_length_array_type& type) override final
+ void visit(const lst::dynamic_length_array_type& type) final
{
if (type.alignment != 0) {
/*
*(type.length_field_location.elements_.end() - 1))));
}
- virtual void visit(const lst::static_length_blob_type& type) override final
+ void visit(const lst::static_length_blob_type& type) final
{
/* This type doesn't exist in CTF 1.x, express it as a static length array of
* uint8_t. */
visit(*array);
}
- virtual void visit(const lst::dynamic_length_blob_type& type) override final
+ void visit(const lst::dynamic_length_blob_type& type) final
{
/* This type doesn't exist in CTF 1.x, express it as a dynamic length array of
* uint8_t. */
visit(*array);
}
- virtual void visit(const lst::null_terminated_string_type& type) override final
+ void visit(const lst::null_terminated_string_type& type) final
{
/* Defaults to UTF-8. */
if (type.encoding_ == lst::null_terminated_string_type::encoding::ASCII) {
}
}
- virtual void visit(const lst::structure_type& type) override final
+ void visit(const lst::structure_type& type) final
{
_indentation_level++;
_description += "struct {";
_description += "}";
}
- virtual void visit(const lst::variant_type<
- lst::signed_enumeration_type::mapping::range_t::range_integer_t>& type)
- override final
+ void visit(const lst::variant_type<
+ lst::signed_enumeration_type::mapping::range_t::range_integer_t>& type) final
{
visit_variant(type);
}
- virtual void visit(const lst::variant_type<
- lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>& type)
- override final
+ void visit(const lst::variant_type<
+ lst::unsigned_enumeration_type::mapping::range_t::range_integer_t>& type) final
{
visit_variant(type);
}
lst::integer_type::base::DECIMAL);
}
- virtual void visit(const lst::static_length_string_type& type) override final
+ void visit(const lst::static_length_string_type& type) final
{
/*
* TSDL expresses static-length strings as arrays of 8-bit integer with
visit(*char_array);
}
- virtual void visit(const lst::dynamic_length_string_type& type) override final
+ void visit(const lst::dynamic_length_string_type& type) final
{
/*
* TSDL expresses dynamic-length strings as arrays of 8-bit integer with
/* Description in TSDL format. */
std::string _description;
- bool _bypass_identifier_escape;
+ bool _bypass_identifier_escape{ false };
const char *_default_clock_class_name;
const tsdl::details::type_overrider& _type_overrides;
};
class tsdl_trace_environment_visitor : public lst::trace_class_environment_visitor {
public:
- tsdl_trace_environment_visitor() : _environment{ "env {\n" }
- {
- }
+ tsdl_trace_environment_visitor() = default;
- virtual void visit(const lst::environment_field<int64_t>& field) override
+ void visit(const lst::environment_field<int64_t>& field) override
{
_environment += fmt::format(" {} = {};\n", field.name, field.value);
}
- virtual void visit(const lst::environment_field<const char *>& field) override
+ void visit(const lst::environment_field<const char *>& field) override
{
- _environment += fmt::format(
- " {} = \"{}\";\n", field.name, escape_tsdl_env_string_value(field.value));
+ _environment += fmt::format(" {} = \"{}\";\n",
+ field.name,
+ escape_tsdl_env_string_value(field.value));
}
/* Only call once. */
}
private:
- std::string _environment;
+ std::string _environment{ "env {\n" };
};
} /* namespace */
tsdl::trace_class_visitor::trace_class_visitor(
const lst::abi& trace_abi,
tsdl::append_metadata_fragment_function append_metadata_fragment) :
- _trace_abi{ trace_abi }, _append_metadata_fragment(append_metadata_fragment)
+ _trace_abi(trace_abi), _append_metadata_fragment(std::move(append_metadata_fragment))
{
}