Fixed test cases on LLVM 16
This commit is contained in:
@@ -582,13 +582,16 @@ clang::QualType template_builder::consume_context(
|
||||
template_parameter template_builder::process_type_argument(
|
||||
std::optional<clanguml::class_diagram::model::class_ *> &parent,
|
||||
const clang::NamedDecl *cls, const clang::TemplateDecl *template_decl,
|
||||
// const clang::TemplateArgument &arg,
|
||||
clang::QualType type, class_ &template_instantiation, size_t argument_index)
|
||||
{
|
||||
auto type_name = common::to_string(type, &cls->getASTContext());
|
||||
|
||||
std::optional<template_parameter> argument;
|
||||
|
||||
if (type->getAs<clang::ElaboratedType>() != nullptr) {
|
||||
type = type->getAs<clang::ElaboratedType>()->getNamedType();
|
||||
}
|
||||
|
||||
auto type_name = common::to_string(type, &cls->getASTContext());
|
||||
|
||||
LOG_DBG("Processing template {} type argument {}: {}, {}, {}",
|
||||
template_decl->getQualifiedNameAsString(), argument_index, type_name,
|
||||
type->getTypeClassName(),
|
||||
@@ -676,8 +679,6 @@ bool template_builder::find_relationships_in_unexposed_template_params(
|
||||
return found;
|
||||
}
|
||||
|
||||
// using token_it = std::vector<std::string>::const_iterator;
|
||||
|
||||
namespace detail {
|
||||
|
||||
std::string map_type_parameter_to_template_parameter(
|
||||
@@ -1107,6 +1108,7 @@ std::optional<template_parameter> template_builder::try_as_record_type(
|
||||
type = consume_context(type, argument);
|
||||
|
||||
auto type_name = common::to_string(type, template_decl->getASTContext());
|
||||
|
||||
argument.set_type(type_name);
|
||||
const auto type_id = common::to_id(type_name);
|
||||
argument.set_id(type_id);
|
||||
@@ -1138,9 +1140,6 @@ std::optional<template_parameter> template_builder::try_as_record_type(
|
||||
}
|
||||
else if (const auto *record_type_decl = record_type->getAsRecordDecl();
|
||||
record_type_decl != nullptr) {
|
||||
#if LLVM_VERSION_MAJOR >= 16
|
||||
argument.set_type(record_type_decl->getQualifiedNameAsString());
|
||||
#endif
|
||||
if (diagram().should_include(type_name)) {
|
||||
// Add dependency relationship to the parent
|
||||
// template
|
||||
|
||||
@@ -102,10 +102,8 @@ public:
|
||||
template_parameter process_type_argument(
|
||||
std::optional<clanguml::class_diagram::model::class_ *> &parent,
|
||||
const clang::NamedDecl *cls,
|
||||
const clang::TemplateDecl *base_template_decl,
|
||||
// const clang::TemplateArgument &arg,
|
||||
clang::QualType type, model::class_ &template_instantiation,
|
||||
size_t argument_index);
|
||||
const clang::TemplateDecl *base_template_decl, clang::QualType type,
|
||||
model::class_ &template_instantiation, size_t argument_index);
|
||||
|
||||
common::model::template_parameter process_template_argument(
|
||||
const clang::TemplateArgument &arg);
|
||||
|
||||
@@ -1839,7 +1839,6 @@ void translation_unit_visitor::process_field(
|
||||
// Process the type which is template instantiation of some sort
|
||||
if (template_field_type != nullptr &&
|
||||
!field_type_is_template_template_parameter) {
|
||||
|
||||
// Build the template instantiation for the field type
|
||||
auto template_specialization_ptr =
|
||||
tbuilder().build(&field_declaration, *template_field_type, {&c});
|
||||
|
||||
@@ -116,8 +116,8 @@ std::string to_string(const clang::QualType &type, const clang::ASTContext &ctx,
|
||||
bool try_canonical)
|
||||
{
|
||||
clang::PrintingPolicy print_policy(ctx.getLangOpts());
|
||||
print_policy.SuppressScope = false;
|
||||
print_policy.PrintCanonicalTypes = false;
|
||||
print_policy.SuppressScope = 0;
|
||||
print_policy.PrintCanonicalTypes = 0;
|
||||
|
||||
std::string result;
|
||||
|
||||
|
||||
@@ -154,7 +154,6 @@ TEST_CASE("t00014", "[test-case][class]")
|
||||
REQUIRE(json::IsClass(j, "A<std::string,std::string>"));
|
||||
REQUIRE(json::IsClass(j, "A<char,std::string>"));
|
||||
REQUIRE(json::IsClass(j, "B"));
|
||||
|
||||
save_json(config.output_directory() + "/" + diagram->name + ".json", j);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user