tree-sitter's TSProgressCallback mandates a non-const TSParseState*; a const * parameter here would not match the opts.progress_callback assignment below. */ cppcheck-suppress constParameterCallback
| 629 | * parameter here would not match the opts.progress_callback assignment below. */ |
| 630 | // cppcheck-suppress constParameterCallback |
| 631 | static bool cbm_timeout_cb(TSParseState *state) { |
| 632 | CBMParseBudget *budget = (CBMParseBudget *)state->payload; |
| 633 | uint64_t wall = now_ns(); |
| 634 | #ifdef CBM_ENABLE_TEST_SEAMS |
| 635 | wall += tl_parse_wall_seam_offset_ns; |
| 636 | #endif |
| 637 | bool over = |
| 638 | cbm_thread_cpu_time_ns() > budget->cpu_deadline_ns || wall > budget->wall_ceiling_ns; |
| 639 | if (over) { |
| 640 | budget->tripped = true; /* so a NULL tree can name its real cause */ |
| 641 | } |
| 642 | return over; |
| 643 | } |
| 644 | |
| 645 | // --- Thread-local parser pool --- |
| 646 | // TSParser is not thread-safe, but can be reused across files on the same thread. |
nothing calls this directly
no test coverage detected