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:6182–6201  ·  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

6180// These are later collected by DefsToLSPDefs to build FieldDefs pipe-separated strings.
6181// Check if a field_declaration has a function-pointer declarator chain.
6182static bool is_func_ptr_field(TSNode field) {
6183 TSNode decl = ts_node_child_by_field_name(field, TS_FIELD("declarator"));
6184 for (int depth = 0; depth < C_RETURN_WALK_DEPTH && !ts_node_is_null(decl); depth++) {
6185 if (strcmp(ts_node_type(decl), "function_declarator") == 0) {
6186 return true;
6187 }
6188 TSNode inner = ts_node_child_by_field_name(decl, TS_FIELD("declarator"));
6189 if (ts_node_is_null(inner)) {
6190 uint32_t nc = ts_node_named_child_count(decl);
6191 for (uint32_t k = 0; k < nc; k++) {
6192 inner = ts_node_named_child(decl, k);
6193 if (!ts_node_is_null(inner)) {
6194 break;
6195 }
6196 }
6197 }
6198 decl = inner;
6199 }
6200 return false;
6201}
6202
6203// Resolve the name node for a field declaration, unwrapping C pointer/array declarators.
6204static TSNode resolve_field_name_node(TSNode child) {

Callers 1

extract_class_fieldsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected