Merge pull request #584 from asuessenbach/sType

Add checks on member sType of structs:
This commit is contained in:
Andreas Süßenbach 2020-04-29 09:26:53 +02:00 committed by GitHub
commit f84dfab162
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 6 deletions

View File

@ -6339,12 +6339,6 @@ void VulkanHppGenerator::readStructMember( tinyxml2::XMLElement const * element,
members.push_back( MemberData( line ) ); members.push_back( MemberData( line ) );
MemberData & memberData = members.back(); MemberData & memberData = members.back();
auto valuesIt = attributes.find( "values" );
if ( valuesIt != attributes.end() )
{
memberData.values = valuesIt->second;
}
for ( auto child : children ) for ( auto child : children )
{ {
std::string value = child->Value(); std::string value = child->Value();
@ -6361,6 +6355,18 @@ void VulkanHppGenerator::readStructMember( tinyxml2::XMLElement const * element,
readStructMemberType( child, memberData ); readStructMemberType( child, memberData );
} }
} }
auto valuesIt = attributes.find( "values" );
if ( valuesIt != attributes.end() )
{
check( memberData.name == "sType",
line,
"Structure member named differently than <sType> with attribute <values> encountered: " );
check( m_sTypeValues.insert( valuesIt->second ).second,
line,
"<" + valuesIt->second + "> already encountered as values for the sType member of a struct" );
memberData.values = valuesIt->second;
}
} }
void VulkanHppGenerator::readStructMemberEnum( tinyxml2::XMLElement const * element, MemberData & memberData ) void VulkanHppGenerator::readStructMemberEnum( tinyxml2::XMLElement const * element, MemberData & memberData )

View File

@ -592,6 +592,7 @@ private:
std::map<std::string, std::string> m_platforms; std::map<std::string, std::string> m_platforms;
std::map<std::string, std::string> m_structureAliases; std::map<std::string, std::string> m_structureAliases;
std::map<std::string, StructureData> m_structures; std::map<std::string, StructureData> m_structures;
std::set<std::string> m_sTypeValues;
std::set<std::string> m_tags; std::set<std::string> m_tags;
std::map<std::string, TypeCategory> m_types; std::map<std::string, TypeCategory> m_types;
std::string m_typesafeCheck; std::string m_typesafeCheck;