C++ implicit calls that produce no textual call node: the destructor (`delete p`), the copy/move constructor (`T a = b;` copy-init), and the conversion operator (`if (obj)` where obj has `operator bool`). The c-LSP resolves each to the corresponding member but there is no call site to join to (callable=0). Synthesize a textual call sourced to the enclosing function so the lsp_{destructor,copy_cons
| 3536 | // Spurious synthesis (a condition/operand that has no such member) resolves to |
| 3537 | // nothing and is dropped, so no extra edge is produced. |
| 3538 | static void extract_cpp_implicit_calls(CBMExtractCtx *ctx, TSNode node, const char *kind, |
| 3539 | const char *enclosing_func_qn) { |
| 3540 | const char *callee = NULL; |
| 3541 | if (strcmp(kind, "delete_expression") == 0) { |
| 3542 | TSNode operand = ts_node_child_by_field_name(node, TS_FIELD("argument")); |
| 3543 | if (ts_node_is_null(operand) && ts_node_named_child_count(node) > 0) { |
| 3544 | operand = ts_node_named_child(node, 0); |
| 3545 | } |
| 3546 | if (!ts_node_is_null(operand)) { |
| 3547 | callee = "~"; |
| 3548 | } |
| 3549 | } else if (strcmp(kind, "if_statement") == 0 || strcmp(kind, "while_statement") == 0 || |
| 3550 | strcmp(kind, "do_statement") == 0) { |
| 3551 | // `if (obj)` invokes obj's `operator bool`. Only a lone-identifier |
| 3552 | // condition triggers it; comparisons/logical exprs evaluate to bool. |
| 3553 | TSNode cond = ts_node_child_by_field_name(node, TS_FIELD("condition")); |
| 3554 | if (!ts_node_is_null(cond)) { |
| 3555 | TSNode inner = cond; |
| 3556 | if (strcmp(ts_node_type(cond), "condition_clause") == 0 && |
| 3557 | ts_node_named_child_count(cond) == 1) { |
| 3558 | inner = ts_node_named_child(cond, 0); |
| 3559 | } |
| 3560 | if (strcmp(ts_node_type(inner), "identifier") == 0) { |
| 3561 | callee = "operator bool"; |
| 3562 | } |
| 3563 | } |
| 3564 | } else if (strcmp(kind, "declaration") == 0) { |
| 3565 | // `T a = b;` — copy-init from an identifier invokes T's copy constructor. |
| 3566 | TSNode type = ts_node_child_by_field_name(node, TS_FIELD("type")); |
| 3567 | TSNode decl = ts_node_child_by_field_name(node, TS_FIELD("declarator")); |
| 3568 | if (!ts_node_is_null(type) && !ts_node_is_null(decl) && |
| 3569 | strcmp(ts_node_type(decl), "init_declarator") == 0) { |
| 3570 | TSNode value = ts_node_child_by_field_name(decl, TS_FIELD("value")); |
| 3571 | if (!ts_node_is_null(value) && strcmp(ts_node_type(value), "identifier") == 0) { |
| 3572 | char *tn = cbm_node_text(ctx->arena, type, ctx->source); |
| 3573 | if (tn) { |
| 3574 | const char *colon = strrchr(tn, ':'); |
| 3575 | callee = colon ? colon + 1 : tn; |
| 3576 | } |
| 3577 | } |
| 3578 | } |
| 3579 | } |
| 3580 | if (callee && callee[0]) { |
| 3581 | push_cpp_semantic_call_candidate(ctx, node, callee, enclosing_func_qn); |
| 3582 | } |
| 3583 | } |
| 3584 | |
| 3585 | static void extract_kotlin_desugared_calls(CBMExtractCtx *ctx, TSNode node, const char *kind, |
| 3586 | const char *enclosing_func_qn) { |
no test coverage detected