Skip to content

Source-based code coverage incorrectly handles if constexpr block #54419

Closed
@chfast

Description

@chfast

When a if constexpr has a block {} and the condition is false, the source-based code coverage always marks the opening { as not-executed region (see line 4).

Tested with clang 14.

    1|       |template <int C>
    2|      1|int test() {
    3|      1|    if constexpr (C == 0)
  ------------------
  |  Branch (3:19): [Folded - Ignored]
  ------------------
    4|      0|    {
    5|      1|        return 1;
    6|      1|    }
    7|      1|    return 0;
    8|      1|}
    9|       |
   10|       |int main()
   11|      1|{
   12|      1|    return test<1>();
   13|      1|}

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:codegenIR generation bugs: mangling, exceptions, etc.clang:frontendLanguage frontend issues, e.g. anything involving "Sema"coverage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions