Added calls through pointers and references in template instantiation sequence diagram test case

This commit is contained in:
Bartek Kryza
2022-11-29 22:55:49 +01:00
parent 0e3c69ce38
commit 9c3d65bf47
4 changed files with 48 additions and 5 deletions

View File

@@ -567,7 +567,9 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr)
clang::dyn_cast_or_null<clang::CXXDependentScopeMemberExpr>(
function_call_expr->getCallee());
if (!dependent_member_callee->getBaseType().isNull()) {
if (is_callee_valid_template_specialization(
dependent_member_callee)) {
const auto *primary_template =
dependent_member_callee->getBaseType()
->getAs<clang::TemplateSpecializationType>()
@@ -715,6 +717,17 @@ bool translation_unit_visitor::VisitCallExpr(clang::CallExpr *expr)
return true;
}
bool translation_unit_visitor::is_callee_valid_template_specialization(
const clang::CXXDependentScopeMemberExpr *dependent_member_callee) const
{
return !dependent_member_callee->getBaseType().isNull() &&
dependent_member_callee->getBaseType()
->getAs<clang::TemplateSpecializationType>() &&
!dependent_member_callee->getBaseType()
->getAs<clang::TemplateSpecializationType>()
->isPointerType();
}
bool translation_unit_visitor::is_smart_pointer(
const clang::TemplateDecl *primary_template) const
{

View File

@@ -302,6 +302,10 @@ private:
bool is_smart_pointer(const clang::TemplateDecl *primary_template) const;
bool is_callee_valid_template_specialization(
const clang::CXXDependentScopeMemberExpr *dependent_member_callee)
const;
// Reference to the output diagram model
clanguml::sequence_diagram::model::diagram &diagram_;