From 36742c27b94bec45d94bd9482bdeeeabc576eecb Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Wed, 18 Sep 2024 15:19:32 +0200 Subject: [PATCH] Don't override Type#GetLoadDependencies() if latter is sufficient If a specific type shall return no deps, the base method already does that. --- tools/mkclass/classcompiler.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tools/mkclass/classcompiler.cpp b/tools/mkclass/classcompiler.cpp index 3a49576b87d..0a6596078c6 100644 --- a/tools/mkclass/classcompiler.cpp +++ b/tools/mkclass/classcompiler.cpp @@ -376,19 +376,21 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&) << "}" << std::endl << std::endl; /* GetLoadDependencies */ - m_Header << "\t" << "const std::unordered_set& GetLoadDependencies() const override;" << std::endl; + if (!klass.LoadDependencies.empty()) { + m_Header << "\tconst std::unordered_set& GetLoadDependencies() const override;" << std::endl; - m_Impl << "const std::unordered_set& TypeImpl<" << klass.Name << ">::GetLoadDependencies() const" << std::endl - << "{" << std::endl - << "\t" << "static const std::unordered_set deps ({" << std::endl; + m_Impl << "const std::unordered_set& TypeImpl<" << klass.Name << ">::GetLoadDependencies() const" << std::endl + << "{" << std::endl + << "\tstatic const std::unordered_set deps ({" << std::endl; - for (const std::string& dep : klass.LoadDependencies) - m_Impl << "\t\t" << "GetByName(\"" << dep << "\").get()," << std::endl; + for (const std::string& dep : klass.LoadDependencies) + m_Impl << "\t\tGetByName(\"" << dep << "\").get()," << std::endl; - m_Impl << "\t" << "});" << std::endl; + m_Impl << "\t});" << std::endl; - m_Impl << "\t" << "return deps;" << std::endl - << "}" << std::endl << std::endl; + m_Impl << "\treturn deps;" << std::endl + << "}" << std::endl << std::endl; + } /* GetActivationPriority */ m_Header << "\t" << "int GetActivationPriority() const override;" << std::endl;