Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coverage: Use SpanMarker to improve coverage spans for if ! expressions #118198

Merged
merged 4 commits into from
Dec 9, 2023

Commits on Dec 8, 2023

  1. Configuration menu
    Copy the full SHA
    d2d742c View commit details
    Browse the repository at this point in the history
  2. coverage: Add CoverageKind::SpanMarker for including extra spans in…

    … MIR
    
    There are cases where coverage instrumentation wants to show a span for some
    syntax element, but there is no MIR node that naturally carries that span, so
    the instrumentor can't see it.
    
    MIR building can now use this new kind of coverage statement to deliberately
    include those spans in MIR, attached to a dummy statement that has no other
    effect.
    Zalathar committed Dec 8, 2023
    Configuration menu
    Copy the full SHA
    44b47aa View commit details
    Browse the repository at this point in the history
  3. coverage: Use SpanMarker to mark continue expressions.

    This replaces the previous workaround, which was to inject a dummy `Assign`
    statement.
    Zalathar committed Dec 8, 2023
    Configuration menu
    Copy the full SHA
    9816635 View commit details
    Browse the repository at this point in the history
  4. coverage: Use SpanMarker to mark the full condition of if !

    When MIR is built for an if-not expression, the `!` part of the condition
    doesn't correspond to any MIR statement, so coverage instrumentation normally
    can't see it.
    
    We can fix that by deliberately injecting a dummy statement whose sole purpose
    is to associate that span with its enclosing block.
    Zalathar committed Dec 8, 2023
    Configuration menu
    Copy the full SHA
    d90fd02 View commit details
    Browse the repository at this point in the history