Same question by line number, for the few callers that ask about one region * rather than every line of a file. This form walks the source to find the span, * which is why the per-line caller below uses a table instead. */
| 2600 | * rather than every line of a file. This form walks the source to find the span, |
| 2601 | * which is why the per-line caller below uses a table instead. */ |
| 2602 | static bool cbm_span_is_macro_invocation(const char *src, int src_len, uint32_t start_line, |
| 2603 | uint32_t end_line, const CBMDefArray *defs) { |
| 2604 | if (!src || src_len <= 0 || !defs || start_line == 0 || end_line < start_line) { |
| 2605 | return false; |
| 2606 | } |
| 2607 | int span_start = 0; |
| 2608 | uint32_t line = 1; |
| 2609 | while (span_start < src_len && line < start_line) { |
| 2610 | if (src[span_start++] == '\n') { |
| 2611 | line++; |
| 2612 | } |
| 2613 | } |
| 2614 | if (line != start_line) { |
| 2615 | CBM_MACRO_LINE_SCAN(span_start); |
| 2616 | return false; |
| 2617 | } |
| 2618 | int span_end = span_start; |
| 2619 | while (span_end < src_len && line <= end_line) { |
| 2620 | if (src[span_end++] == '\n') { |
| 2621 | line++; |
| 2622 | } |
| 2623 | } |
| 2624 | CBM_MACRO_LINE_SCAN(span_end); |
| 2625 | return cbm_byte_span_is_macro_invocation(src, src_len, span_start, span_end, defs); |
| 2626 | } |
| 2627 | |
| 2628 | /* True if [rs, re] is fully enclosed by an extracted callable definition (a |
| 2629 | * Function/Method body). A macro invocation INSIDE a real function body is an |
no test coverage detected