Repository navigation
Conversation
Retry a failed coverage report open with an extended-length absolute path. Check the file descriptor before calling fdopen so a report path failure cannot terminate the process through an invalid CRT call. AI-Assisted-By: Codex (GPT-6 Astra Medium)
Group registrations by source file, add their execution counts, and combine their executable-line bitmaps before writing a listing. Recognize different path spellings for the same source. If the line counts disagree, diagnose the stale objects and finish writing reports for unaffected files. Exercise overlapping registrations, path aliases, and incompatible source lengths without depending on compiler code generation. AI-Assisted-By: Codex (GPT-6 Astra Medium)
Add a registration entry point for hit flags while keeping the existing counting interface. If any registration supplies a Boolean flag for a line, report whether that line ran. Keep exact totals for count-only lines in the same source file. Test both registration orders and merging with a saved listing. Document when to start a fresh report when switching modes. AI-Assisted-By: Codex (GPT-6 Astra Medium)
Select the Boolean runtime callback for -cov-increment=boolean. Keep atomic and non-atomic instrumentation on the counting callback. Run the Boolean coverage test twice with report merging enabled. A hit line must still report one after the second execution. AI-Assisted-By: Codex (GPT-6 Astra Medium)
LDC skips a template body's increment when its source location belongs to another module. In the static-library regression, the defining module contains only the template and its listing is missing entirely. Give each emitting module counters for the source lines it instruments. Register hits under the defining source file, and keep compile-time hits and coverage thresholds with the defining module. Re-enable the static-library regression and check the template body. Verify that a separately emitted Boolean template remains a single hit across repeated executions. Fixes ldc-developers#2538 AI-Assisted-By: Codex (GPT-6 Astra Medium)
jmh530
marked this pull request as ready for review
November 8, 2026 20:12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2538.
This is the LDC companion to dlang/dmd#24251. Both PRs update druntime to combine coverage registrations for the same source file. This PR also updates LDC’s code generation for imported templates and Boolean coverage.
Investigating why a library’s reported coverage changed under separate compilation led to an existing LDC static-library regression. One module defines a template and another instantiates it. With stock LDC 1.43.0, the program calls the template body twice, yet there is no listing for the defining module. The template is the only code in that module, and its instructions were emitted elsewhere.
LDC now records the hits in the object that emits the instructions and registers them under the defining source file. The bundled druntime combines registrations for that file. LDC uses a separate runtime callback for Boolean instrumentation so an executed line stays at one hit. Atomic and non-atomic modes continue to report execution counts.
With the fix, the same static-library build produces the missing listing. The first execution calls the template twice and uses the default
merge:0. A second execution calls it twice more and usesmerge:1to include the first execution’s listing.These results were verified on Linux x64. The coverage-mode test also passed with the Boolean callback change built independently of the template fix. The Linux code-generation test selection passed 205 tests, with 13 unsupported. Druntime regressions cover equivalent source paths, conflicting source lengths, and mixed count and Boolean registrations in both orders.
AI-Assisted-By: Codex (GPT-6 Astra Medium)