mirror of
https://github.com/KhronosGroup/Vulkan-Hpp
synced 2024-11-08 13:40:08 +00:00
Move argument type check of func pointers to final check.
This commit is contained in:
parent
0eea598f6f
commit
4e055c376d
@ -1332,6 +1332,12 @@ void VulkanHppGenerator::checkFuncPointerCorrectness() const
|
||||
funcPointer.second.xmlLine,
|
||||
"funcpointer requires unknown <" + funcPointer.second.requirements + ">" );
|
||||
}
|
||||
for ( auto const & argument : funcPointer.second.arguments )
|
||||
{
|
||||
check( m_types.find( argument.type ) != m_types.end(),
|
||||
argument.xmlLine,
|
||||
"funcpointer argument of unknown type <" + argument.type + ">" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -13595,6 +13601,8 @@ void VulkanHppGenerator::readFuncpointer( tinyxml2::XMLElement const *
|
||||
}
|
||||
}
|
||||
|
||||
auto funcPointerIt = m_funcPointers.end();
|
||||
std::set<std::string> argumentNames;
|
||||
for ( auto const & child : children )
|
||||
{
|
||||
std::string value = child->Value();
|
||||
@ -13603,20 +13611,29 @@ void VulkanHppGenerator::readFuncpointer( tinyxml2::XMLElement const *
|
||||
{
|
||||
std::string name = child->GetText();
|
||||
check( !name.empty(), childLine, "funcpointer with empty name" );
|
||||
check( m_funcPointers.insert( std::make_pair( name, FuncPointerData( requirements, line ) ) ).second,
|
||||
check( m_funcPointers.find( name ) == m_funcPointers.end(),
|
||||
childLine,
|
||||
"funcpointer <" + name + "> already specified" );
|
||||
funcPointerIt = m_funcPointers.insert( std::make_pair( name, FuncPointerData( requirements, line ) ) ).first;
|
||||
check( m_types.insert( std::make_pair( name, TypeCategory::FuncPointer ) ).second,
|
||||
childLine,
|
||||
"funcpointer <" + name + "> already specified as a type" );
|
||||
}
|
||||
else if ( value == "type" )
|
||||
{
|
||||
assert( funcPointerIt != m_funcPointers.end() );
|
||||
std::string type = child->GetText();
|
||||
check( !type.empty(), childLine, "funcpointer argument with empty type" );
|
||||
check( ( m_types.find( type ) != m_types.end() ) || ( type == requirements ),
|
||||
funcPointerIt->second.arguments.push_back( { type, childLine } );
|
||||
|
||||
auto sibling = child->NextSibling();
|
||||
char const * siblingValue = sibling->Value();
|
||||
assert( siblingValue != nullptr );
|
||||
std::string argumentName = siblingValue;
|
||||
argumentName = argumentName.substr( argumentName.find_first_not_of( "* " ) );
|
||||
argumentName = argumentName.substr( 0, argumentName.find_first_of( ",)" ) );
|
||||
check( argumentNames.insert( argumentName ).second,
|
||||
childLine,
|
||||
"funcpointer argument of unknown type <" + type + ">" );
|
||||
"funcpointer <" + funcPointerIt->first + "> already has an argument named <" + argumentName + ">" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -228,10 +228,19 @@ private:
|
||||
int xmlLine;
|
||||
};
|
||||
|
||||
struct FuncPointerArgumentData
|
||||
{
|
||||
FuncPointerArgumentData( std::string const & t, int line ) : type( t ), xmlLine( line ) {}
|
||||
|
||||
std::string type;
|
||||
int xmlLine;
|
||||
};
|
||||
|
||||
struct FuncPointerData
|
||||
{
|
||||
FuncPointerData( std::string const & r, int line ) : requirements( r ), xmlLine( line ) {}
|
||||
|
||||
std::vector<FuncPointerArgumentData> arguments;
|
||||
std::string requirements;
|
||||
int xmlLine;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user