Move check on structureAlias from reading to final correctness check.

This commit is contained in:
asuessenbach 2021-06-22 10:15:24 +02:00
parent 8c7a248a72
commit cb87348898
2 changed files with 24 additions and 7 deletions

View File

@ -10555,6 +10555,18 @@ void VulkanHppGenerator::checkCorrectness()
}
}
// structure alias checks
for ( auto structureAlias : m_structureAliases )
{
auto structureIt = m_structures.find( structureAlias.second.alias );
check( structureIt != m_structures.end(),
structureAlias.second.xmlLine,
"missing alias <" + structureAlias.second.alias + ">." );
check( structureIt->second.aliases.insert( structureAlias.first ).second,
structureAlias.second.xmlLine,
"struct <" + structureAlias.second.alias + "> already uses alias <" + structureAlias.first + ">" );
}
// structure checks
std::set<std::string> sTypeValues;
for ( auto const & structure : m_structures )
@ -13914,7 +13926,8 @@ void VulkanHppGenerator::readSPIRVCapabilityEnableStruct( int
}
else if ( attribute.first == "struct" )
{
check( m_structures.find( attribute.second ) != m_structures.end(),
check( ( m_structures.find( attribute.second ) != m_structures.end() ) ||
( m_structureAliases.find( attribute.second ) != m_structureAliases.end() ),
xmlLine,
"unknown structure <" + attribute.second + "> specified for SPIR-V capability" );
check( attributes.find( "feature" ) != attributes.end(),
@ -14179,11 +14192,7 @@ void VulkanHppGenerator::readStructAlias( tinyxml2::XMLElement const *
}
}
auto structIt = m_structures.find( alias );
check( structIt != m_structures.end(), line, "missing alias <" + alias + ">." );
check(
structIt->second.aliases.insert( name ).second, line, "struct <" + alias + "> already uses alias <" + name + ">" );
check( m_structureAliases.insert( std::make_pair( name, alias ) ).second,
check( m_structureAliases.insert( std::make_pair( name, StructureAliasData( alias, line ) ) ).second,
line,
"structure alias <" + name + "> already used" );
check( m_types.insert( std::make_pair( name, TypeCategory::Struct ) ).second,

View File

@ -254,6 +254,14 @@ private:
std::string protect;
};
struct StructureAliasData
{
StructureAliasData( std::string const & alias_, int line ) : alias( alias_ ), xmlLine( line ) {}
std::string alias;
int xmlLine;
};
struct StructureData
{
StructureData( std::vector<std::string> const & extends, int line ) : structExtends( extends ), xmlLine( line ) {}
@ -1181,7 +1189,7 @@ private:
std::set<std::string> m_listedTypes;
std::set<std::string> m_listingTypes;
std::map<std::string, PlatformData> m_platforms;
std::map<std::string, std::string> m_structureAliases;
std::map<std::string, StructureAliasData> m_structureAliases;
std::map<std::string, StructureData> m_structures;
std::set<std::string> m_tags;
std::map<std::string, TypeData> m_types;