| 246 | } |
| 247 | |
| 248 | static void MarkCBuffersAndStructsUsed( ASTNode* node, SymbolTable& symbols ) |
| 249 | { |
| 250 | if( node == nullptr ) |
| 251 | { |
| 252 | return; |
| 253 | } |
| 254 | if( node->GetNodeType() == NT_STRUCT ) |
| 255 | { |
| 256 | if( HasUsedDeclarations( node ) ) |
| 257 | { |
| 258 | MarkUsedSymbols( node, symbols ); |
| 259 | } |
| 260 | } |
| 261 | auto IsGlobals = [node]() { |
| 262 | if( !node->GetSymbol() ) |
| 263 | { |
| 264 | return false; |
| 265 | } |
| 266 | auto found = node->GetSymbol()->registerSpecifier.find( MakeInlineString( "" ) ); |
| 267 | if( found == end( node->GetSymbol()->registerSpecifier ) ) |
| 268 | { |
| 269 | return false; |
| 270 | } |
| 271 | return found->second.registerNumber == 0 && found->second.explicitRegister; |
| 272 | }; |
| 273 | if( node->GetNodeType() == NT_CBUFFER && !IsGlobals() ) |
| 274 | { |
| 275 | if( HasUsedDeclarations( node ) ) |
| 276 | { |
| 277 | MarkUsedSymbols( node, symbols ); |
| 278 | } |
| 279 | } |
| 280 | for( unsigned i = 0; i < node->GetChildrenCount(); ++i ) |
| 281 | { |
| 282 | MarkCBuffersAndStructsUsed( node->GetChild( i ), symbols ); |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | void MarkUsedSymbols( ASTNode* entryPoint, ParserState& state ) |
| 287 | { |
no test coverage detected