diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index 3e209eb..7a1ea63 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -6339,12 +6339,6 @@ void VulkanHppGenerator::readStructMember( tinyxml2::XMLElement const * element, members.push_back( MemberData( line ) ); MemberData & memberData = members.back(); - auto valuesIt = attributes.find( "values" ); - if ( valuesIt != attributes.end() ) - { - memberData.values = valuesIt->second; - } - for ( auto child : children ) { std::string value = child->Value(); @@ -6361,6 +6355,18 @@ void VulkanHppGenerator::readStructMember( tinyxml2::XMLElement const * element, readStructMemberType( child, memberData ); } } + + auto valuesIt = attributes.find( "values" ); + if ( valuesIt != attributes.end() ) + { + check( memberData.name == "sType", + line, + "Structure member named differently than with attribute 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 ) diff --git a/VulkanHppGenerator.hpp b/VulkanHppGenerator.hpp index 5a30cf6..6adc775 100644 --- a/VulkanHppGenerator.hpp +++ b/VulkanHppGenerator.hpp @@ -592,6 +592,7 @@ private: std::map m_platforms; std::map m_structureAliases; std::map m_structures; + std::set m_sTypeValues; std::set m_tags; std::map m_types; std::string m_typesafeCheck;