X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fctf2-trace-class-visitor.cpp;h=71a2e48d2190c29e0401c4876dda9322e815a456;hb=20c4b46aee1a984bc558b483826c1078f24d35e9;hp=2f583cdf89525d382a5d5a9d9b13efc33af4b0b8;hpb=28ab034a2c3582d07d3423d2d746731f87d3969f;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/ctf2-trace-class-visitor.cpp b/src/bin/lttng-sessiond/ctf2-trace-class-visitor.cpp index 2f583cdf8..71a2e48d2 100644 --- a/src/bin/lttng-sessiond/ctf2-trace-class-visitor.cpp +++ b/src/bin/lttng-sessiond/ctf2-trace-class-visitor.cpp @@ -15,6 +15,7 @@ #include #include +#include namespace lsc = lttng::sessiond::ctf2; namespace lst = lttng::sessiond::trace; @@ -102,16 +103,15 @@ const char *get_role_name(lst::static_length_blob_type::role role) namespace ctf2 { class trace_environment_visitor : public lst::trace_class_environment_visitor { public: - trace_environment_visitor() - { - } + trace_environment_visitor() = default; /* NOLINT clang-tidy 14 identifies this as a move + constructor. */ - virtual void visit(const lst::environment_field& field) override + void visit(const lst::environment_field& field) override { _visit(field); } - virtual void visit(const lst::environment_field& field) override + void visit(const lst::environment_field& field) override { _visit(field); } @@ -135,9 +135,7 @@ private: class field_visitor : public lttng::sessiond::trace::field_visitor, public lttng::sessiond::trace::type_visitor { public: - field_visitor() - { - } + field_visitor() = default; /* NOLINT clang-tidy 14 identifies this as a move constructor. */ /* Only call once. */ json::json move_fragment() @@ -146,7 +144,7 @@ public: } private: - virtual void visit(const lst::field& field) override final + void visit(const lst::field& field) final { field_visitor field_type_visitor; field.get_type().accept(field_type_visitor); @@ -155,7 +153,7 @@ private: _fragment["field-class"] = field_type_visitor.move_fragment(); } - virtual void visit(const lst::integer_type& type) override final + void visit(const lst::integer_type& type) final { _fragment["type"] = type.signedness_ == lst::integer_type::signedness::SIGNED ? "fixed-length-signed-integer" : @@ -167,7 +165,7 @@ private: _fragment["alignment"] = type.alignment; _fragment["preferred-display-base"] = (unsigned int) type.base_; - if (type.roles_.size() > 0) { + if (!type.roles_.empty()) { json::json role_array = json::json::array(); for (const auto role : type.roles_) { @@ -178,7 +176,7 @@ private: } } - virtual void visit(const lst::floating_point_type& type) override final + void visit(const lst::floating_point_type& type) final { _fragment["type"] = "fixed-length-floating-point-number"; _fragment["length"] = type.exponent_digits + type.mantissa_digits; @@ -203,12 +201,12 @@ private: _fragment["alignment"] = type.alignment; _fragment["preferred-display-base"] = (unsigned int) type.base_; - if (type.roles_.size() > 0) { + if (!type.roles_.empty()) { if (std::is_signed::value) { LTTNG_THROW_ERROR( - fmt::format("Failed to serialize {}: unexpected role", - _fragment["type"])); + lttng::format("Failed to serialize {}: unexpected role", + _fragment["type"])); } auto role_array = json::json::array(); @@ -221,7 +219,7 @@ private: } if (type.mappings_->size() < 1) { - LTTNG_THROW_ERROR(fmt::format( + LTTNG_THROW_ERROR(lttng::format( "Failed to serialize {}: enumeration must have at least one mapping", _fragment["type"])); } @@ -235,17 +233,17 @@ private: _fragment["mappings"] = std::move(mappings_value); } - 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 { _fragment["type"] = "static-length-array"; @@ -260,7 +258,7 @@ private: _fragment["length"] = type.length; } - virtual void visit(const lst::dynamic_length_array_type& type) override final + void visit(const lst::dynamic_length_array_type& type) final { _fragment["type"] = "dynamic-length-array"; @@ -275,12 +273,12 @@ private: _fragment["length-field-location"] = to_json(type.length_field_location); } - virtual void visit(const lst::static_length_blob_type& type) override final + void visit(const lst::static_length_blob_type& type) final { _fragment["type"] = "static-length-blob"; _fragment["length"] = type.length_bytes; - if (type.roles_.size() > 0) { + if (!type.roles_.empty()) { auto role_array = json::json::array(); for (const auto role : type.roles_) { @@ -291,19 +289,18 @@ private: } } - virtual void visit(const lst::dynamic_length_blob_type& type) override final + void visit(const lst::dynamic_length_blob_type& type) final { _fragment["type"] = "dynamic-length-blob"; _fragment["length-field-location"] = to_json(type.length_field_location); } - 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 { _fragment["type"] = "null-terminated-string"; } - virtual void visit(const lst::structure_type& type) override final + void visit(const lst::structure_type& type) final { _fragment["type"] = "structure"; @@ -345,23 +342,23 @@ private: _fragment["options"] = std::move(options_value); } - virtual void visit(const lst::variant_type& type) override final + void visit(const lst::variant_type& type) final { visit_variant(type); } - virtual void visit(const lst::variant_type& type) override final + void visit(const lst::variant_type& type) final { visit_variant(type); } - virtual void visit(const lst::static_length_string_type& type) override final + void visit(const lst::static_length_string_type& type) final { _fragment["type"] = "static-length-string"; _fragment["length"] = type.length; } - virtual void visit(const lst::dynamic_length_string_type& type) override final + void visit(const lst::dynamic_length_string_type& type) final { _fragment["type"] = "dynamic-length-string"; _fragment["length-field-location"] = to_json(type.length_field_location); @@ -375,7 +372,7 @@ private: lsc::trace_class_visitor::trace_class_visitor( lsc::append_metadata_fragment_function append_metadata_fragment) : - _append_metadata_fragment(append_metadata_fragment) + _append_metadata_fragment(std::move(append_metadata_fragment)) { }