Merge pull request #997 from asuessenbach/alias

Generalize check on enum alias chaining.
This commit is contained in:
Andreas Süßenbach 2021-06-23 20:22:27 +02:00 committed by GitHub
commit 59e14ad1f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1884,6 +1884,12 @@ void VulkanHppGenerator::appendEnum( std::string & str, std::pair<std::string, E
{ {
auto aliasIt = enumData.second.aliases.find( alias.second.name ); auto aliasIt = enumData.second.aliases.find( alias.second.name );
assert( aliasIt != enumData.second.aliases.end() ); assert( aliasIt != enumData.second.aliases.end() );
auto nextAliasIt = enumData.second.aliases.find( aliasIt->second.name );
while ( nextAliasIt != enumData.second.aliases.end() )
{
aliasIt = nextAliasIt;
nextAliasIt = enumData.second.aliases.find( aliasIt->second.name );
}
enumIt = std::find_if( enumData.second.values.begin(), enumIt = std::find_if( enumData.second.values.begin(),
enumData.second.values.end(), enumData.second.values.end(),
[&aliasIt]( EnumValueData const & evd ) { return aliasIt->second.name == evd.name; } ); [&aliasIt]( EnumValueData const & evd ) { return aliasIt->second.name == evd.name; } );
@ -10483,7 +10489,7 @@ void VulkanHppGenerator::checkCorrectness()
{ return evd.name == alias.second.name; } ) != e.second.values.end() ) || { return evd.name == alias.second.name; } ) != e.second.values.end() ) ||
( e.second.aliases.find( alias.second.name ) != e.second.aliases.end() ), ( e.second.aliases.find( alias.second.name ) != e.second.aliases.end() ),
alias.second.xmlLine, alias.second.xmlLine,
"unknown enum alias <" + alias.second.name + ">" ); "enum <" + alias.first+ "> uses unknown alias <" + alias.second.name + ">" );
} }
} }