The static names of the file: top-level declarations, also inside * preprocessor conditionals and extern "C" blocks. */
| 618 | /* The static names of the file: top-level declarations, also inside |
| 619 | * preprocessor conditionals and extern "C" blocks. */ |
| 620 | static void c_collect_static(CBMExtractCtx *ctx, CBMHashTable *names) { |
| 621 | TSTreeCursor cur = ts_tree_cursor_new(ctx->root); |
| 622 | for (bool more = ts_tree_cursor_goto_first_child(&cur); more;) { |
| 623 | TSNode n = ts_tree_cursor_current_node(&cur); |
| 624 | bool container = c_kind(n, "preproc_if") || c_kind(n, "preproc_ifdef") || |
| 625 | c_kind(n, "preproc_else") || c_kind(n, "preproc_elif") || |
| 626 | c_kind(n, "preproc_elifdef") || c_kind(n, "linkage_specification") || |
| 627 | c_kind(n, "declaration_list"); |
| 628 | if (c_kind(n, "function_definition") || c_kind(n, "declaration")) { |
| 629 | c_static_names(ctx, names, n); |
| 630 | } |
| 631 | if (container && ts_tree_cursor_goto_first_child(&cur)) { |
| 632 | continue; |
| 633 | } |
| 634 | while (!ts_tree_cursor_goto_next_sibling(&cur)) { |
| 635 | if (!ts_tree_cursor_goto_parent(&cur)) { |
| 636 | more = false; |
| 637 | break; |
| 638 | } |
| 639 | } |
| 640 | } |
| 641 | ts_tree_cursor_delete(&cur); |
| 642 | } |
| 643 | |
| 644 | static char c_def_kind(const CBMDefinition *d) { |
| 645 | const char *l = d->label; |
no test coverage detected