Skip to content

Commit

Permalink
Type#GetLoadDependencies(): VERIFY() that no nullptr is returned
Browse files Browse the repository at this point in the history
  • Loading branch information
Al2Klimov committed Sep 18, 2024
1 parent 0b8f70b commit 6a11cf1
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions tools/mkclass/classcompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,13 +379,19 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&)
m_Header << "\t" << "const std::unordered_set<Type*>& GetLoadDependencies() const override;" << std::endl;

m_Impl << "const std::unordered_set<Type*>& TypeImpl<" << klass.Name << ">::GetLoadDependencies() const" << std::endl
<< "{" << std::endl
<< "\t" << "static const std::unordered_set<Type*> deps ({" << std::endl;
<< "{" << std::endl;

for (auto& dep : klass.LoadDependencies)
m_Impl << "\tstatic const auto type" << dep << " (GetByName(\"" << dep << "\").get());" << std::endl
<< "\tstatic const auto v" << dep << " (VERIFY(type" << dep << "));" << std::endl
<< "\t(void)v" << dep << ";" << std::endl << std::endl;

m_Impl << "\tstatic const std::unordered_set<Type*> deps ({";

for (const std::string& dep : klass.LoadDependencies)
m_Impl << "\t\t" << "GetByName(\"" << dep << "\").get()," << std::endl;
m_Impl << " type" << dep << ",";

m_Impl << "\t" << "});" << std::endl;
m_Impl << " });" << std::endl;

m_Impl << "\t" << "return deps;" << std::endl
<< "}" << std::endl << std::endl;
Expand Down Expand Up @@ -1463,6 +1469,7 @@ void ClassCompiler::CompileStream(const std::string& path, std::istream& input,
<< "#include \"base/objectlock.hpp\"" << std::endl
<< "#include \"base/utility.hpp\"" << std::endl
<< "#include \"base/convert.hpp\"" << std::endl
<< "#include \"base/debug.hpp\"" << std::endl
<< "#include \"base/dependencygraph.hpp\"" << std::endl
<< "#include \"base/logger.hpp\"" << std::endl
<< "#include \"base/function.hpp\"" << std::endl
Expand Down

0 comments on commit 6a11cf1

Please sign in to comment.