Applied cppcoreguidelines-pro-type-member-init,hicpp-explicit-conversionsm,modernize-use-default-member-init clang-tidy fixes

This commit is contained in:
Bartek Kryza
2022-12-20 22:53:20 +01:00
parent 1116c3ab67
commit 682c6648be
9 changed files with 20 additions and 37 deletions

View File

@@ -41,9 +41,9 @@ public:
common::model::access_t access() const; common::model::access_t access() const;
private: private:
clanguml::common::id_t id_; clanguml::common::id_t id_{};
std::string name_; std::string name_;
bool is_virtual_{false}; bool is_virtual_{false};
common::model::access_t access_; common::model::access_t access_{common::model::access_t::kPublic};
}; };
} // namespace clanguml::class_diagram::model } // namespace clanguml::class_diagram::model

View File

@@ -26,12 +26,7 @@ namespace clanguml::common::model {
std::atomic_uint64_t diagram_element::m_nextId = 1; std::atomic_uint64_t diagram_element::m_nextId = 1;
diagram_element::diagram_element() diagram_element::diagram_element() { }
: id_{0}
, nested_{false}
, complete_{false}
{
}
diagram_element::id_t diagram_element::id() const { return id_; } diagram_element::id_t diagram_element::id() const { return id_; }

View File

@@ -77,11 +77,11 @@ public:
void complete(bool completed); void complete(bool completed);
private: private:
id_t id_; id_t id_{0};
std::string name_; std::string name_;
std::vector<relationship> relationships_; std::vector<relationship> relationships_;
bool nested_; bool nested_{false};
bool complete_; bool complete_{false};
static std::atomic_uint64_t m_nextId; static std::atomic_uint64_t m_nextId;
}; };

View File

@@ -47,6 +47,6 @@ public:
private: private:
std::string file_; std::string file_;
unsigned int line_{0}; unsigned int line_{0};
unsigned int hash_; unsigned int hash_{0};
}; };
} // namespace clanguml::common::model } // namespace clanguml::common::model

View File

@@ -31,10 +31,7 @@ template <typename T> class optional_ref {
public: public:
using optional_type = T; using optional_type = T;
optional_ref() optional_ref() { }
: value_{nullptr}
{
}
optional_ref(T *value) { value_ = value; } optional_ref(T *value) { value_ = value; }
@@ -112,7 +109,7 @@ public:
T *get() const { return value_; } T *get() const { return value_; }
private: private:
T *value_; T *value_{nullptr};
}; };
template <typename T> template <typename T>

View File

@@ -79,7 +79,7 @@ struct filter {
enum class hint_t { up, down, left, right }; enum class hint_t { up, down, left, right };
struct layout_hint { struct layout_hint {
hint_t hint; hint_t hint{hint_t::up};
std::string entity; std::string entity;
}; };
@@ -166,7 +166,7 @@ struct diagram : public inheritable_diagram_options {
struct source_location { struct source_location {
enum class location_t { usr, marker, fileline, function }; enum class location_t { usr, marker, fileline, function };
location_t location_type; location_t location_type{location_t::function};
std::string location; std::string location;
}; };

View File

@@ -206,7 +206,7 @@ struct method : public function {
std::string to_string() const override; std::string to_string() const override;
private: private:
diagram_element::id_t class_id_; diagram_element::id_t class_id_{};
std::string method_name_; std::string method_name_;
std::string class_full_name_; std::string class_full_name_;
}; };

View File

@@ -20,16 +20,7 @@
namespace clanguml::sequence_diagram::visitor { namespace clanguml::sequence_diagram::visitor {
call_expression_context::call_expression_context() call_expression_context::call_expression_context() { }
: current_class_decl_{nullptr}
, current_class_template_decl_{nullptr}
, current_class_template_specialization_decl_{nullptr}
, current_method_decl_{nullptr}
, current_function_decl_{nullptr}
, current_function_template_decl_{nullptr}
, current_caller_id_{0}
{
}
void call_expression_context::reset() void call_expression_context::reset()
{ {

View File

@@ -99,16 +99,16 @@ struct call_expression_context {
bool is_expr_in_current_control_statement_condition( bool is_expr_in_current_control_statement_condition(
const clang::Stmt *stmt) const; const clang::Stmt *stmt) const;
clang::CXXRecordDecl *current_class_decl_; clang::CXXRecordDecl *current_class_decl_{nullptr};
clang::ClassTemplateDecl *current_class_template_decl_; clang::ClassTemplateDecl *current_class_template_decl_{nullptr};
clang::ClassTemplateSpecializationDecl clang::ClassTemplateSpecializationDecl
*current_class_template_specialization_decl_; *current_class_template_specialization_decl_{nullptr};
clang::CXXMethodDecl *current_method_decl_; clang::CXXMethodDecl *current_method_decl_{nullptr};
clang::FunctionDecl *current_function_decl_; clang::FunctionDecl *current_function_decl_{nullptr};
clang::FunctionTemplateDecl *current_function_template_decl_; clang::FunctionTemplateDecl *current_function_template_decl_{nullptr};
private: private:
std::int64_t current_caller_id_; std::int64_t current_caller_id_{0};
std::stack<std::int64_t> current_lambda_caller_id_; std::stack<std::int64_t> current_lambda_caller_id_;
std::stack<clang::CallExpr *> call_expr_stack_; std::stack<clang::CallExpr *> call_expr_stack_;