Added debug_mode config option

This commit is contained in:
Bartek Kryza
2022-12-26 21:47:27 +01:00
parent 1a344f9d8c
commit 887652ed6b
8 changed files with 66 additions and 4 deletions

View File

@@ -73,6 +73,8 @@ void generator::generate_alias(const class_ &c, std::ostream &ostr) const
assert(!full_name.empty());
print_debug(c, ostr);
ostr << class_type << " \""
<< m_config.simplify_template_type(render_name(full_name));
@@ -84,6 +86,8 @@ void generator::generate_alias(const class_ &c, std::ostream &ostr) const
void generator::generate_alias(const enum_ &e, std::ostream &ostr) const
{
print_debug(e, ostr);
if (m_config.generate_packages())
ostr << "enum"
<< " \"" << e.name();
@@ -127,6 +131,8 @@ void generator::generate(const class_ &c, std::ostream &ostr) const
if (!m_model.should_include(m.access()))
continue;
print_debug(m, ostr);
if (m.is_pure_virtual())
ostr << "{abstract} ";
@@ -237,6 +243,8 @@ void generator::generate(const class_ &c, std::ostream &ostr) const
rendered_relations.find(m.name()) != rendered_relations.end())
continue;
print_debug(m, ostr);
if (m.is_static())
ostr << "{static} ";
@@ -424,6 +432,7 @@ void generator::generate(const package &p, std::ostream &ostr) const
// Don't generate packages from namespaces filtered out by
// using_namespace
if (!uns.starts_with({p.full_name(false)})) {
print_debug(p, ostr);
ostr << "package [" << p.name() << "] ";
ostr << "as " << p.alias();

View File

@@ -140,9 +140,11 @@ bool translation_unit_visitor::VisitEnumDecl(clang::EnumDecl *enm)
// If not, check if the parent template declaration is in the model
if (!id_opt) {
local_id = parent_record_decl->getDescribedTemplate()->getID();
if (parent_record_decl->getDescribedTemplate() != nullptr)
if (parent_record_decl->getDescribedTemplate() != nullptr) {
local_id =
parent_record_decl->getDescribedTemplate()->getID();
id_opt = get_ast_local_id(local_id);
}
}
}
}
@@ -429,9 +431,11 @@ std::unique_ptr<class_> translation_unit_visitor::create_class_declaration(
// If not, check if the parent template declaration is in the model
if (!id_opt) {
local_id = parent_record_decl->getDescribedTemplate()->getID();
if (parent_record_decl->getDescribedTemplate() != nullptr)
if (parent_record_decl->getDescribedTemplate() != nullptr) {
local_id =
parent_record_decl->getDescribedTemplate()->getID();
id_opt = get_ast_local_id(local_id);
}
}
}
}