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

View File

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