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.
C aiderastclaude-codecode-analysiscode-intelligencecodexcursorcypherdeveloper-toolsgemini-cligraph-visualizationkilocodeknowledge-graphmcpmcp-servermodel-context-protocolopencodesqlitetree-sitterwindsurf
Apply clang-format-20 across flagged sources
Martin Vogel863bb70c94e1
diff --git a/internal/cbm/cbm.c b/internal/cbm/cbm.cindex b64d6d808..42d757030 100644--- a/internal/cbm/cbm.c+++ b/internal/cbm/cbm.c@@ -293,9 +293,9 @@ static bool name_in_set(const char *name, const char *const *set) {// Linear-scan / membership calls: a hit inside a loop is the textbook hidden// O(n^2) (cf. Olivo et al., PLDI'15) that syntactic loop-depth alone misses.static bool is_linear_scan_name(const char *n) {- static const char *const set[] = {"find", "indexof", "contains", "includes", "search",- "lookup", "strstr", "strchr", "strrchr", "memchr",- "find_if", "findindex", "count", "index", NULL};+ static const char *const set[] = {"find", "indexof", "contains", "includes", "search",+ "lookup", "strstr", "strchr", "strrchr", "memchr",+ "find_if", "findindex", "count", "index", NULL};return name_in_set(n, set);}@@ -303,10 +303,9 @@ static bool is_linear_scan_name(const char *n) {// accidental reallocation / string-concat O(n^2). Names are deliberately// conservative; meaningless in some languages → simply never matches there.static bool is_alloc_name(const char *n) {- static const char *const set[] = {"malloc", "calloc", "realloc", "strdup",- "strndup", "append", "push_back", "emplace_back",- "concat", "strcat", "strncat", "push",- "pushback", NULL};+ static const char *const set[] = {"malloc", "calloc", "realloc", "strdup", "strndup",+ "append", "push_back", "emplace_back", "concat", "strcat",+ "strncat", "push", "pushback", NULL};return name_in_set(n, set);}@@ -356,7 +355,8 @@ static int count_params_from_signature(const char *sig) {while (*list == ' ' || *list == '\t') {list++;}- if (strncmp(list, "void", 4) == 0 && (list[4] == ')' || list[4] == ' ' || list[4] == '\0')) {+ if (strncmp(list, "void", 4) == 0 &&+ (list[4] == ')' || list[4] == ' ' || list[4] == '\0')) {return 0; /* C "(void)" */}}diff --git a/internal/cbm/extract_defs.c b/internal/cbm/extract_defs.cindex a13adf62d..06c95a1ea 100644--- a/internal/cbm/extract_defs.c+++ b/internal/cbm/extract_defs.c@@ -521,7 +521,8 @@ enum { CBM_DESCENDANT_MAX_DEPTH = 6 };// pre-order (depth-bounded). The (System)Verilog grammar has FIELD_COUNT 0, so// def names live on nested *_identifier wrappers reachable only by node kind.// Tree-sitter trees are acyclic, so the bounded recursion always terminates.-static TSNode find_first_descendant_by_kind(TSNode node, const char *kind, // NOLINT(misc-no-recursion)+static TSNode find_first_descendant_by_kind(TSNode node,+ const char *kind, // NOLINT(misc-no-recursion)int max_depth) {if (max_depth < 0 || ts_node_is_null(node)) {TSNode null_node = {0};@@ -825,9 +826,9 @@ static TSNode resolve_func_name(TSNode node, CBMLanguage lang) {* nested *_identifier wrapper; the function name is the first* simple_identifier descendant (params/returns come after the name). */if ((lang == CBM_LANG_VERILOG || lang == CBM_LANG_SYSTEMVERILOG) &&- (strcmp(kind, "function_declaration") == 0 ||- strcmp(kind, "task_declaration") == 0)) {- TSNode si = find_first_descendant_by_kind(node, "simple_identifier", CBM_DESCENDANT_MAX_DEPTH);+ (strcmp(kind, "function_declaration") == 0 || strcmp(kind, "task_declaration") == 0)) {+ TSNode si =+ find_first_descendant_by_kind(node, "simple_identifier", CBM_DESCENDANT_MAX_DEPTH);if (!ts_node_is_null(si)) {return si;}@@ -2368,7 +2369,8 @@ static void extract_class_def(CBMExtractCtx *ctx, TSNode node, const CBMLangSpecstrcmp(kind, "interface_declaration") == 0 ||strcmp(kind, "program_declaration") == 0 ||strcmp(kind, "package_declaration") == 0) {- name_node = find_first_descendant_by_kind(node, "simple_identifier", CBM_DESCENDANT_MAX_DEPTH);+ name_node =+ find_first_descendant_by_kind(node, "simple_identifier", CBM_DESCENDANT_MAX_DEPTH);}}if (ts_node_is_null(name_node)) {@@ -4172,10 +4174,9 @@ static bool janet_is_def_head(const char *t) {if (!t) {return false;}- static const char *heads[] = {- "defn", "defn-", "defmacro", "defmacro-", "varfn",- "fn", "def", "def-", "var", "var-",- "defstruct", "deftype", "defprotocol", NULL};+ static const char *heads[] = {"defn", "defn-", "defmacro", "defmacro-", "varfn",+ "fn", "def", "def-", "var", "var-",+ "defstruct", "deftype", "defprotocol", NULL};for (int i = 0; heads[i]; i++) {if (strcmp(t, heads[i]) == 0) {return true;@@ -4269,13 +4270,25 @@ static bool lisp_is_def_head(const char *t) {if (!t) {return false;}- static const char *heads[] = {- "defn", "defn-", "def", "defmacro",- "defmulti", "defmethod", "defprotocol", "defrecord",- "deftype", "definterface", "defonce", // Clojure- "define", "define-syntax", "define-values", "define-syntax-rule",- "define-struct", "define-record-type", "define/contract", // Scheme/Racket- NULL};+ static const char *heads[] = {"defn",+ "defn-",+ "def",+ "defmacro",+ "defmulti",+ "defmethod",+ "defprotocol",+ "defrecord",+ "deftype",+ "definterface",+ "defonce", // Clojure+ "define",+ "define-syntax",+ "define-values",+ "define-syntax-rule",+ "define-struct",+ "define-record-type",+ "define/contract", // Scheme/Racket+ NULL};for (int i = 0; heads[i]; i++) {if (strcmp(t, heads[i]) == 0) {return true;diff --git a/internal/cbm/lang_specs.c b/internal/cbm/lang_specs.cindex 7628090bb..2886f8498 100644--- a/internal/cbm/lang_specs.c+++ b/internal/cbm/lang_specs.c@@ -1211,8 +1211,8 @@ static const char *hare_branch_types[] = {"if_statement", "for_statement", "switstatic const char *hare_var_types[] = {"let_declaration", "const_declaration", NULL};static const char *hare_assign_types[] = {"assignment_expression", NULL};static const char *hare_module_types[] = {"source_file", NULL};-static const char *pony_func_types[] = {"method", "constructor", "ffi_method",- "lambda_expression", NULL};+static const char *pony_func_types[] = {"method", "constructor", "ffi_method", "lambda_expression",+ NULL};static const char *pony_class_types[] = {"actor_definition", "class_definition", "struct_definition", "trait_definition","interface_definition", "primitive_definition", "type_alias", NULL};@@ -1518,8 +1518,8 @@ static const char *smithy_field_types[] = {"shape_member", NULL};static const char *smithy_import_types[] = {"use_statement", NULL};static const char *smithy_module_types[] = {"source_file", NULL};static const char *wit_func_types[] = {"func_item", "resource_method", NULL};-static const char *wit_class_types[] = {"record_item", "resource_item", "enum_items",- "variant_items", "flags_items", NULL};+static const char *wit_class_types[] = {"record_item", "resource_item", "enum_items",+ "variant_items", "flags_items", NULL};static const char *wit_field_types[] = {"record_field", NULL};static const char *wit_import_types[] = {"import_item", "toplevel_use_item", "export_item", "import", "include", "include_item", NULL};@@ -2172,10 +2172,10 @@ static const CBMLangSpec lang_specs[CBM_LANG_COUNT] = {empty_types, NULL, NULL, tree_sitter_sway, NULL},// CBM_LANG_NASM- [CBM_LANG_NASM] = {CBM_LANG_NASM, nasm_func_types, nasm_class_types, empty_types, nasm_module_types,- nasm_call_types, nasm_import_types, empty_types, empty_types, nasm_var_types,- empty_types, empty_types, NULL, empty_types, NULL, NULL, tree_sitter_nasm,- NULL},+ [CBM_LANG_NASM] = {CBM_LANG_NASM, nasm_func_types, nasm_class_types, empty_types,+ nasm_module_types, nasm_call_types, nasm_import_types, empty_types,+ empty_types, nasm_var_types, empty_types, empty_types, NULL, empty_types,+ NULL, NULL, tree_sitter_nasm, NULL},// CBM_LANG_ASSEMBLY[CBM_LANG_ASSEMBLY] = {CBM_LANG_ASSEMBLY, assembly_func_types, empty_types, empty_types,@@ -2389,10 +2389,10 @@ static const CBMLangSpec lang_specs[CBM_LANG_COUNT] = {NULL, tree_sitter_smali, NULL},// CBM_LANG_TABLEGEN- [CBM_LANG_TABLEGEN] = {CBM_LANG_TABLEGEN, tablegen_func_types, tablegen_class_types, empty_types,- tablegen_module_types, empty_types, tablegen_import_types, empty_types,- empty_types, empty_types, empty_types, empty_types, NULL, empty_types,- NULL, NULL, tree_sitter_tablegen, NULL},+ [CBM_LANG_TABLEGEN] = {CBM_LANG_TABLEGEN, tablegen_func_types, tablegen_class_types,+ empty_types, tablegen_module_types, empty_types, tablegen_import_types,+ empty_types, empty_types, empty_types, empty_types, empty_types, NULL,+ empty_types, NULL, NULL, tree_sitter_tablegen, NULL},// CBM_LANG_ISPC[CBM_LANG_ISPC] = {CBM_LANG_ISPC, ispc_func_types, ispc_class_types, empty_types,@@ -2407,10 +2407,10 @@ static const CBMLangSpec lang_specs[CBM_LANG_COUNT] = {empty_types, NULL, NULL, tree_sitter_cairo, NULL},// CBM_LANG_MOVE- [CBM_LANG_MOVE] = {CBM_LANG_MOVE, move_func_types, empty_types, empty_types,- move_module_types, move_call_types, move_import_types, empty_types,- move_branch_types, move_var_types, move_assign_types, empty_types, NULL,- empty_types, NULL, NULL, tree_sitter_move, NULL},+ [CBM_LANG_MOVE] = {CBM_LANG_MOVE, move_func_types, empty_types, empty_types, move_module_types,+ move_call_types, move_import_types, empty_types, move_branch_types,+ move_var_types, move_assign_types, empty_types, NULL, empty_types, NULL,+ NULL, tree_sitter_move, NULL},// CBM_LANG_SQUIRREL[CBM_LANG_SQUIRREL] = {CBM_LANG_SQUIRREL, squirrel_func_types, squirrel_class_types,diff --git a/internal/cbm/sqlite_writer.c b/internal/cbm/sqlite_writer.cindex 5faa2651e..052fd3f0f 100644--- a/internal/cbm/sqlite_writer.c+++ b/internal/cbm/sqlite_writer.c@@ -1924,8 +1924,8 @@ static int write_db_after_nodes(write_db_ctx_t *w, uint32_t nodes_root) {uint32_t edges_root;uint32_t vectors_root;uint32_t token_vecs_root;- int rc = write_one_table(w, &edges_root, w->edges, w->edge_count, adapt_build_edge,- adapt_edge_id);+ int rc =+ write_one_table(w, &edges_root, w->edges, w->edge_count, adapt_build_edge, adapt_edge_id);if (rc != 0) {(void)fclose(fp);return rc;@@ -2224,7 +2224,8 @@ int cbm_write_db(const char *path, const char *project, const char *root_path,if (!w) {return CBM_NOT_FOUND;}- (void)cbm_writer_append_nodes(w, nodes, node_count); /* error recorded in w, handled by finalize */+ (void)cbm_writer_append_nodes(w, nodes,+ node_count); /* error recorded in w, handled by finalize */return cbm_writer_finalize(w, project, root_path, indexed_at, nodes, node_count, edges,edge_count, vectors, vector_count, token_vecs, token_vec_count);}diff --git a/src/pipeline/pass_complexity.c b/src/pipeline/pass_complexity.cindex 8d60747fa..4a3ebf85e 100644--- a/src/pipeline/pass_complexity.c+++ b/src/pipeline/pass_complexity.c@@ -88,8 +88,9 @@ static void append_complexity_props(cbm_gbuf_node_t *node, int tld, bool recursireturn;}memcpy(neu, old, olen - 1); /* copy without trailing '}' */- int w = snprintf(neu + (olen - 1), CBM_SZ_64, "%s\"transitive_loop_depth\":%d,\"recursive\":%s}",- empty ? "" : ",", tld, recursive ? "true" : "false");+ int w =+ snprintf(neu + (olen - 1), CBM_SZ_64, "%s\"transitive_loop_depth\":%d,\"recursive\":%s}",+ empty ? "" : ",", tld, recursive ? "true" : "false");if (w < 0) {free(neu);return;diff --git a/src/pipeline/pipeline.c b/src/pipeline/pipeline.cindex 13a78684c..95db2931e 100644--- a/src/pipeline/pipeline.c+++ b/src/pipeline/pipeline.c@@ -469,7 +469,7 @@ static void run_predump_passes(cbm_pipeline_t *p, cbm_pipeline_ctx_t *ctx) {} passes[] = {{predump_deco, "decorator_tags", false}, {predump_cfg, "configlink", false},{predump_route, "route_match", false}, {predump_sim, "similarity", true},- {predump_sem, "semantic_edges", true}, {predump_complexity, "complexity", false},+ {predump_sem, "semantic_edges", true}, {predump_complexity, "complexity", false},};enum { PREDUMP_PASS_COUNT = 6 };struct timespec t;