Reduce parents of a handle from a vector to a single element

This commit is contained in:
asuessenbach 2021-03-29 10:11:19 +02:00
parent 32188df57b
commit 5e2edc10e0
2 changed files with 13 additions and 17 deletions

View File

@ -10441,12 +10441,9 @@ void VulkanHppGenerator::checkCorrectness()
assert( objectTypeIt != m_enums.end() );
for ( auto const & handle : m_handles )
{
for ( auto const & parent : handle.second.parents )
{
check( m_handles.find( parent ) != m_handles.end(),
check( m_handles.find( handle.second.parent ) != m_handles.end(),
handle.second.xmlLine,
"handle <" + handle.first + "> with unknown parent <" + parent + ">" );
}
"handle <" + handle.first + "> with unknown parent <" + handle.second.parent + ">" );
if ( !handle.first.empty() )
{
@ -12526,7 +12523,9 @@ void VulkanHppGenerator::readHandle( tinyxml2::XMLElement const *
check( typeInfo.postfix == "(", line, "unexpected type postfix <" + typeInfo.postfix + ">" );
check( !objTypeEnum.empty(), line, "handle <" + nameData.name + "> does not specify attribute \"objtypeenum\"" );
check( m_handles.insert( std::make_pair( nameData.name, HandleData( tokenize( parent, "," ), objTypeEnum, line ) ) )
check(
parent.find( ',' ) == std::string::npos, line, "mulitple parents specified for handle <" + nameData.name + ">" );
check( m_handles.insert( std::make_pair( nameData.name, HandleData( parent, objTypeEnum, line ) ) )
.second,
line,
"handle <" + nameData.name + "> already specified" );
@ -13667,15 +13666,12 @@ void VulkanHppGenerator::rescheduleRAIIHandle( std::string &
std::set<std::string> const & specialFunctions ) const
{
listedHandles.insert( handle.first );
for ( auto const & parent : handle.second.parents )
if ( !handle.second.parent.empty() && ( listedHandles.find( handle.second.parent ) == listedHandles.end() ) )
{
if ( listedHandles.find( parent ) == listedHandles.end() )
{
auto parentIt = m_handles.find( parent );
auto parentIt = m_handles.find( handle.second.parent );
assert( parentIt != m_handles.end() );
appendRAIIHandle( str, commandDefinitions, *parentIt, listedHandles, specialFunctions );
}
}
for ( auto constructorIt : handle.second.constructorIts )
{

View File

@ -201,8 +201,8 @@ private:
struct HandleData
{
HandleData( std::vector<std::string> const & p, std::string const & objType, int line )
: objTypeEnum( objType ), parents( p ), xmlLine( line )
HandleData( std::string const & p, std::string const & objType, int line )
: objTypeEnum( objType ), parent( p ), xmlLine( line )
{}
std::string alias;
@ -211,7 +211,7 @@ private:
std::string deleteCommand;
std::string deletePool;
std::string objTypeEnum;
std::vector<std::string> parents;
std::string parent;
std::set<std::string> secondLevelCommands;
int xmlLine;