Fixed class diagram test cases on LLVM 16

This commit is contained in:
Bartek Kryza
2023-03-30 00:31:37 +02:00
parent 15f9f9ae2b
commit c297616b59
8 changed files with 36 additions and 34 deletions

View File

@@ -34,8 +34,12 @@ common::model::access_t class_element::access() const { return access_; }
std::string class_element::name() const { return name_; }
void class_element::set_name(const std::string &name) { name_ = name; }
std::string class_element::type() const { return type_; }
void class_element::set_type(const std::string &type) { type_ = type; }
inja::json class_element::context() const
{
inja::json ctx;

View File

@@ -36,7 +36,10 @@ public:
common::model::access_t access() const;
std::string name() const;
void set_name(const std::string &name);
std::string type() const;
void set_type(const std::string &type);
virtual inja::json context() const;

View File

@@ -986,14 +986,17 @@ bool translation_unit_visitor::process_template_parameters(
const auto *template_nontype_parameter =
clang::dyn_cast_or_null<clang::NonTypeTemplateParmDecl>(
parameter);
std::optional<std::string> default_arg;
if (template_nontype_parameter->hasDefaultArgument())
default_arg = common::to_string(
template_nontype_parameter->getDefaultArgument());
auto ct = template_parameter::make_non_type_template(
template_nontype_parameter->getType().getAsString(),
template_nontype_parameter->getNameAsString(), default_arg,
template_nontype_parameter->isParameterPack());
template_nontype_parameter->getNameAsString(),
default_arg, template_nontype_parameter->isParameterPack());
c.add_template(std::move(ct));
}
@@ -1082,6 +1085,7 @@ void translation_unit_visitor::process_class_bases(
if (const auto *record_type =
base.getType()->getAs<clang::RecordType>();
record_type != nullptr) {
cp.set_name(record_type->getDecl()->getQualifiedNameAsString());
cp.set_id(common::to_id(*record_type->getDecl()));
}
else if (const auto *tsp =
@@ -2543,7 +2547,9 @@ void translation_unit_visitor::
record_type_decl != nullptr) {
argument.set_id(common::to_id(arg));
#if LLVM_VERSION_MAJOR >= 16
argument.set_type(record_type_decl->getQualifiedNameAsString());
#endif
if (diagram().should_include(full_template_specialization_name)) {
// Add dependency relationship to the parent
// template