Applied google-readability-namespace-comments clang-tidy fixes

This commit is contained in:
Bartek Kryza
2022-12-20 21:57:06 +01:00
parent e8909c6fc1
commit f2760a5e21
124 changed files with 228 additions and 180 deletions

47
.clang-tidy Normal file
View File

@@ -0,0 +1,47 @@
Checks: >-
*,
-altera*,
-*braces-around-statements,
-*osx*,
-abseil*,
-android*,
-clang-analyzer-alpha.*,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-macro-usage,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-special-member-functions,
-cppcoreguidelines-avoid-magic-numbers,
-cert-env33-c,
-cert-err58-cpp,
-fuchsia*,
-hicpp-no-array-decay,
-google-readability-todo,
-google-default-arguments,
-hicpp-signed-bitwise,
-llvmlibc-*,
-llvm-header-guard,
-llvm-namespace-comment,
-misc-no-recursion,
-modernize-use-trailing-return-type,
-mpi*,
-objc*,
-openmp*,
-readability-inconsistent-declaration-parameter-name,
-readability-identifier-naming,
-darwin*,
-zircon*
WarningsAsErrors: '*'
HeaderFilterRegex: 'src'
CheckOptions:
- key: readability-identifier-naming.ClassMemberSuffix
value: '_'
- key: readability-identifier-naming.PublicMemberSuffix
value: ''
- key: performance-unnecessary-value-param.AllowedTypes
value: shared_ptr;weak_ptr
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
value: 1
- key: hicpp-special-member-functions.AllowSoleDefaultDtor
value: 1
- key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor
value: 1

View File

@@ -537,4 +537,4 @@ void generator::generate(std::ostream &ostr) const
ostr << "@enduml" << '\n';
}
}
} // namespace clanguml::class_diagram::generators::plantuml

View File

@@ -81,7 +81,7 @@ private:
std::string render_name(std::string name) const;
};
}
}
}
}
} // namespace plantuml
} // namespace generators
} // namespace class_diagram
} // namespace clanguml

View File

@@ -194,4 +194,4 @@ int class_::calculate_template_specialization_match(
return res;
}
}
} // namespace clanguml::class_diagram::model

View File

@@ -105,7 +105,7 @@ private:
std::string full_name_;
};
}
} // namespace clanguml::class_diagram::model
namespace std {
template <>
@@ -119,4 +119,4 @@ struct hash<std::reference_wrapper<clanguml::class_diagram::model::class_>> {
return std::hash<id_t>{}(key.get().id());
}
};
}
} // namespace std

View File

@@ -42,4 +42,4 @@ inja::json class_element::context() const
ctx["access"] = to_string(access());
return ctx;
}
}
} // namespace clanguml::class_diagram::model

View File

@@ -44,4 +44,4 @@ private:
std::string type_;
};
}
} // namespace clanguml::class_diagram::model

View File

@@ -37,4 +37,4 @@ bool class_member::is_static() const { return is_static_; }
void class_member::is_static(bool is_static) { is_static_ = is_static; }
}
} // namespace clanguml::class_diagram::model

View File

@@ -41,4 +41,4 @@ private:
bool is_static_{false};
};
}
} // namespace clanguml::class_diagram::model

View File

@@ -61,4 +61,4 @@ void class_method::add_parameter(method_parameter &&parameter)
{
parameters_.emplace_back(std::move(parameter));
}
}
} // namespace clanguml::class_diagram::model

View File

@@ -58,4 +58,4 @@ private:
bool is_defaulted_{false};
bool is_static_{false};
};
}
} // namespace clanguml::class_diagram::model

View File

@@ -35,4 +35,4 @@ void class_parent::set_access(common::model::access_t access)
common::model::access_t class_parent::access() const { return access_; }
}
} // namespace clanguml::class_diagram::model

View File

@@ -46,4 +46,4 @@ private:
bool is_virtual_{false};
common::model::access_t access_;
};
}
} // namespace clanguml::class_diagram::model

View File

@@ -294,7 +294,7 @@ inja::json diagram::context() const
return ctx;
}
}
} // namespace clanguml::class_diagram::model
namespace clanguml::common::model {
template <>

View File

@@ -96,7 +96,7 @@ private:
std::map<std::string, std::unique_ptr<type_alias>> type_aliases_;
};
}
} // namespace clanguml::class_diagram::model
namespace clanguml::common::model {
template <>

View File

@@ -54,4 +54,4 @@ std::vector<std::string> &enum_::constants() { return constants_; }
const std::vector<std::string> &enum_::constants() const { return constants_; }
}
} // namespace clanguml::class_diagram::model

View File

@@ -49,4 +49,4 @@ private:
std::vector<std::string> constants_;
};
}
} // namespace clanguml::class_diagram::model

View File

@@ -49,4 +49,4 @@ std::string method_parameter::to_string(
return fmt::format("{} {} = {}", type_ns, name(), default_value());
}
}
} // namespace clanguml::class_diagram::model

View File

@@ -45,4 +45,4 @@ private:
std::string default_value_;
};
}
} // namespace clanguml::class_diagram::model

View File

@@ -215,4 +215,4 @@ bool template_parameter::find_nested_relationships(
return added_aggregation_relationship;
}
}
} // namespace clanguml::class_diagram::model

View File

@@ -129,4 +129,4 @@ private:
std::optional<int64_t> id_;
};
}
} // namespace clanguml::class_diagram::model

View File

@@ -31,4 +31,4 @@ void type_alias::set_underlying_type(const std::string &type)
std::string type_alias::underlying_type() const { return underlying_type_; }
}
} // namespace clanguml::class_diagram::model

View File

@@ -34,4 +34,4 @@ private:
std::string underlying_type_;
};
}
} // namespace clanguml::class_diagram::model

View File

@@ -2172,4 +2172,4 @@ translation_unit_visitor::get_ast_local_id(int64_t local_id) const
return local_ast_id_map_.at(local_id);
}
}
} // namespace clanguml::class_diagram::visitor

View File

@@ -255,4 +255,4 @@ private:
common::model::access_t>>
anonymous_struct_relationships_;
};
}
} // namespace clanguml::class_diagram::visitor

View File

@@ -298,4 +298,4 @@ template <> id_t to_id(const clang::TemplateArgument &template_argument)
throw std::runtime_error("Cannot generate id for template argument");
}
}
} // namespace clanguml::common

View File

@@ -131,4 +131,4 @@ template <> id_t to_id(const clang::EnumType &type);
template <> id_t to_id(const clang::TemplateSpecializationType &type);
template <> id_t to_id(const std::filesystem::path &type);
}
} // namespace clanguml::common

View File

@@ -70,4 +70,4 @@ std::string to_plantuml(message_t r)
}
}
}
} // namespace clanguml::common::generators::plantuml

View File

@@ -572,4 +572,4 @@ template <typename C, typename D> void generator<C, D>::init_env()
return res;
});
}
}
} // namespace clanguml::common::generators::plantuml

View File

@@ -91,4 +91,4 @@ void decorated_element::append(const decorated_element &de)
std::optional<comment_t> decorated_element::comment() const { return comment_; }
void decorated_element::set_comment(const comment_t &c) { comment_ = c; }
}
} // namespace clanguml::common::model

View File

@@ -61,4 +61,4 @@ private:
std::optional<comment_t> comment_;
};
}
} // namespace clanguml::common::model

View File

@@ -108,4 +108,4 @@ bool diagram::should_include(const common::model::source_file &f) const
return filter_->should_include(f);
}
}
} // namespace clanguml::common::model

View File

@@ -88,4 +88,4 @@ private:
};
template <typename DiagramT> bool check_diagram_type(diagram_t t);
}
} // namespace clanguml::common::model

View File

@@ -105,4 +105,4 @@ std::ostream &operator<<(std::ostream &out, const diagram_element &rhs)
return out;
}
}
} // namespace clanguml::common::model

View File

@@ -85,4 +85,4 @@ private:
static std::atomic_uint64_t m_nextId;
};
}
} // namespace clanguml::common::model

View File

@@ -612,4 +612,4 @@ bool diagram_filter::should_include<std::string>(const std::string &name) const
return should_include(ns, n);
}
}
} // namespace clanguml::common::model

View File

@@ -363,4 +363,4 @@ private:
template <>
bool diagram_filter::should_include<std::string>(const std::string &name) const;
}
} // namespace clanguml::common::model

View File

@@ -64,4 +64,4 @@ std::ostream &operator<<(std::ostream &out, const element &rhs)
return out;
}
}
} // namespace clanguml::common::model

View File

@@ -76,4 +76,4 @@ private:
namespace_ ns_;
namespace_ using_namespace_;
};
}
} // namespace clanguml::common::model

View File

@@ -133,4 +133,4 @@ std::string to_string(const diagram_t t)
}
}
}
} // namespace clanguml::common::model

View File

@@ -79,4 +79,4 @@ std::string to_string(message_t m);
std::string to_string(diagram_t r);
}
} // namespace clanguml::common::model

View File

@@ -50,4 +50,4 @@ template <> struct hash<clanguml::common::model::namespace_> {
}
};
}
} // namespace std

View File

@@ -171,4 +171,4 @@ private:
std::vector<std::unique_ptr<T>> elements_;
};
}
} // namespace clanguml::common::model

View File

@@ -40,4 +40,4 @@ bool package::is_deprecated() const { return is_deprecated_; }
void package::set_deprecated(bool deprecated) { is_deprecated_ = deprecated; }
}
} // namespace clanguml::common::model

View File

@@ -55,7 +55,7 @@ public:
private:
bool is_deprecated_{false};
};
}
} // namespace clanguml::common::model
namespace std {
template <>
@@ -69,4 +69,4 @@ struct hash<std::reference_wrapper<clanguml::common::model::package>> {
return std::hash<id_t>{}(key.get().id());
}
};
}
} // namespace std

View File

@@ -216,4 +216,4 @@ private:
container_type path_;
};
}
} // namespace clanguml::common::model

View File

@@ -82,4 +82,4 @@ bool operator==(const relationship &l, const relationship &r)
return l.type() == r.type() && l.destination() == r.destination() &&
l.label() == r.label();
}
}
} // namespace clanguml::common::model

View File

@@ -64,4 +64,4 @@ private:
std::string label_;
access_t access_;
};
}
} // namespace clanguml::common::model

View File

@@ -119,7 +119,7 @@ private:
source_file_t type_{source_file_t::kDirectory};
bool is_absolute_{false};
};
}
} // namespace clanguml::common::model
namespace std {
@@ -139,7 +139,7 @@ template <> struct hash<clanguml::common::model::filesystem_path> {
}
};
}
} // namespace std
namespace std {
template <>
@@ -153,4 +153,4 @@ struct hash<std::reference_wrapper<clanguml::common::model::source_file>> {
return std::hash<id_t>{}(key.get().id());
}
};
}
} // namespace std

View File

@@ -48,4 +48,4 @@ private:
unsigned int line_{0};
unsigned int hash_;
};
}
} // namespace clanguml::common::model

View File

@@ -30,4 +30,4 @@ private:
std::string style_;
};
}
} // namespace clanguml::common::model

View File

@@ -71,4 +71,4 @@ inline value_t any_of(InputIterator first, InputIterator last, Predicate pred)
return res;
}
};
} // namespace clanguml::common::model::tvl;

View File

@@ -121,4 +121,4 @@ using reference_vector = std::vector<std::reference_wrapper<T>>;
template <typename T>
using reference_set = std::unordered_set<std::reference_wrapper<T>>;
} // namespace clang::common
} // namespace clanguml::common

View File

@@ -223,4 +223,4 @@ void clang_visitor::visit_paragraph(
}
}
}
} // namespace clanguml::common::visitor::comment

View File

@@ -51,4 +51,4 @@ private:
void visit_paragraph(const clang::comments::ParagraphComment *paragraph,
const clang::comments::CommandTraits &traits, std::string &text);
};
}
} // namespace clanguml::common::visitor::comment

View File

@@ -30,4 +30,4 @@ clang::SourceManager &comment_visitor::source_manager()
return source_manager_;
}
}
} // namespace clanguml::common::visitor::comment

View File

@@ -38,4 +38,4 @@ public:
private:
clang::SourceManager &source_manager_;
};
}
} // namespace clanguml::common::visitor::comment

View File

@@ -47,4 +47,4 @@ void plain_visitor::visit(
e.set_comment(cmt);
}
}
} // namespace clanguml::common::visitor::comment

View File

@@ -86,4 +86,4 @@ void translation_unit_visitor::set_source_location(
}
}
}
} // namespace clanguml::common::visitor

View File

@@ -104,4 +104,4 @@ private:
std::unique_ptr<comment::comment_visitor> comment_visitor_;
};
}
} // namespace clanguml::common::visitor

View File

@@ -218,8 +218,8 @@ template <> void append_value<plantuml>(plantuml &l, const plantuml &r)
{
l.append(r);
}
}
}
} // namespace config
} // namespace clanguml
namespace YAML {
using clanguml::common::model::access_t;
@@ -775,4 +775,4 @@ template <> struct convert<config> {
return true;
}
};
}
} // namespace YAML

View File

@@ -216,5 +216,5 @@ struct config : public inheritable_diagram_options {
};
config load(const std::string &config_file);
}
}
} // namespace config
} // namespace clanguml

View File

@@ -78,5 +78,5 @@ template <typename T> struct option {
bool has_value{false};
option_inherit_mode inheritance_mode;
};
}
}
} // namespace config
} // namespace clanguml

View File

@@ -120,4 +120,4 @@ void generator::generate(std::ostream &ostr) const
ostr << "@enduml" << '\n';
}
}
} // namespace clanguml::include_diagram::generators::plantuml

View File

@@ -60,7 +60,7 @@ public:
void generate(std::ostream &ostr) const;
};
}
}
}
}
} // namespace plantuml
} // namespace generators
} // namespace include_diagram
} // namespace clanguml

View File

@@ -152,7 +152,7 @@ inja::json diagram::context() const
return ctx;
}
}
} // namespace clanguml::include_diagram::model
namespace clanguml::common::model {
template <>

View File

@@ -64,7 +64,7 @@ public:
private:
common::reference_vector<common::model::source_file> files_;
};
}
} // namespace clanguml::include_diagram::model
namespace clanguml::common::model {
template <>

View File

@@ -229,4 +229,4 @@ translation_unit_visitor::include_visitor::process_source_file(
return {};
}
}
} // namespace clanguml::include_diagram::visitor

View File

@@ -102,4 +102,4 @@ private:
// Reference to class diagram config
const clanguml::config::include_diagram &config_;
};
}
} // namespace clanguml::include_diagram::visitor

View File

@@ -118,4 +118,4 @@ void generator::generate(std::ostream &ostr) const
ostr << "@enduml" << '\n';
}
}
} // namespace clanguml::package_diagram::generators::plantuml

View File

@@ -60,7 +60,7 @@ public:
void generate(std::ostream &ostr) const;
};
}
}
}
}
} // namespace plantuml
} // namespace generators
} // namespace package_diagram
} // namespace clanguml

View File

@@ -111,7 +111,7 @@ inja::json diagram::context() const
return ctx;
}
}
} // namespace clanguml::package_diagram::model
namespace clanguml::common::model {
template <>

View File

@@ -64,7 +64,7 @@ public:
private:
common::reference_vector<clanguml::common::model::package> packages_;
};
}
} // namespace clanguml::package_diagram::model
namespace clanguml::common::model {
template <>

View File

@@ -412,4 +412,4 @@ bool translation_unit_visitor::find_relationships(const clang::QualType &type,
return result;
}
}
} // namespace clanguml::package_diagram::visitor

View File

@@ -96,4 +96,4 @@ private:
// Reference to class diagram config
const clanguml::config::package_diagram &config_;
};
}
} // namespace clanguml::package_diagram::visitor

View File

@@ -454,4 +454,4 @@ std::string generator::generate_alias(
return participant.alias();
}
}
} // namespace clanguml::sequence_diagram::generators::plantuml

View File

@@ -73,7 +73,7 @@ private:
std::string generate_alias(const model::participant &participant) const;
};
}
}
}
}
} // namespace plantuml
} // namespace generators
} // namespace sequence_diagram
} // namespace clanguml

View File

@@ -35,4 +35,4 @@ void activity::set_from(common::model::diagram_element::id_t f) { from_ = f; }
common::model::diagram_element::id_t activity::from() const { return from_; }
}
} // namespace clanguml::sequence_diagram::model

View File

@@ -44,4 +44,4 @@ private:
std::vector<message> messages_;
};
}
} // namespace clanguml::sequence_diagram::model

View File

@@ -466,7 +466,7 @@ void diagram::fold_or_end_block_statement(message &&m,
current_messages.emplace_back(std::move(m));
}
}
}
} // namespace clanguml::sequence_diagram::model
namespace clanguml::common::model {
template <>

View File

@@ -158,7 +158,7 @@ private:
std::set<common::model::diagram_element::id_t> active_participants_;
};
}
} // namespace clanguml::sequence_diagram::model
namespace clanguml::common::model {
template <>

View File

@@ -57,4 +57,4 @@ void message::set_message_scope(common::model::message_scope_t scope)
common::model::message_scope_t message::message_scope() const { return scope_; }
}
} // namespace clanguml::sequence_diagram::model

View File

@@ -67,4 +67,4 @@ private:
std::string return_type_{};
};
}
} // namespace clanguml::sequence_diagram::model

View File

@@ -353,4 +353,4 @@ std::string function_template::message_name(message_render_mode mode) const
fmt::join(parameters(), ","), is_const() ? " const" : "");
}
}
} // namespace clanguml::sequence_diagram::model

View File

@@ -227,4 +227,4 @@ struct function_template : public function, public template_trait {
std::string message_name(message_render_mode mode) const override;
};
}
} // namespace clanguml::sequence_diagram::model

View File

@@ -387,4 +387,4 @@ bool call_expression_context::is_expr_in_current_control_statement_condition(
return false;
}
}
} // namespace clanguml::sequence_diagram::visitor

View File

@@ -122,4 +122,4 @@ private:
std::stack<clang::ConditionalOperator *> conditional_operator_stack_;
};
}
} // namespace clanguml::sequence_diagram::visitor

View File

@@ -1239,7 +1239,8 @@ translation_unit_visitor::create_class_declaration(clang::CXXRecordDecl *cls)
id_opt = get_unique_id(local_id);
// If not, check if the parent template declaration is in the model
if (!id_opt && static_cast<const clang::RecordDecl *>(parent)
if (!id_opt &&
static_cast<const clang::RecordDecl *>(parent)
->getDescribedTemplate()) {
local_id = static_cast<const clang::RecordDecl *>(parent)
->getDescribedTemplate()
@@ -1249,7 +1250,7 @@ translation_unit_visitor::create_class_declaration(clang::CXXRecordDecl *cls)
id_opt = get_unique_id(local_id);
}
if(!id_opt)
if (!id_opt)
return {};
auto parent_class =
@@ -2176,4 +2177,4 @@ bool translation_unit_visitor::should_include(
return diagram().should_include(decl->getQualifiedNameAsString()) &&
diagram().should_include(common::model::source_file{decl_file});
}
}
} // namespace clanguml::sequence_diagram::visitor

View File

@@ -291,4 +291,4 @@ private:
common::model::access_t>>
anonymous_struct_relationships_;
};
}
} // namespace clanguml::sequence_diagram::visitor

View File

@@ -34,4 +34,4 @@ struct substring_delimiter_not_found : public virtual std::runtime_error {
{
}
};
}
} // namespace clanguml::error

View File

@@ -82,5 +82,5 @@ private:
/// All the A pointers
std::vector<A *> as;
};
}
}
} // namespace t00002
} // namespace clanguml

View File

@@ -53,5 +53,5 @@ private:
};
int A::static_int = 1;
}
}
} // namespace t00003
} // namespace clanguml

View File

@@ -51,5 +51,5 @@ public:
};
}
}
}
} // namespace t00004
} // namespace clanguml

View File

@@ -51,5 +51,5 @@ public:
volatile J *j;
mutable K *k;
};
}
}
} // namespace t00005
} // namespace clanguml

View File

@@ -80,5 +80,5 @@ public:
std::tuple<N, NN, NNN> ns;
};
}
}
} // namespace t00006
} // namespace clanguml

View File

@@ -17,5 +17,5 @@ public:
std::shared_ptr<B> b;
std::weak_ptr<C> c;
};
}
}
} // namespace t00007
} // namespace clanguml

View File

@@ -32,5 +32,5 @@ struct D {
void add(int i) { ints.template_template.values.push_back(i); }
};
}
}
} // namespace t00008
} // namespace clanguml

View File

@@ -15,5 +15,5 @@ public:
A<std::string> *astring;
A<std::vector<std::string>> &avector;
};
}
}
} // namespace t00009
} // namespace clanguml

View File

@@ -19,5 +19,5 @@ class C {
public:
B<int> aintstring;
};
}
}
} // namespace t00010
} // namespace clanguml

View File

@@ -29,5 +29,5 @@ public:
void foo() { m_a->foo(); }
A *m_a;
};
}
}
} // namespace t00011
} // namespace clanguml

Some files were not shown because too many files have changed in this diff Show More