Merge pull request #582 from asuessenbach/basetype

Add support for basetypes without any type information
This commit is contained in:
Andreas Süßenbach 2020-04-28 08:57:58 +02:00 committed by GitHub
commit de3be15b70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4689,17 +4689,24 @@ void VulkanHppGenerator::readBaseType( tinyxml2::XMLElement const *
TypeData typeData; TypeData typeData;
std::tie( nameData, typeData ) = readNameAndType( element ); std::tie( nameData, typeData ) = readNameAndType( element );
check( beginsWith( nameData.name, "Vk" ), line, "name <" + nameData.name + "> does not begin with <Vk>" );
check( nameData.arraySizes.empty(), line, "name <" + nameData.name + "> with unsupported arraySizes" ); check( nameData.arraySizes.empty(), line, "name <" + nameData.name + "> with unsupported arraySizes" );
check( nameData.bitCount.empty(), check( nameData.bitCount.empty(),
line, line,
"name <" + nameData.name + "> with unsupported bitCount <" + nameData.bitCount + ">" ); "name <" + nameData.name + "> with unsupported bitCount <" + nameData.bitCount + ">" );
check( typeData.prefix == "typedef", line, "unexpected type prefix <" + typeData.prefix + ">" ); check( typeData.type.empty() || ( typeData.prefix == "typedef" ),
line,
"unexpected type prefix <" + typeData.prefix + ">" );
check( typeData.prefix.empty() || ( typeData.prefix == "typedef" ),
line,
"unexpected type prefix <" + typeData.prefix + ">" );
check( typeData.postfix.empty(), line, "unexpected type postfix <" + typeData.postfix + ">" ); check( typeData.postfix.empty(), line, "unexpected type postfix <" + typeData.postfix + ">" );
check( m_baseTypes.insert( std::make_pair( nameData.name, BaseTypeData( typeData.type, line ) ) ).second, if ( !typeData.type.empty() )
line, {
"basetype <" + nameData.name + "> already specified" ); check( m_baseTypes.insert( std::make_pair( nameData.name, BaseTypeData( typeData.type, line ) ) ).second,
line,
"basetype <" + nameData.name + "> already specified" );
}
check( m_types.insert( std::make_pair( nameData.name, TypeCategory::BaseType ) ).second, check( m_types.insert( std::make_pair( nameData.name, TypeCategory::BaseType ) ).second,
line, line,
"basetype <" + nameData.name + "> already specified as a type" ); "basetype <" + nameData.name + "> already specified as a type" );
@ -5669,6 +5676,9 @@ void VulkanHppGenerator::readExtensionRequireType( tinyxml2::XMLElement const *
{ {
switch ( typeIt->second ) switch ( typeIt->second )
{ {
case TypeCategory::BaseType:
// no need to protect a base type
break;
case TypeCategory::Bitmask: case TypeCategory::Bitmask:
{ {
auto bitmaskIt = m_bitmasks.find( name ); auto bitmaskIt = m_bitmasks.find( name );
@ -5896,7 +5906,7 @@ std::pair<VulkanHppGenerator::NameData, VulkanHppGenerator::TypeData>
{ {
int line = element->GetLineNum(); int line = element->GetLineNum();
std::vector<tinyxml2::XMLElement const *> children = getChildElements( element ); std::vector<tinyxml2::XMLElement const *> children = getChildElements( element );
checkElements( line, children, { { "name", true }, { "type", true } } ); checkElements( line, children, { { "name", true } }, { { "type" } } );
NameData nameData; NameData nameData;
TypeData typeData; TypeData typeData;