Adding template class specialization sequence diagram test case
This commit is contained in:
@@ -63,6 +63,38 @@ template_trait::templates() const
|
||||
return templates_;
|
||||
}
|
||||
|
||||
int template_trait::calculate_template_specialization_match(
|
||||
const template_trait &other, const std::string &full_name) const
|
||||
{
|
||||
int res{};
|
||||
|
||||
// std::string left = name_and_ns();
|
||||
// // TODO: handle variadic templates
|
||||
// if ((name_and_ns() != full_name) ||
|
||||
// (templates().size() != other.templates().size())) {
|
||||
// return res;
|
||||
// }
|
||||
|
||||
// Iterate over all template arguments
|
||||
for (auto i = 0U; i < other.templates().size(); i++) {
|
||||
const auto &template_arg = templates().at(i);
|
||||
const auto &other_template_arg = other.templates().at(i);
|
||||
|
||||
if (template_arg == other_template_arg) {
|
||||
res++;
|
||||
}
|
||||
else if (other_template_arg.is_specialization_of(template_arg)) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
res = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
class_::class_(const common::model::namespace_ &using_namespace)
|
||||
: participant{using_namespace}
|
||||
{
|
||||
@@ -122,6 +154,9 @@ std::string class_::full_name(bool relative) const
|
||||
return res;
|
||||
}
|
||||
|
||||
bool operator==(const class_ &l, const class_ &r) { return l.id() == r.id(); }
|
||||
|
||||
|
||||
function::function(const common::model::namespace_ &using_namespace)
|
||||
: participant{using_namespace}
|
||||
{
|
||||
|
||||
@@ -39,6 +39,9 @@ struct template_trait {
|
||||
const std::vector<class_diagram::model::template_parameter> &
|
||||
templates() const;
|
||||
|
||||
int calculate_template_specialization_match(
|
||||
const template_trait &other, const std::string &full_name) const;
|
||||
|
||||
private:
|
||||
std::vector<class_diagram::model::template_parameter> templates_;
|
||||
std::string base_template_full_name_;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -169,7 +169,10 @@ public:
|
||||
|
||||
virtual bool VisitCXXRecordDecl(clang::CXXRecordDecl *cls);
|
||||
|
||||
bool VisitClassTemplateDecl(clang::ClassTemplateDecl *cls);
|
||||
virtual bool VisitClassTemplateDecl(clang::ClassTemplateDecl *cls);
|
||||
|
||||
virtual bool VisitClassTemplateSpecializationDecl(
|
||||
clang::ClassTemplateSpecializationDecl *cls);
|
||||
|
||||
virtual bool VisitFunctionDecl(clang::FunctionDecl *function_declaration);
|
||||
|
||||
@@ -203,7 +206,7 @@ private:
|
||||
build_function_template_instantiation(const clang::FunctionDecl &pDecl);
|
||||
|
||||
void build_template_instantiation_process_template_arguments(
|
||||
std::optional<model::template_trait *> &parent,
|
||||
model::template_trait *parent,
|
||||
std::deque<std::tuple<std::string, int, bool>> &template_base_params,
|
||||
const clang::ArrayRef<clang::TemplateArgument> &template_args,
|
||||
model::template_trait &template_instantiation,
|
||||
@@ -230,13 +233,30 @@ private:
|
||||
class_diagram::model::template_parameter &argument) const;
|
||||
|
||||
void build_template_instantiation_process_type_argument(
|
||||
std::optional<model::template_trait *> &parent,
|
||||
model::template_trait *parent,
|
||||
const std::string &full_template_specialization_name,
|
||||
const clang::TemplateDecl *template_decl,
|
||||
const clang::TemplateArgument &arg,
|
||||
model::template_trait &template_instantiation,
|
||||
class_diagram::model::template_parameter &argument);
|
||||
|
||||
std::unique_ptr<model::class_> process_template_specialization(
|
||||
clang::ClassTemplateSpecializationDecl *cls);
|
||||
|
||||
void process_template_specialization_argument(
|
||||
const clang::ClassTemplateSpecializationDecl *cls,
|
||||
model::class_ &template_instantiation,
|
||||
const clang::TemplateArgument &arg, size_t argument_index,
|
||||
bool in_parameter_pack = false);
|
||||
|
||||
void process_unexposed_template_specialization_parameters(
|
||||
const std::string &type_name,
|
||||
class_diagram::model::template_parameter &tp, model::class_ &c) const;
|
||||
|
||||
std::unique_ptr<model::class_> build_template_instantiation(
|
||||
const clang::TemplateSpecializationType &template_type_decl,
|
||||
model::class_ *parent);
|
||||
|
||||
bool simplify_system_template(class_diagram::model::template_parameter &ct,
|
||||
const std::string &full_name);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user