MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / c_collect_static

Function c_collect_static

internal/cbm/doclink_c.c:620–642  ·  view source on GitHub ↗

The static names of the file: top-level declarations, also inside * preprocessor conditionals and extern "C" blocks. */

Source from the content-addressed store, hash-verified

618/* The static names of the file: top-level declarations, also inside
619 * preprocessor conditionals and extern "C" blocks. */
620static 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
644static char c_def_kind(const CBMDefinition *d) {
645 const char *l = d->label;

Callers 1

cbm_doclink_c_scan_scopeFunction · 0.85

Calls 2

c_kindFunction · 0.85
c_static_namesFunction · 0.85

Tested by

no test coverage detected