| 2587 | } |
| 2588 | |
| 2589 | Types parseTypes( tinyxml2::XMLElement const * element, std::string const & api ) |
| 2590 | { |
| 2591 | int const line = element->GetLineNum(); |
| 2592 | checkAttributes( "vk.xml", line, getAttributes( element ), {}, { { "comment", {} } } ); |
| 2593 | |
| 2594 | std::vector<tinyxml2::XMLElement const *> children = getChildElements( element ); |
| 2595 | checkElements( "vk.xml", line, children, { { "comment", MultipleAllowed::Yes }, { "type", MultipleAllowed::Yes } } ); |
| 2596 | |
| 2597 | Types types; |
| 2598 | for ( auto child : children ) |
| 2599 | { |
| 2600 | std::string value = child->Value(); |
| 2601 | if ( value == "type" ) |
| 2602 | { |
| 2603 | parseTypesType( child, types, api ); |
| 2604 | } |
| 2605 | } |
| 2606 | |
| 2607 | // structs might alias a struct that's specified later than the alias ! |
| 2608 | for ( auto structAlias : types.structAliases ) |
| 2609 | { |
| 2610 | auto structIt = types.structs.find( structAlias.alias ); |
| 2611 | checkForError( "vk.xml", |
| 2612 | structIt != types.structs.end(), |
| 2613 | structAlias.xmlLine, |
| 2614 | "struct <" + structAlias.name + "> is an alias of an unknown struct <" + structAlias.alias + ">." ); |
| 2615 | checkForError( "vk.xml", |
| 2616 | structIt->second.aliases.insert( { structAlias.name, structAlias.xmlLine } ).second, |
| 2617 | structAlias.xmlLine, |
| 2618 | "struct alias <" + structAlias.name + "> is already listed as an alias for struct <" + structAlias.alias + ">" ); |
| 2619 | } |
| 2620 | types.structAliases.clear(); |
| 2621 | |
| 2622 | for ( auto const & [defineName, define] : types.defines ) |
| 2623 | { |
| 2624 | if ( !define.require.empty() ) |
| 2625 | { |
| 2626 | checkForError( |
| 2627 | "vk.xml", types.defines.contains( define.require ), define.xmlLine, "define <" + defineName + "> requires unknown define <" + define.require + ">" ); |
| 2628 | } |
| 2629 | } |
| 2630 | for ( auto const & [funcPointerName, funcPointer] : types.funcPointers ) |
| 2631 | { |
| 2632 | if ( !funcPointer.require.empty() ) |
| 2633 | { |
| 2634 | checkForError( "vk.xml", |
| 2635 | types.handles.contains( funcPointer.require ) || types.structs.contains( funcPointer.require ), |
| 2636 | funcPointer.xmlLine, |
| 2637 | "funcpointer <" + funcPointerName + "> requires unknown type <" + funcPointer.require + ">" ); |
| 2638 | } |
| 2639 | } |
| 2640 | for ( auto const & [handleName, handle] : types.handles ) |
| 2641 | { |
| 2642 | checkForError( "vk.xml", |
| 2643 | handle.parent.empty() || types.handles.contains( handle.parent ), |
| 2644 | handle.xmlLine, |
| 2645 | "handle <" + handleName + "> specifies unknown parent handle <" + handle.parent + ">" ); |
| 2646 | } |
no test coverage detected