Fixed up to t00013
This commit is contained in:
@@ -246,7 +246,7 @@ void generator::generate_relationships(
|
||||
{
|
||||
namespace plantuml_common = clanguml::common::generators::plantuml;
|
||||
|
||||
// const auto &uns = m_config.using_namespace();
|
||||
// const auto &uns = m_config.using_namespace();
|
||||
|
||||
//
|
||||
// Process relationships
|
||||
@@ -270,8 +270,9 @@ void generator::generate_relationships(
|
||||
|
||||
// TODO: Refactor destination to a namespace qualified entity
|
||||
// name
|
||||
// if (util::starts_with(destination, std::string{"::"}))
|
||||
// destination = destination.substr(2, destination.size());
|
||||
// if (util::starts_with(destination, std::string{"::"}))
|
||||
// destination = destination.substr(2,
|
||||
// destination.size());
|
||||
|
||||
LOG_DBG("=== Destination is: {}", destination);
|
||||
|
||||
@@ -284,7 +285,14 @@ void generator::generate_relationships(
|
||||
if (!r.multiplicity_destination().empty())
|
||||
puml_relation += " \"" + r.multiplicity_destination() + "\"";
|
||||
|
||||
auto target_alias = m_model.to_alias(destination);
|
||||
std::string target_alias;
|
||||
try {
|
||||
target_alias = m_model.to_alias(destination);
|
||||
}
|
||||
catch (...) {
|
||||
LOG_ERROR("Failed to find alias to {}", destination);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (m_generated_aliases.find(target_alias) ==
|
||||
m_generated_aliases.end())
|
||||
|
||||
@@ -77,7 +77,13 @@ std::optional<std::reference_wrapper<const class_>> diagram::get_class(
|
||||
const std::string &name) const
|
||||
{
|
||||
for (const auto &c : classes_) {
|
||||
if (c.get().full_name(false) == name) {
|
||||
const auto full_name = c.get().full_name(false);
|
||||
if (name ==
|
||||
"clanguml::t00012::C<std::map<int,std::vector<std::vector<std::"
|
||||
"vector<std::string>>>>,3,3,3>")
|
||||
LOG_ERROR("Comparing {} with {}", full_name, name);
|
||||
|
||||
if (full_name == name) {
|
||||
return {c};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,6 +84,8 @@ public:
|
||||
|
||||
const std::vector<template_parameter> &template_params() const;
|
||||
|
||||
void clear_params() { template_params_.clear(); }
|
||||
|
||||
void find_nested_relationships(
|
||||
std::vector<std::pair<std::string, common::model::relationship_t>>
|
||||
&nested_relationships,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -44,6 +44,8 @@ public:
|
||||
clanguml::class_diagram::model::diagram &diagram,
|
||||
const clanguml::config::class_diagram &config);
|
||||
|
||||
virtual bool VisitNamespaceDecl(clang::NamespaceDecl *ns);
|
||||
|
||||
virtual bool VisitCXXRecordDecl(clang::CXXRecordDecl *d);
|
||||
|
||||
virtual bool VisitEnumDecl(clang::EnumDecl *e);
|
||||
@@ -53,6 +55,9 @@ public:
|
||||
|
||||
// virtual bool VisitVarDecl(clang::VarDecl *variable_declaration);
|
||||
clanguml::class_diagram::model::diagram &diagram() { return diagram_; }
|
||||
|
||||
const clanguml::config::class_diagram &config() const { return config_; }
|
||||
|
||||
// void operator()();
|
||||
|
||||
private:
|
||||
@@ -75,6 +80,9 @@ private:
|
||||
void process_method(const clang::CXXMethodDecl &mf,
|
||||
clanguml::class_diagram::model::class_ &c);
|
||||
|
||||
void process_template_method(const clang::FunctionTemplateDecl &mf,
|
||||
clanguml::class_diagram::model::class_ &c);
|
||||
|
||||
void process_static_field(const clang::VarDecl &field_declaration,
|
||||
clanguml::class_diagram::model::class_ &c);
|
||||
|
||||
@@ -106,6 +114,11 @@ private:
|
||||
const clang::TemplateSpecializationType &template_type,
|
||||
std::optional<clanguml::class_diagram::model::class_ *> parent = {});
|
||||
|
||||
void process_function_parameter_find_relationships_in_template(
|
||||
clanguml::class_diagram::model::class_ &c,
|
||||
const std::set<std::string> &template_parameter_names,
|
||||
const clang::TemplateSpecializationType &template_instantiation_type);
|
||||
|
||||
template <typename ClangDecl>
|
||||
void process_comment(
|
||||
const ClangDecl &decl, clanguml::common::model::decorated_element &e)
|
||||
@@ -125,6 +138,9 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
bool simplify_system_template(
|
||||
model::template_parameter &ct, const std::string &full_name);
|
||||
|
||||
clang::SourceManager &source_manager_;
|
||||
|
||||
// Reference to the output diagram model
|
||||
|
||||
@@ -194,9 +194,12 @@ void generator<C, D>::generate_plantuml_directives(
|
||||
directive.replace(std::get<1>(alias_match),
|
||||
std::get<2>(alias_match),
|
||||
element_opt.value().get().alias());
|
||||
else
|
||||
else {
|
||||
LOG_ERROR(
|
||||
"CANNOT FIND ALIAS TO ELEMENT {}", full_name.to_string());
|
||||
directive.replace(std::get<1>(alias_match),
|
||||
std::get<2>(alias_match), "UNKNOWN_ALIAS");
|
||||
}
|
||||
}
|
||||
ostr << directive << '\n';
|
||||
}
|
||||
|
||||
@@ -22,13 +22,14 @@ template <typename T, int... Is> class C {
|
||||
};
|
||||
|
||||
class R {
|
||||
A<int, std::string, float> a1;
|
||||
A<int, std::string, bool> a2;
|
||||
[[maybe_unused]] A<int, std::string, float> a1;
|
||||
[[maybe_unused]] A<int, std::string, bool> a2;
|
||||
|
||||
B<3, 2, 1> b1;
|
||||
B<1, 1, 1, 1> b2;
|
||||
[[maybe_unused]] B<3, 2, 1> b1;
|
||||
[[maybe_unused]] B<1, 1, 1, 1> b2;
|
||||
|
||||
C<std::map<int, std::vector<std::vector<std::vector<std::string>>>>, 3, 3,
|
||||
[[maybe_unused]] C<
|
||||
std::map<int, std::vector<std::vector<std::vector<std::string>>>>, 3, 3,
|
||||
3>
|
||||
c1;
|
||||
};
|
||||
|
||||
@@ -24,7 +24,7 @@ TEST_CASE("t00012", "[test-case][class]")
|
||||
|
||||
REQUIRE(diagram->name == "t00012_class");
|
||||
|
||||
auto model = generate_class_diagram(db, diagram);
|
||||
auto model = generate_class_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t00012_class");
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ TEST_CASE("t00013", "[test-case][class]")
|
||||
|
||||
REQUIRE(diagram->name == "t00013_class");
|
||||
|
||||
auto model = generate_class_diagram(db, diagram);
|
||||
auto model = generate_class_diagram(*db, diagram);
|
||||
|
||||
REQUIRE(model->name() == "t00013_class");
|
||||
REQUIRE(model->should_include("clanguml::t00013::A"));
|
||||
@@ -56,8 +56,8 @@ TEST_CASE("t00013", "[test-case][class]")
|
||||
REQUIRE_THAT(
|
||||
puml, IsAggregation(_A("R"), _A("E<std::string>"), "-estring"));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("ABCD::F<T>")));
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("ABCD::F<T>"), _A("F<int>")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("F<int>")));
|
||||
REQUIRE_THAT(puml, IsInstantiation(_A("ABCD::F<T>"), _A("ABCD::F<int>")));
|
||||
REQUIRE_THAT(puml, IsDependency(_A("R"), _A("ABCD::F<int>")));
|
||||
|
||||
REQUIRE_THAT(puml,
|
||||
IsInstantiation(_A("G<T,Args...>"), _A("G<int,float,std::string>")));
|
||||
|
||||
@@ -200,8 +200,8 @@ using namespace clanguml::test::matchers;
|
||||
#include "t00009/test_case.h"
|
||||
#include "t00010/test_case.h"
|
||||
#include "t00011/test_case.h"
|
||||
//#include "t00012/test_case.h"
|
||||
//#include "t00013/test_case.h"
|
||||
#include "t00012/test_case.h"
|
||||
#include "t00013/test_case.h"
|
||||
//#include "t00014/test_case.h"
|
||||
//#include "t00015/test_case.h"
|
||||
//#include "t00016/test_case.h"
|
||||
|
||||
Reference in New Issue
Block a user