Force all and extra warnings as errors except for tests
This commit is contained in:
@@ -46,7 +46,8 @@ set(LLVM_PREFERRED_VERSION 12.0.0)
|
|||||||
# to use custom LLVM version
|
# to use custom LLVM version
|
||||||
find_package(LibClang REQUIRED)
|
find_package(LibClang REQUIRED)
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 ${LIBCLANG_CXXFLAGS}")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -std=c++17 ${LIBCLANG_CXXFLAGS}")
|
||||||
|
|
||||||
message(STATUS "Using CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
|
message(STATUS "Using CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
|
||||||
|
|
||||||
# Thirdparty sources
|
# Thirdparty sources
|
||||||
|
|||||||
@@ -450,8 +450,6 @@ void generator::generate(const package &p, std::ostream &ostr) const
|
|||||||
void generator::generate_relationships(
|
void generator::generate_relationships(
|
||||||
const package &p, std::ostream &ostr) const
|
const package &p, std::ostream &ostr) const
|
||||||
{
|
{
|
||||||
const auto &uns = m_config.using_namespace();
|
|
||||||
|
|
||||||
for (const auto &subpackage : p) {
|
for (const auto &subpackage : p) {
|
||||||
if (dynamic_cast<package *>(subpackage.get())) {
|
if (dynamic_cast<package *>(subpackage.get())) {
|
||||||
// TODO: add option - generate_empty_packages
|
// TODO: add option - generate_empty_packages
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ int class_::calculate_template_specialization_match(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Iterate over all template arguments
|
// Iterate over all template arguments
|
||||||
for (int i = 0; i < other.templates().size(); i++) {
|
for (auto i = 0U; i < other.templates().size(); i++) {
|
||||||
const auto &template_arg = templates().at(i);
|
const auto &template_arg = templates().at(i);
|
||||||
const auto &other_template_arg = other.templates().at(i);
|
const auto &other_template_arg = other.templates().at(i);
|
||||||
|
|
||||||
|
|||||||
@@ -901,10 +901,10 @@ void translation_unit_visitor::process_field(
|
|||||||
!template_instantiation_added_as_aggregation &&
|
!template_instantiation_added_as_aggregation &&
|
||||||
(tr.kind() != cppast::cpp_type_kind::builtin_t) &&
|
(tr.kind() != cppast::cpp_type_kind::builtin_t) &&
|
||||||
(tr.kind() != cppast::cpp_type_kind::template_parameter_t)) {
|
(tr.kind() != cppast::cpp_type_kind::template_parameter_t)) {
|
||||||
const auto &ttt = resolve_alias(mv.type());
|
|
||||||
|
|
||||||
found_relationships_t relationships;
|
found_relationships_t relationships;
|
||||||
auto found = find_relationships(ttt, relationships);
|
|
||||||
|
const auto &unaliased_type = resolve_alias(mv.type());
|
||||||
|
find_relationships(unaliased_type, relationships);
|
||||||
|
|
||||||
for (const auto &[type, relationship_type] : relationships) {
|
for (const auto &[type, relationship_type] : relationships) {
|
||||||
if (relationship_type != relationship_t::kNone) {
|
if (relationship_type != relationship_t::kNone) {
|
||||||
@@ -1350,9 +1350,9 @@ void translation_unit_visitor::process_friend(const cppast::cpp_friend &f,
|
|||||||
{
|
{
|
||||||
// Only process friends to other classes or class templates
|
// Only process friends to other classes or class templates
|
||||||
if (!f.entity() ||
|
if (!f.entity() ||
|
||||||
(f.entity().value().kind() != cppast::cpp_entity_kind::class_t) &&
|
((f.entity().value().kind() != cppast::cpp_entity_kind::class_t) &&
|
||||||
(f.entity().value().kind() !=
|
(f.entity().value().kind() !=
|
||||||
cppast::cpp_entity_kind::class_template_t))
|
cppast::cpp_entity_kind::class_template_t)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
relationship r{relationship_t::kFriendship, "",
|
relationship r{relationship_t::kFriendship, "",
|
||||||
@@ -1384,11 +1384,11 @@ void translation_unit_visitor::process_friend(const cppast::cpp_friend &f,
|
|||||||
f.entity().value());
|
f.entity().value());
|
||||||
const auto &class_ = ft.class_();
|
const auto &class_ = ft.class_();
|
||||||
auto scope = cppast::cpp_scope_name(type_safe::ref(ft));
|
auto scope = cppast::cpp_scope_name(type_safe::ref(ft));
|
||||||
if (ft.class_().user_data() == nullptr) {
|
if (class_.user_data() == nullptr) {
|
||||||
spdlog::warn(
|
spdlog::warn(
|
||||||
"Empty user data in friend class template: {}, {}, {}",
|
"Empty user data in friend class template: {}, {}, {}",
|
||||||
ft.name(),
|
ft.name(),
|
||||||
fmt::ptr(reinterpret_cast<const void *>(&ft.class_())),
|
fmt::ptr(reinterpret_cast<const void *>(&class_)),
|
||||||
scope.name());
|
scope.name());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1940,8 +1940,6 @@ void translation_unit_visitor::
|
|||||||
const auto &function_argument =
|
const auto &function_argument =
|
||||||
static_cast<const cppast::cpp_function_type &>(targ_type);
|
static_cast<const cppast::cpp_function_type &>(targ_type);
|
||||||
|
|
||||||
const auto &rt = function_argument.return_type();
|
|
||||||
|
|
||||||
// Search for relationships in argument return type
|
// Search for relationships in argument return type
|
||||||
// TODO...
|
// TODO...
|
||||||
|
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ std::unique_ptr<DiagramModel> generate(
|
|||||||
|
|
||||||
diagram->set_complete(true);
|
diagram->set_complete(true);
|
||||||
|
|
||||||
return std::move(diagram);
|
return diagram;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename C, typename D> void generator<C, D>::init_context()
|
template <typename C, typename D> void generator<C, D>::init_context()
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public:
|
|||||||
|
|
||||||
std::string name() const { return name_; }
|
std::string name() const { return name_; }
|
||||||
|
|
||||||
virtual std::string full_name(bool relative) const { return name(); }
|
virtual std::string full_name(bool /*relative*/) const { return name(); }
|
||||||
|
|
||||||
std::vector<relationship> &relationships();
|
std::vector<relationship> &relationships();
|
||||||
|
|
||||||
|
|||||||
@@ -90,31 +90,31 @@ filter_visitor::filter_visitor(filter_t type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
tvl::value_t filter_visitor::match(
|
tvl::value_t filter_visitor::match(
|
||||||
const diagram &d, const common::model::element &e) const
|
const diagram & /*d*/, const common::model::element & /*e*/) const
|
||||||
{
|
{
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
tvl::value_t filter_visitor::match(
|
tvl::value_t filter_visitor::match(
|
||||||
const diagram &d, const common::model::relationship_t &r) const
|
const diagram & /*d*/, const common::model::relationship_t & /*r*/) const
|
||||||
{
|
{
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
tvl::value_t filter_visitor::match(
|
tvl::value_t filter_visitor::match(
|
||||||
const diagram &d, const common::model::access_t &a) const
|
const diagram & /*d*/, const common::model::access_t & /*a*/) const
|
||||||
{
|
{
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
tvl::value_t filter_visitor::match(
|
tvl::value_t filter_visitor::match(
|
||||||
const diagram &d, const common::model::namespace_ &ns) const
|
const diagram & /*d*/, const common::model::namespace_ & /*ns*/) const
|
||||||
{
|
{
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
tvl::value_t filter_visitor::match(
|
tvl::value_t filter_visitor::match(
|
||||||
const diagram &d, const common::model::source_file &f) const
|
const diagram & /*d*/, const common::model::source_file & /*f*/) const
|
||||||
{
|
{
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@@ -160,7 +160,7 @@ namespace_filter::namespace_filter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
tvl::value_t namespace_filter::match(
|
tvl::value_t namespace_filter::match(
|
||||||
const diagram &d, const namespace_ &ns) const
|
const diagram & /*d*/, const namespace_ &ns) const
|
||||||
{
|
{
|
||||||
if (ns.is_empty())
|
if (ns.is_empty())
|
||||||
return {};
|
return {};
|
||||||
@@ -169,7 +169,8 @@ tvl::value_t namespace_filter::match(
|
|||||||
[&ns](const auto &nsit) { return ns.starts_with(nsit) || ns == nsit; });
|
[&ns](const auto &nsit) { return ns.starts_with(nsit) || ns == nsit; });
|
||||||
}
|
}
|
||||||
|
|
||||||
tvl::value_t namespace_filter::match(const diagram &d, const element &e) const
|
tvl::value_t namespace_filter::match(
|
||||||
|
const diagram & /*d*/, const element &e) const
|
||||||
{
|
{
|
||||||
if (dynamic_cast<const package *>(&e) != nullptr) {
|
if (dynamic_cast<const package *>(&e) != nullptr) {
|
||||||
return tvl::any_of(
|
return tvl::any_of(
|
||||||
@@ -193,7 +194,8 @@ element_filter::element_filter(filter_t type, std::vector<std::string> elements)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
tvl::value_t element_filter::match(const diagram &d, const element &e) const
|
tvl::value_t element_filter::match(
|
||||||
|
const diagram & /*d*/, const element &e) const
|
||||||
{
|
{
|
||||||
return tvl::any_of(elements_.begin(), elements_.end(),
|
return tvl::any_of(elements_.begin(), elements_.end(),
|
||||||
[&e](const auto &el) { return e.full_name(false) == el; });
|
[&e](const auto &el) { return e.full_name(false) == el; });
|
||||||
@@ -253,7 +255,7 @@ relationship_filter::relationship_filter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
tvl::value_t relationship_filter::match(
|
tvl::value_t relationship_filter::match(
|
||||||
const diagram &d, const relationship_t &r) const
|
const diagram & /*d*/, const relationship_t &r) const
|
||||||
{
|
{
|
||||||
return tvl::any_of(relationships_.begin(), relationships_.end(),
|
return tvl::any_of(relationships_.begin(), relationships_.end(),
|
||||||
[&r](const auto &rel) { return r == rel; });
|
[&r](const auto &rel) { return r == rel; });
|
||||||
@@ -265,7 +267,8 @@ access_filter::access_filter(filter_t type, std::vector<access_t> access)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
tvl::value_t access_filter::match(const diagram &d, const access_t &a) const
|
tvl::value_t access_filter::match(
|
||||||
|
const diagram & /*d*/, const access_t &a) const
|
||||||
{
|
{
|
||||||
return tvl::any_of(access_.begin(), access_.end(),
|
return tvl::any_of(access_.begin(), access_.end(),
|
||||||
[&a](const auto &access) { return a == access; });
|
[&a](const auto &access) { return a == access; });
|
||||||
@@ -349,7 +352,7 @@ paths_filter::paths_filter(filter_t type, const std::filesystem::path &root,
|
|||||||
}
|
}
|
||||||
|
|
||||||
tvl::value_t paths_filter::match(
|
tvl::value_t paths_filter::match(
|
||||||
const diagram &d, const common::model::source_file &p) const
|
const diagram & /*d*/, const common::model::source_file &p) const
|
||||||
{
|
{
|
||||||
if (paths_.empty()) {
|
if (paths_.empty()) {
|
||||||
return {};
|
return {};
|
||||||
|
|||||||
@@ -131,8 +131,8 @@ struct edge_traversal_filter : public filter_visitor {
|
|||||||
edge_traversal_filter(filter_t type, relationship_t relationship,
|
edge_traversal_filter(filter_t type, relationship_t relationship,
|
||||||
std::vector<std::string> roots, bool forward = false)
|
std::vector<std::string> roots, bool forward = false)
|
||||||
: filter_visitor{type}
|
: filter_visitor{type}
|
||||||
, relationship_{relationship}
|
|
||||||
, roots_{roots}
|
, roots_{roots}
|
||||||
|
, relationship_{relationship}
|
||||||
, forward_{forward}
|
, forward_{forward}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public:
|
|||||||
|
|
||||||
const namespace_ &path() const { return ns_; }
|
const namespace_ &path() const { return ns_; }
|
||||||
|
|
||||||
std::string full_name(bool relative) const override
|
std::string full_name(bool /*relative*/) const override
|
||||||
{
|
{
|
||||||
return name_and_ns();
|
return name_and_ns();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,10 +26,10 @@ relationship::relationship(relationship_t type, const std::string &destination,
|
|||||||
const std::string &multiplicity_destination)
|
const std::string &multiplicity_destination)
|
||||||
: type_{type}
|
: type_{type}
|
||||||
, destination_{destination}
|
, destination_{destination}
|
||||||
, access_{access}
|
|
||||||
, label_{label}
|
|
||||||
, multiplicity_source_{multiplicity_source}
|
, multiplicity_source_{multiplicity_source}
|
||||||
, multiplicity_destination_{multiplicity_destination}
|
, multiplicity_destination_{multiplicity_destination}
|
||||||
|
, label_{label}
|
||||||
|
, access_{access}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,11 +56,11 @@ public:
|
|||||||
friend bool operator==(const relationship &l, const relationship &r);
|
friend bool operator==(const relationship &l, const relationship &r);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
relationship_t type_{relationship_t::kAssociation};
|
relationship_t type_;
|
||||||
std::string destination_;
|
std::string destination_;
|
||||||
std::string multiplicity_source_;
|
std::string multiplicity_source_;
|
||||||
std::string multiplicity_destination_;
|
std::string multiplicity_destination_;
|
||||||
std::string label_;
|
std::string label_;
|
||||||
access_t access_{access_t::kPublic};
|
access_t access_;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public:
|
|||||||
|
|
||||||
const filesystem_path &path() const { return path_; }
|
const filesystem_path &path() const { return path_; }
|
||||||
|
|
||||||
std::string full_name(bool relative) const override
|
std::string full_name(bool /*relative*/) const override
|
||||||
{
|
{
|
||||||
return (path_ | name()).to_string();
|
return (path_ | name()).to_string();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,7 +262,6 @@ parse_unexposed_template_params(const std::string ¶ms,
|
|||||||
|
|
||||||
std::vector<template_parameter> res;
|
std::vector<template_parameter> res;
|
||||||
|
|
||||||
int nested_template_level{0};
|
|
||||||
auto it = params.begin();
|
auto it = params.begin();
|
||||||
|
|
||||||
std::string type{};
|
std::string type{};
|
||||||
|
|||||||
@@ -119,12 +119,13 @@ std::shared_ptr<decorator> note::from_string(std::string_view c)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<decorator> skip::from_string(std::string_view c)
|
std::shared_ptr<decorator> skip::from_string(std::string_view /*c*/)
|
||||||
{
|
{
|
||||||
return std::make_shared<skip>();
|
return std::make_shared<skip>();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<decorator> skip_relationship::from_string(std::string_view c)
|
std::shared_ptr<decorator> skip_relationship::from_string(
|
||||||
|
std::string_view /*c*/)
|
||||||
{
|
{
|
||||||
return std::make_shared<skip_relationship>();
|
return std::make_shared<skip_relationship>();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ void translation_unit_visitor::operator()(const cppast::cpp_entity &file)
|
|||||||
process_source_file(static_cast<const cppast::cpp_file &>(file));
|
process_source_file(static_cast<const cppast::cpp_file &>(file));
|
||||||
|
|
||||||
cppast::visit(file,
|
cppast::visit(file,
|
||||||
[&, this](const cppast::cpp_entity &e, cppast::visitor_info info) {
|
[&, this](const cppast::cpp_entity &e, cppast::visitor_info /*info*/) {
|
||||||
if (e.kind() == cppast::cpp_entity_kind::include_directive_t) {
|
if (e.kind() == cppast::cpp_entity_kind::include_directive_t) {
|
||||||
const auto &inc =
|
const auto &inc =
|
||||||
static_cast<const cppast::cpp_include_directive &>(e);
|
static_cast<const cppast::cpp_include_directive &>(e);
|
||||||
|
|||||||
@@ -215,34 +215,26 @@ void translation_unit_visitor::operator()(const cppast::cpp_entity &file)
|
|||||||
LOG_DBG("========== Visiting '{}' - {}",
|
LOG_DBG("========== Visiting '{}' - {}",
|
||||||
cx::util::full_name(ctx.get_namespace(), e),
|
cx::util::full_name(ctx.get_namespace(), e),
|
||||||
cppast::to_string(e.kind()));
|
cppast::to_string(e.kind()));
|
||||||
|
|
||||||
auto &at = static_cast<const cppast::cpp_alias_template &>(e);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void translation_unit_visitor::process_class_declaration(
|
void translation_unit_visitor::process_class_declaration(
|
||||||
const cppast::cpp_class &cls,
|
const cppast::cpp_class &cls,
|
||||||
type_safe::optional_ref<const cppast::cpp_template_specialization> tspec)
|
type_safe::optional_ref<
|
||||||
|
const cppast::cpp_template_specialization> /*tspec*/)
|
||||||
{
|
{
|
||||||
auto current_package = ctx.get_current_package();
|
auto current_package = ctx.get_current_package();
|
||||||
|
|
||||||
if (!current_package)
|
if (!current_package)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cppast::cpp_access_specifier_kind last_access_specifier =
|
|
||||||
cppast::cpp_access_specifier_kind::cpp_private;
|
|
||||||
|
|
||||||
std::vector<std::pair<std::string, relationship_t>> relationships;
|
std::vector<std::pair<std::string, relationship_t>> relationships;
|
||||||
|
|
||||||
// Process class elements
|
// Process class elements
|
||||||
for (auto &child : cls) {
|
for (auto &child : cls) {
|
||||||
auto name = child.name();
|
auto name = child.name();
|
||||||
if (child.kind() == cppast::cpp_entity_kind::access_specifier_t) {
|
if (child.kind() == cppast::cpp_entity_kind::member_variable_t) {
|
||||||
auto &as = static_cast<const cppast::cpp_access_specifier &>(child);
|
|
||||||
last_access_specifier = as.access_specifier();
|
|
||||||
}
|
|
||||||
else if (child.kind() == cppast::cpp_entity_kind::member_variable_t) {
|
|
||||||
auto &mv = static_cast<const cppast::cpp_member_variable &>(child);
|
auto &mv = static_cast<const cppast::cpp_member_variable &>(child);
|
||||||
find_relationships(
|
find_relationships(
|
||||||
mv.type(), relationships, relationship_t::kDependency);
|
mv.type(), relationships, relationship_t::kDependency);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ common::model::diagram_t diagram::type() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
type_safe::optional_ref<const common::model::diagram_element> diagram::get(
|
type_safe::optional_ref<const common::model::diagram_element> diagram::get(
|
||||||
const std::string &full_name) const
|
const std::string & /*full_name*/) const
|
||||||
{
|
{
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ void translation_unit_visitor::operator()(const cppast::cpp_entity &file)
|
|||||||
using cppast::cpp_member_function_call;
|
using cppast::cpp_member_function_call;
|
||||||
using cppast::visitor_info;
|
using cppast::visitor_info;
|
||||||
|
|
||||||
cppast::visit(file, [&, this](const cpp_entity &e, visitor_info info) {
|
cppast::visit(file, [&, this](const cpp_entity &e, visitor_info /*info*/) {
|
||||||
if (e.kind() == cpp_entity_kind::function_t) {
|
if (e.kind() == cpp_entity_kind::function_t) {
|
||||||
const auto &function = static_cast<const cpp_function &>(e);
|
const auto &function = static_cast<const cpp_function &>(e);
|
||||||
process_activities(function);
|
process_activities(function);
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ std::vector<std::string> split(std::string str, std::string_view delimiter)
|
|||||||
result.push_back(str);
|
result.push_back(str);
|
||||||
else
|
else
|
||||||
while (str.size()) {
|
while (str.size()) {
|
||||||
int index = str.find(delimiter);
|
auto index = str.find(delimiter);
|
||||||
if (index != std::string::npos) {
|
if (index != std::string::npos) {
|
||||||
result.push_back(str.substr(0, index));
|
result.push_back(str.substr(0, index));
|
||||||
str = str.substr(index + delimiter.size());
|
str = str.substr(index + delimiter.size());
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_FLAGS "-std=c++17 ${LIBCLANG_CXXFLAGS}")
|
||||||
|
|
||||||
file(GLOB_RECURSE TEST_CASE_SOURCES t*/*.cc)
|
file(GLOB_RECURSE TEST_CASE_SOURCES t*/*.cc)
|
||||||
file(GLOB_RECURSE TEST_CASE_CONFIGS t*/.clang-uml)
|
file(GLOB_RECURSE TEST_CASE_CONFIGS t*/.clang-uml)
|
||||||
file(GLOB_RECURSE TEST_CONFIG_YMLS test_config_data/*.yml)
|
file(GLOB_RECURSE TEST_CONFIG_YMLS test_config_data/*.yml)
|
||||||
|
|||||||
Reference in New Issue
Block a user