Permalink
Browse files

Perform subclass forward declaration even if header is empty

This restores the behavior to before commit 81a138b but with the extension that this is only done if the subclass should be forward declared.
This allows to forward declare local elements in the project file so they are not required to be defined before elements that depend on them.
  • Loading branch information...
sodevel committed Feb 8, 2019
1 parent 5e29b99 commit 0e70fe22c55875b88f8e22042a95454f29fd5c1b
Showing with 11 additions and 9 deletions.
  1. +11 −9 src/codegen/cppcg.cpp
@@ -1323,19 +1323,21 @@ void CppCodeGenerator::GenSubclassSets( PObjectBase obj, std::set< wxString >* s
}

// Now get the header
std::map< wxString, wxString >::iterator header;
header = children.find( wxT( "header" ) );

if ( children.end() == header )
wxString headerVal;
auto header = children.find(wxT("header"));
if (children.end() != header)
{
// No header, so do nothing
return;
headerVal = header->second;
}

wxString headerVal = header->second;
if ( headerVal.empty() )
if (headerVal.empty())
{
// No header, so do nothing
// No header, do a forward declare if requested, otherwise do nothing
if (forward_declare)
{
subclasses->insert(forwardDecl);
}

return;
}

0 comments on commit 0e70fe2

Please sign in to comment.