add ability to record accessed and declared "named defines"

Added the needed 2 sets to TIntermediate, added accessor-functions, inserter functions.  Implemented recording of such named defines inside the preprocessor parser.
This commit is contained in:
St0fF 2018-04-09 19:28:45 +02:00
parent 77d04598d3
commit e735042306
3 changed files with 31 additions and 4 deletions

View file

@ -3812,4 +3812,15 @@ const char* TIntermediate::getResourceName(TResourceType res)
}
// Access recorded named preprocessor-defines from the outside
// -> needs to take into account, that the outside may want to use the set
// even after the memory pool got released
void TIntermediate::getAddDefines( std::unordered_set< std::string > &targetSet, const std::unordered_set< TString > &sourceSet ) const
{
targetSet.reserve( targetSet.size() + sourceSet.size() );
for ( auto &i: sourceSet )
targetSet.emplace( i.c_str() ); // need to convert from TString (pool-allocated) to normal std::basic_string, so it may be used after the pool is released
}
} // end namespace glslang