Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

Merge branch 'main' into fix/swift-init-extraction

Martin Vogel468102c707da
diff --cc internal/cbm/helpers.c
index 1a51dc971,0a770804f..f03c0c940
--- a/internal/cbm/helpers.c
+++ b/internal/cbm/helpers.c
@@@ -959,17 -1187,13 +1187,23 @@@ bool cbm_is_c_preprocessor_lang(CBMLang
// const", and a member lookup for "operator bool" (the implicit call in
// `if (obj)`) misses.
char *cbm_func_name_node_text(CBMArena *a, TSNode name_node, const char *source, CBMLanguage lang) {
+ if (lang == CBM_LANG_SWIFT) {
+ const char *kind = ts_node_type(name_node);
+ if (strcmp(kind, "init_declaration") == 0) {
+ return cbm_arena_strdup(a, "init");
+ }
+ if (strcmp(kind, "deinit_declaration") == 0) {
+ return cbm_arena_strdup(a, "deinit");
+ }
+ }
+
char *text = cbm_node_text(a, name_node, source);
+ /* A C keyword is never a function name: the definition is an error-recovery
+ * artifact. No name means no def and no call scope (calls inside fall back
+ * to the enclosing scope), the same as any unnamed definition. */
+ if (text && c_declarator_lang(lang) && cbm_c_reserved_func_name(text)) {
+ return NULL;
+ }
if (text && strcmp(ts_node_type(name_node), "operator_cast") == 0) {
char *paren = strchr(text, '(');
if (paren) {