Fixed nested anonymous namespace regression
This commit is contained in:
@@ -167,11 +167,6 @@ bool translation_unit_visitor::VisitEnumDecl(clang::EnumDecl *enm)
|
|||||||
e.constants().push_back(ev->getNameAsString());
|
e.constants().push_back(ev->getNameAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
auto namespace_declaration = common::get_enclosing_namespace(enm);
|
|
||||||
if (namespace_declaration.has_value()) {
|
|
||||||
e.set_namespace(namespace_declaration.value());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (diagram().should_include(qualified_name))
|
if (diagram().should_include(qualified_name))
|
||||||
diagram().add_enum(std::move(e_ptr));
|
diagram().add_enum(std::move(e_ptr));
|
||||||
|
|
||||||
@@ -202,8 +197,11 @@ bool translation_unit_visitor::VisitClassTemplateSpecializationDecl(
|
|||||||
|
|
||||||
auto &template_specialization = *template_specialization_ptr;
|
auto &template_specialization = *template_specialization_ptr;
|
||||||
|
|
||||||
|
if (cls->hasBody()) {
|
||||||
process_template_specialization_children(cls, template_specialization);
|
process_template_specialization_children(cls, template_specialization);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cls->hasDefinition())
|
||||||
// Process template specialization bases
|
// Process template specialization bases
|
||||||
process_class_bases(cls, template_specialization);
|
process_class_bases(cls, template_specialization);
|
||||||
|
|
||||||
@@ -1035,10 +1033,8 @@ void translation_unit_visitor::process_record_containment(
|
|||||||
auto parent_name = static_cast<const clang::RecordDecl *>(parent)
|
auto parent_name = static_cast<const clang::RecordDecl *>(parent)
|
||||||
->getQualifiedNameAsString();
|
->getQualifiedNameAsString();
|
||||||
|
|
||||||
auto namespace_declaration = common::get_enclosing_namespace(parent);
|
auto namespace_declaration = common::get_tag_namespace(record);
|
||||||
if (namespace_declaration.has_value()) {
|
element.set_namespace(namespace_declaration);
|
||||||
element.set_namespace(namespace_declaration.value());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (const auto *record_decl =
|
if (const auto *record_decl =
|
||||||
clang::dyn_cast<clang::RecordDecl>(record.getParent());
|
clang::dyn_cast<clang::RecordDecl>(record.getParent());
|
||||||
@@ -1150,9 +1146,11 @@ void translation_unit_visitor::process_template_specialization_children(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cls->hasFriends()) {
|
||||||
for (const auto *friend_declaration : cls->friends()) {
|
for (const auto *friend_declaration : cls->friends()) {
|
||||||
process_friend(*friend_declaration, c);
|
process_friend(*friend_declaration, c);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void translation_unit_visitor::process_record_members(
|
void translation_unit_visitor::process_record_members(
|
||||||
@@ -1747,6 +1745,14 @@ translation_unit_visitor::process_template_specialization(
|
|||||||
|
|
||||||
template_instantiation.is_struct(cls->isStruct());
|
template_instantiation.is_struct(cls->isStruct());
|
||||||
|
|
||||||
|
process_record_parent(cls, template_instantiation, namespace_{});
|
||||||
|
|
||||||
|
if (!template_instantiation.is_nested()) {
|
||||||
|
template_instantiation.set_name(common::get_tag_name(*cls));
|
||||||
|
template_instantiation.set_id(
|
||||||
|
common::to_id(template_instantiation.full_name(false)));
|
||||||
|
}
|
||||||
|
|
||||||
process_comment(*cls, template_instantiation);
|
process_comment(*cls, template_instantiation);
|
||||||
set_source_location(*cls, template_instantiation);
|
set_source_location(*cls, template_instantiation);
|
||||||
|
|
||||||
|
|||||||
@@ -43,23 +43,6 @@ model::access_t access_specifier_to_access_t(
|
|||||||
return access;
|
return access;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<clanguml::common::model::namespace_> get_enclosing_namespace(
|
|
||||||
const clang::DeclContext *decl)
|
|
||||||
{
|
|
||||||
if (!decl->getEnclosingNamespaceContext()->isNamespace())
|
|
||||||
return {};
|
|
||||||
|
|
||||||
const auto *namespace_declaration =
|
|
||||||
clang::cast<clang::NamespaceDecl>(decl->getEnclosingNamespaceContext());
|
|
||||||
|
|
||||||
if (namespace_declaration == nullptr) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
return clanguml::common::model::namespace_{
|
|
||||||
common::get_qualified_name(*namespace_declaration)};
|
|
||||||
}
|
|
||||||
|
|
||||||
model::namespace_ get_tag_namespace(const clang::TagDecl &declaration)
|
model::namespace_ get_tag_namespace(const clang::TagDecl &declaration)
|
||||||
{
|
{
|
||||||
model::namespace_ ns;
|
model::namespace_ ns;
|
||||||
|
|||||||
@@ -75,9 +75,6 @@ model::namespace_ get_tag_namespace(const clang::TagDecl &declaration);
|
|||||||
model::namespace_ get_template_namespace(
|
model::namespace_ get_template_namespace(
|
||||||
const clang::TemplateDecl &declaration);
|
const clang::TemplateDecl &declaration);
|
||||||
|
|
||||||
std::optional<clanguml::common::model::namespace_> get_enclosing_namespace(
|
|
||||||
const clang::DeclContext *decl);
|
|
||||||
|
|
||||||
std::string to_string(const clang::QualType &type, const clang::ASTContext &ctx,
|
std::string to_string(const clang::QualType &type, const clang::ASTContext &ctx,
|
||||||
bool try_canonical = true);
|
bool try_canonical = true);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user