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

Function is_func_ptr_field

internal/cbm/extract_defs.c:10418–10437  ·  view source on GitHub ↗

Extract typed struct/class fields for cross-file LSP resolution (C/C++/CUDA/Go/Java/Rust etc.) Creates "Field" label definitions with return_type set to the field's type text. These are later collected by DefsToLSPDefs to build FieldDefs pipe-separated strings. Check if a field_declaration has a function-pointer declarator chain.

Source from the content-addressed store, hash-verified

10416// These are later collected by DefsToLSPDefs to build FieldDefs pipe-separated strings.
10417// Check if a field_declaration has a function-pointer declarator chain.
10418static bool is_func_ptr_field(TSNode field) {
10419 TSNode decl = ts_node_child_by_field_name(field, TS_FIELD("declarator"));
10420 for (int depth = 0; depth < C_RETURN_WALK_DEPTH && !ts_node_is_null(decl); depth++) {
10421 if (strcmp(ts_node_type(decl), "function_declarator") == 0) {
10422 return true;
10423 }
10424 TSNode inner = ts_node_child_by_field_name(decl, TS_FIELD("declarator"));
10425 if (ts_node_is_null(inner)) {
10426 uint32_t nc = ts_node_named_child_count(decl);
10427 for (uint32_t k = 0; k < nc; k++) {
10428 inner = ts_node_named_child(decl, k);
10429 if (!ts_node_is_null(inner)) {
10430 break;
10431 }
10432 }
10433 }
10434 decl = inner;
10435 }
10436 return false;
10437}
10438
10439/* ── C-family member declarations ───────────────────────────────────
10440 * `type declarator, declarator;` in a struct/union/class body. Each declarator

Callers 1

extract_class_fieldsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected