Skip to content

[Coverage][C++] VarDecl on Cond is ignored from mapping. #113027

@chapuni

Description

@chapuni
bool foo(bool a) {
    bool x;
    if ((x = (a ? false : true))) // YOI
        return !x;
    if (bool y = (a ? true : false)) // DAME
        return y;
    return a;
}

(https://godbolt.org/z/Tch3cP4G8)

"YOI" is expected.

  Branch,File 0, 3:9 -> 3:33 = #1, (#0 - #1)
  Branch,File 0, 3:15 -> 3:16 = #2, (#0 - #2)

"DAME" doesn't emit CondOp but has only Branch for IfStmt.

  Branch,File 0, 5:14 -> 5:15 = #3, ((#0 - #1) - #3)

Looks like CoverageMappingGen.cpp doesn't traverse VarDecl on Cond.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions