Fixed clang-tidy warnings

This commit is contained in:
Bartek Kryza
2024-06-04 22:50:53 +02:00
parent 1c9f347c91
commit 50851531f9
5 changed files with 8 additions and 7 deletions

View File

@@ -42,7 +42,8 @@ void diagram_element::set_parent_element_id(common::id_t id)
std::string diagram_element::alias() const std::string diagram_element::alias() const
{ {
assert(id_.value() >= 0); // Only generate alias for global id's
assert(id_.is_global());
return fmt::format("C_{:022}", id_.value()); return fmt::format("C_{:022}", id_.value());
} }

View File

@@ -744,11 +744,11 @@ void generator::generate_diagram(nlohmann::json &parent) const
for (const auto &to_location : config().to()) { for (const auto &to_location : config().to()) {
auto to_activity_id = model().get_to_activity_id(to_location); auto to_activity_id = model().get_to_activity_id(to_location);
if (to_activity_id == 0) if (!to_activity_id.has_value())
continue; continue;
auto message_chains_unique = model().get_all_from_to_message_chains( auto message_chains_unique = model().get_all_from_to_message_chains(
common::id_t{}, *to_activity_id); common::id_t{}, to_activity_id.value());
nlohmann::json sequence; nlohmann::json sequence;
sequence["to"]["location"] = to_location.location; sequence["to"]["location"] = to_location.location;

View File

@@ -178,7 +178,7 @@ std::string method::method_name() const { return method_name_; }
std::string method::alias() const std::string method::alias() const
{ {
assert(class_id_.value() >= 0); assert(class_id_.is_global());
return fmt::format("C_{:022}", class_id_.value()); return fmt::format("C_{:022}", class_id_.value());
} }

View File

@@ -133,7 +133,7 @@ void call_expression_context::update(
common::id_t call_expression_context::caller_id() const common::id_t call_expression_context::caller_id() const
{ {
if (lambda_caller_id().has_value()) if (lambda_caller_id().has_value())
return *lambda_caller_id(); return *lambda_caller_id(); // NOLINT
return current_caller_id_; return current_caller_id_;
} }

View File

@@ -1934,11 +1934,11 @@ std::string translation_unit_visitor::make_lambda_name(
// Parent is also a lambda (this id points to a lambda operator()) // Parent is also a lambda (this id points to a lambda operator())
std::string parent_lambda_class_name{"()"}; std::string parent_lambda_class_name{"()"};
if (diagram().get_participant<model::method>( if (diagram().get_participant<model::method>(
context().lambda_caller_id().value())) { context().lambda_caller_id().value())) { // NOLINT
auto parent_lambda_class_id = auto parent_lambda_class_id =
diagram() diagram()
.get_participant<model::method>( .get_participant<model::method>(
context().lambda_caller_id().value()) context().lambda_caller_id().value()) // NOLINT
.value() .value()
.class_id(); .class_id();