Skip to content

Commit dd89a93

Browse files
committed
style: clang-format 20.1.8 on lines changed since lev
Whitespace and line breaks only, plus one string literal split into two adjacent literals in tests/test_swift_member_calls.c. Produced by git-clang-format against lev-os/lev over internal, src and tests. Signed-off-by: chidev <[email protected]>
1 parent b7c67df commit dd89a93

18 files changed

Lines changed: 157 additions & 188 deletions

‎internal/cbm/callable_overload.c‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,7 @@ static const char *params_shape(CBMArena *a, TSNode func, const char *source, CB
222222
void cbm_overload_describe_def(CBMArena *a, CBMDefinition *def, TSNode func_node,
223223
const char *source, CBMLanguage lang) {
224224
if (!a || !def || !source || ts_node_is_null(func_node) || !cbm_overload_lang(lang) ||
225-
!def->label ||
226-
(strcmp(def->label, "Function") != 0 && strcmp(def->label, "Method") != 0)) {
225+
!def->label || (strcmp(def->label, "Function") != 0 && strcmp(def->label, "Method") != 0)) {
227226
return;
228227
}
229228
CBMCallableIdentity mode =
@@ -246,8 +245,7 @@ static void java_args_shape(ovl_shape_t *s, TSNode call) {
246245

247246
/* Kotlin and Swift: call_expression -> call_suffix -> value_arguments, and a
248247
* trailing lambda/closure beside the value_arguments in the call_suffix. */
249-
static void suffix_args_shape(ovl_shape_t *s, TSNode suffix, const char *source,
250-
CBMLanguage lang) {
248+
static void suffix_args_shape(ovl_shape_t *s, TSNode suffix, const char *source, CBMLanguage lang) {
251249
uint32_t count = ts_node_named_child_count(suffix);
252250
for (uint32_t i = 0; i < count; i++) {
253251
TSNode ch = ts_node_named_child(suffix, i);
@@ -260,7 +258,8 @@ static void suffix_args_shape(ovl_shape_t *s, TSNode suffix, const char *source,
260258
}
261259
TSNode label = {0};
262260
if (lang == CBM_LANG_SWIFT) {
263-
TSNode name = ts_node_child_by_field_name(arg, "name", (uint32_t)strlen("name"));
261+
TSNode name =
262+
ts_node_child_by_field_name(arg, "name", (uint32_t)strlen("name"));
264263
if (!ts_node_is_null(name) && kind_is(name, "value_argument_label")) {
265264
label = name;
266265
}
@@ -524,7 +523,7 @@ static void split_group(CBMArena *a, CBMFileResult *result, const ovl_ref_t *ref
524523
size_t base_len = strlen(base);
525524
for (int k = 0; k < n; k++) {
526525
CBMDefinition *d = &defs[idx[k]];
527-
const char *params = !d->callable_params ? OVL_UNKNOWN
526+
const char *params = !d->callable_params ? OVL_UNKNOWN
528527
: d->callable_params[0] ? d->callable_params
529528
: CBM_OVERLOAD_NO_PARAMS;
530529
add_extra_prop(a, d, CBM_OVERLOAD_PARAMS_PROP, params);

‎internal/cbm/extract_calls.c‎

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -892,9 +892,8 @@ static bool swift_is_view_modifier(const char *name) {
892892
/* The member a navigation_expression names (`a.b` -> b), or NULL. */
893893
static char *swift_nav_member(CBMArena *a, TSNode nav, const char *source) {
894894
TSNode suffix = ts_node_child_by_field_name(nav, TS_FIELD("suffix"));
895-
TSNode member = ts_node_is_null(suffix)
896-
? suffix
897-
: ts_node_child_by_field_name(suffix, TS_FIELD("suffix"));
895+
TSNode member =
896+
ts_node_is_null(suffix) ? suffix : ts_node_child_by_field_name(suffix, TS_FIELD("suffix"));
898897
if (ts_node_is_null(member) || strcmp(ts_node_type(member), "simple_identifier") != 0) {
899898
return NULL;
900899
}
@@ -907,8 +906,7 @@ static char *swift_nav_member(CBMArena *a, TSNode nav, const char *source) {
907906
* this call included, applies a known view modifier. A chain rooted anywhere else
908907
* (`make()\n .resume()`, `URLSession.shared.dataTask(...)\n .resume()`,
909908
* Combine / RxSwift operators) is not a view and keeps its source text. */
910-
static bool swift_chain_is_view(CBMArena *a, TSNode target, const char *mname,
911-
const char *source) {
909+
static bool swift_chain_is_view(CBMArena *a, TSNode target, const char *mname, const char *source) {
912910
if (swift_is_view_modifier(mname)) {
913911
return true;
914912
}
@@ -966,9 +964,8 @@ static char *swift_navigation_callee(CBMExtractCtx *ctx, CBMArena *a, TSNode cal
966964
const char *source) {
967965
TSNode target = ts_node_child_by_field_name(nav, TS_FIELD("target"));
968966
TSNode suffix = ts_node_child_by_field_name(nav, TS_FIELD("suffix"));
969-
TSNode member = ts_node_is_null(suffix)
970-
? suffix
971-
: ts_node_child_by_field_name(suffix, TS_FIELD("suffix"));
967+
TSNode member =
968+
ts_node_is_null(suffix) ? suffix : ts_node_child_by_field_name(suffix, TS_FIELD("suffix"));
972969
char *mname = ts_node_is_null(member) ? NULL : cbm_node_text(a, member, source);
973970
if (ts_node_is_null(target) || !mname || !mname[0] ||
974971
strcmp(ts_node_type(member), "simple_identifier") != 0) {
@@ -989,8 +986,7 @@ static char *swift_navigation_callee(CBMExtractCtx *ctx, CBMArena *a, TSNode cal
989986
}
990987
type = swift_local_cast_type(ctx, call, recv);
991988
}
992-
} else if ((strcmp(tk, "call_expression") == 0 ||
993-
strcmp(tk, "constructor_expression") == 0) &&
989+
} else if ((strcmp(tk, "call_expression") == 0 || strcmp(tk, "constructor_expression") == 0) &&
994990
swift_suffix_starts_line(target, suffix, source) &&
995991
swift_chain_is_view(a, target, mname, source)) {
996992
type = cbm_arena_strdup(a, "View");
@@ -1001,8 +997,8 @@ static char *swift_navigation_callee(CBMExtractCtx *ctx, CBMArena *a, TSNode cal
1001997
return cbm_node_text(a, nav, source);
1002998
}
1003999

1004-
static char *extract_swift_callee(CBMExtractCtx *ctx, CBMArena *a, TSNode node,
1005-
const char *source, const char *nk) {
1000+
static char *extract_swift_callee(CBMExtractCtx *ctx, CBMArena *a, TSNode node, const char *source,
1001+
const char *nk) {
10061002
if (strcmp(nk, "call_expression") != 0 && strcmp(nk, "constructor_expression") != 0) {
10071003
return NULL;
10081004
}

‎internal/cbm/lsp/kotlin_lsp.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,7 @@ static void kt_emit_resolved_kind(KotlinLSPContext *ctx, const char *callee_qn,
451451
/* Sub-floor rows are dropped, except the external-receiver evidence row:
452452
* it is meant to stay below CBM_LSP_CONFIDENCE_FLOOR (never an edge) and
453453
* is read only by cbm_pipeline_kotlin_receiver_external. */
454-
if (confidence < 0.60f &&
455-
!(strategy && strcmp(strategy, "lsp_kt_external_receiver") == 0)) {
454+
if (confidence < 0.60f && !(strategy && strcmp(strategy, "lsp_kt_external_receiver") == 0)) {
456455
return;
457456
}
458457

‎src/pipeline/call_overloads.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,8 @@ int cbm_pipeline_overload_targets(const cbm_gbuf_t *gb, const cbm_gbuf_node_t *t
7171
const CBMCall *call, CBMLanguage lang,
7272
const cbm_gbuf_node_t **out, int cap) {
7373
char params[OVL_PROP_MAX];
74-
if (!gb || !target || !call || !out || cap < 1 || !cbm_overload_lang(lang) ||
75-
!target->name || !target->qualified_name ||
76-
!ovl_node_params(target, params, sizeof(params))) {
74+
if (!gb || !target || !call || !out || cap < 1 || !cbm_overload_lang(lang) || !target->name ||
75+
!target->qualified_name || !ovl_node_params(target, params, sizeof(params))) {
7776
return 0;
7877
}
7978
const cbm_gbuf_node_t **same = NULL;

‎src/pipeline/pass_calls.c‎

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -926,14 +926,13 @@ static bool emit_classified_edge(cbm_pipeline_ctx_t *ctx, const CBMCall *call,
926926
* ambiguous strategy for the edge the caller writes. NULL: the chosen member
927927
* is the source itself. MUST match pass_parallel.c. */
928928
static const cbm_gbuf_node_t *calls_overload_target(cbm_pipeline_ctx_t *ctx, const CBMCall *call,
929-
CBMLanguage lang,
930-
const cbm_gbuf_node_t *source,
929+
CBMLanguage lang, const cbm_gbuf_node_t *source,
931930
const cbm_gbuf_node_t *target,
932931
cbm_resolution_t *res, bool suppress_plain,
933932
CBMCallEvidence *evidence) {
934933
const cbm_gbuf_node_t *ovl[CBM_OVERLOAD_TARGETS_MAX];
935-
int novl = cbm_pipeline_overload_targets(ctx->gbuf, target, call, lang, ovl,
936-
CBM_OVERLOAD_TARGETS_MAX);
934+
int novl =
935+
cbm_pipeline_overload_targets(ctx->gbuf, target, call, lang, ovl, CBM_OVERLOAD_TARGETS_MAX);
937936
if (novl > 1) {
938937
res->strategy = CBM_OVERLOAD_AMBIGUOUS_STRATEGY;
939938
if (res->confidence > CBM_OVERLOAD_AMBIGUOUS_CONFIDENCE) {
@@ -1103,8 +1102,8 @@ static bool br_dir_has_build_file(const char *repo_path, const char *dir) {
11031102
"build.gradle.kts", "pom.xml"};
11041103
char path[CBM_SZ_4K];
11051104
for (size_t i = 0; i < sizeof(files) / sizeof(files[0]); i++) {
1106-
int n = snprintf(path, sizeof(path), "%s%s%s/%s", repo_path, dir[0] ? "/" : "", dir,
1107-
files[i]);
1105+
int n =
1106+
snprintf(path, sizeof(path), "%s%s%s/%s", repo_path, dir[0] ? "/" : "", dir, files[i]);
11081107
if (n <= 0 || (size_t)n >= sizeof(path)) {
11091108
continue;
11101109
}
@@ -1240,13 +1239,15 @@ static const cbm_gbuf_node_t *br_unique_owner_match(const cbm_gbuf_t *gbuf,
12401239
return found;
12411240
}
12421241

1243-
const cbm_gbuf_node_t *cbm_pipeline_java_same_build_root(
1244-
const cbm_gbuf_t *gbuf, const cbm_registry_t *registry, const char *project,
1245-
const char *repo_path, CBMLanguage lang, const char *caller_rel, const char *strategy,
1246-
const cbm_gbuf_node_t *target) {
1247-
if (lang != CBM_LANG_JAVA || !gbuf || !project || !repo_path || !repo_path[0] ||
1248-
!caller_rel || !target || !target->file_path || !target->qualified_name ||
1249-
!target->name || !target->label) {
1242+
const cbm_gbuf_node_t *cbm_pipeline_java_same_build_root(const cbm_gbuf_t *gbuf,
1243+
const cbm_registry_t *registry,
1244+
const char *project, const char *repo_path,
1245+
CBMLanguage lang, const char *caller_rel,
1246+
const char *strategy,
1247+
const cbm_gbuf_node_t *target) {
1248+
if (lang != CBM_LANG_JAVA || !gbuf || !project || !repo_path || !repo_path[0] || !caller_rel ||
1249+
!target || !target->file_path || !target->qualified_name || !target->name ||
1250+
!target->label) {
12501251
return target;
12511252
}
12521253
char croot[CBM_SZ_4K];
@@ -1292,7 +1293,8 @@ const cbm_gbuf_node_t *cbm_pipeline_java_same_build_root(
12921293
free(tprefix);
12931294
free(cprefix);
12941295
if (better == target && br_strategy_is_name_guess(strategy)) {
1295-
const cbm_gbuf_node_t *own = br_unique_owner_match(gbuf, registry, repo_path, croot, target);
1296+
const cbm_gbuf_node_t *own =
1297+
br_unique_owner_match(gbuf, registry, repo_path, croot, target);
12961298
if (own) {
12971299
better = own;
12981300
}
@@ -1632,8 +1634,8 @@ static int resolve_single_call(cbm_pipeline_ctx_t *ctx, CBMCall *call, const CBM
16321634
/* (Kotlin calls carry no is_method flag; the helper reads the dotted
16331635
* callee as the member form.) */
16341636
cbm_suppress_kotlin_external_import_member(
1635-
lang == CBM_LANG_KOTLIN, true, call->callee_name, res.strategy, imports,
1636-
imp_keys, imp_count, cbm_pipeline_get_pkgmap(), cbm_pipeline_get_nsmap()) ||
1637+
lang == CBM_LANG_KOTLIN, true, call->callee_name, res.strategy, imports, imp_keys,
1638+
imp_count, cbm_pipeline_get_pkgmap(), cbm_pipeline_get_nsmap()) ||
16371639
(lang == CBM_LANG_KOTLIN && cbm_suppress_weak_member_match(true, true, res.strategy) &&
16381640
cbm_pipeline_kotlin_receiver_external(lsp_calls, call) &&
16391641
cbm_pipeline_qn_is_type_member(ctx->gbuf, res.qualified_name)) ||

‎src/pipeline/pass_parallel.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3557,9 +3557,8 @@ static void resolve_file_calls(resolve_ctx_t *rc, resolve_worker_state_t *ws, CB
35573557
cbm_pipeline_get_nsmap()) ||
35583558
/* Kotlin library receivers — MUST match pass_calls.c exactly. */
35593559
cbm_suppress_kotlin_external_import_member(
3560-
lang == CBM_LANG_KOTLIN, true, call->callee_name, res.strategy,
3561-
&result->imports, imp_keys, imp_count, cbm_pipeline_get_pkgmap(),
3562-
cbm_pipeline_get_nsmap()) ||
3560+
lang == CBM_LANG_KOTLIN, true, call->callee_name, res.strategy, &result->imports,
3561+
imp_keys, imp_count, cbm_pipeline_get_pkgmap(), cbm_pipeline_get_nsmap()) ||
35633562
(lang == CBM_LANG_KOTLIN && cbm_suppress_weak_member_match(true, true, res.strategy) &&
35643563
cbm_pipeline_kotlin_receiver_external(&result->resolved_calls, call) &&
35653564
cbm_pipeline_qn_is_type_member(rc->main_gbuf, res.qualified_name)) ||

‎src/pipeline/pipeline.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,8 @@ bool cbm_registry_name_guess_vetoed(const cbm_registry_t *r, CBMLanguage caller_
374374
* (same-named types). cbm_registry_resolve_call_scoped runs it once the
375375
* strategy chain found nothing. */
376376
bool cbm_registry_lang_climbs_supertypes(CBMLanguage lang);
377-
void cbm_registry_add_supertypes(cbm_registry_t *r, const char *type_name,
378-
const char *const *bases, CBMLanguage lang);
377+
void cbm_registry_add_supertypes(cbm_registry_t *r, const char *type_name, const char *const *bases,
378+
CBMLanguage lang);
379379
cbm_resolution_t cbm_registry_resolve_inherited_member(const cbm_registry_t *r,
380380
const char *callee_name,
381381
CBMLanguage caller_lang);

‎src/pipeline/pipeline_delta.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -738,8 +738,8 @@ int64_t cbm_delta_preseed(cbm_store_t *store, const char *project, cbm_gbuf_t *g
738738
}
739739
/* Pin the gbuf id to the database id: proxies ARE their rows. */
740740
cbm_gbuf_set_next_id(gbuf, id);
741-
int64_t got = cbm_gbuf_upsert_node(gbuf, label, name, qn, fp ? fp : "", start_line,
742-
end_line, props);
741+
int64_t got =
742+
cbm_gbuf_upsert_node(gbuf, label, name, qn, fp ? fp : "", start_line, end_line, props);
743743
cbm_free(CBM_MEM_CLASS_OTHER, overload_props);
744744
cbm_free(CBM_MEM_CLASS_OTHER, generated_props);
745745
cbm_free(CBM_MEM_CLASS_OTHER, owner_props);

‎src/pipeline/pipeline_internal.h‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -676,10 +676,12 @@ const cbm_gbuf_node_t *cbm_pipeline_file_node(const cbm_gbuf_t *gbuf, const char
676676
* own class of that name in its own package. Otherwise return `target`
677677
* unchanged. Both call resolvers apply it at the same point, so the
678678
* sequential and parallel paths stay in parity. */
679-
const cbm_gbuf_node_t *cbm_pipeline_java_same_build_root(
680-
const cbm_gbuf_t *gbuf, const cbm_registry_t *registry, const char *project,
681-
const char *repo_path, CBMLanguage lang, const char *caller_rel, const char *strategy,
682-
const cbm_gbuf_node_t *target);
679+
const cbm_gbuf_node_t *cbm_pipeline_java_same_build_root(const cbm_gbuf_t *gbuf,
680+
const cbm_registry_t *registry,
681+
const char *project, const char *repo_path,
682+
CBMLanguage lang, const char *caller_rel,
683+
const char *strategy,
684+
const cbm_gbuf_node_t *target);
683685

684686
/* Drop this thread's build-root cache (directory -> build root). Each call
685687
* resolver clears it at its start and end, so a build file added between runs

‎src/pipeline/registry.c‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2892,10 +2892,9 @@ static void supertype_simple_name(const char *spelling, char *out, size_t cap) {
28922892
out[n] = '\0';
28932893
}
28942894

2895-
void cbm_registry_add_supertypes(cbm_registry_t *r, const char *type_name,
2896-
const char *const *bases, CBMLanguage lang) {
2897-
if (!r || !type_name || !type_name[0] || !bases ||
2898-
!cbm_registry_lang_climbs_supertypes(lang)) {
2895+
void cbm_registry_add_supertypes(cbm_registry_t *r, const char *type_name, const char *const *bases,
2896+
CBMLanguage lang) {
2897+
if (!r || !type_name || !type_name[0] || !bases || !cbm_registry_lang_climbs_supertypes(lang)) {
28992898
return;
29002899
}
29012900
char self[CBM_SZ_256];
@@ -3009,8 +3008,8 @@ static bool supertype_walk_visit(supertype_walk_t *walk, const char *name) {
30093008
* first; -1: the first type that owns it owns it more than once (same-named
30103009
* types), so nothing binds; 0: none. */
30113010
static int climb_supertypes(const cbm_registry_t *r, const qn_array_t *arr, const char *member,
3012-
const char *type, CBMLanguage caller, int depth,
3013-
supertype_walk_t *walk, const char **hit) {
3011+
const char *type, CBMLanguage caller, int depth, supertype_walk_t *walk,
3012+
const char **hit) {
30143013
const supertype_list_t *list = cbm_ht_get(r->supertypes, type);
30153014
if (!list || !list->names || depth >= SUPERTYPE_MAX_DEPTH) {
30163015
return 0;
@@ -3048,8 +3047,7 @@ static int climb_supertypes(const cbm_registry_t *r, const qn_array_t *arr, cons
30483047
cbm_resolution_t cbm_registry_resolve_inherited_member(const cbm_registry_t *r,
30493048
const char *callee_name,
30503049
CBMLanguage caller_lang) {
3051-
if (!r || !r->supertypes || !callee_name ||
3052-
!cbm_registry_lang_climbs_supertypes(caller_lang)) {
3050+
if (!r || !r->supertypes || !callee_name || !cbm_registry_lang_climbs_supertypes(caller_lang)) {
30533051
return empty_result();
30543052
}
30553053
/* `[...].T.m`: T is the segment before the last; it names a type. */

0 commit comments

Comments
 (0)