The names a static declaration or definition declares. */
| 592 | |
| 593 | /* The names a static declaration or definition declares. */ |
| 594 | static void c_static_names(CBMExtractCtx *ctx, CBMHashTable *names, TSNode decl) { |
| 595 | if (!c_is_static(ctx->source, decl)) { |
| 596 | return; |
| 597 | } |
| 598 | TSTreeCursor cur = ts_tree_cursor_new(decl); |
| 599 | for (bool more = ts_tree_cursor_goto_first_child(&cur); more; |
| 600 | more = ts_tree_cursor_goto_next_sibling(&cur)) { |
| 601 | const char *field = ts_tree_cursor_current_field_name(&cur); |
| 602 | if (!field || strcmp(field, "declarator") != 0) { |
| 603 | continue; |
| 604 | } |
| 605 | TSNode name = c_declarator_name(ts_tree_cursor_current_node(&cur)); |
| 606 | if (ts_node_is_null(name)) { |
| 607 | continue; |
| 608 | } |
| 609 | uint32_t b = ts_node_start_byte(name); |
| 610 | char *key = cbm_arena_strndup(ctx->arena, ctx->source + b, ts_node_end_byte(name) - b); |
| 611 | if (key) { |
| 612 | cbm_ht_set(names, key, (void *)(uintptr_t)SKIP_ONE); |
| 613 | } |
| 614 | } |
| 615 | ts_tree_cursor_delete(&cur); |
| 616 | } |
| 617 | |
| 618 | /* The static names of the file: top-level declarations, also inside |
| 619 | * preprocessor conditionals and extern "C" blocks. */ |
no test coverage detected