Issue 171822
Summary [Coverage] Line coverage contains invalid counts
Labels new issue
Assignees
Reporter sebastianzander
    In our codebase, `llvm-cov export --format=lcov` produces some weird, unrealistic high line hit counts, especially considering the line counts surrounding them within the same region. Find an example of a slightly obfuscated function together with the LCOV output below:

```cpp
  int DisplayIdManager::findNewDisplayID( const Framework &workingFw, const Framework &orderingFw,
    const QString &businessKey, const QString &orderKey )
  { // line 330
    Q_ASSERT( !parentBusinessKey.isEmpty() && !orderKey.isEmpty() );

    // try to find in cache at first
    int displayID = displayIdCache.maxDisplayId( orderKey, businessKey );
    if ( displayID > 0 )
    {
      ++displayID;
 displayIdCache.setMaxDisplayId( orderKey, businessKey, displayID );
 return displayID;
    }

    int workingVersionID = getVersionIdByType( workingFw, versionTypes_c::WORKING ); // line 342
    int orderingVersionID = getVersionIdByType( orderingFw, versionTypes_c::ORDERING );

    // unrelated comment
    const auto &foo = idl_n::fetch< someList_c >( workingFw );
 ...
```

```lcov
SF:/opt/.../display_id_mgr.cpp
...
DA:330,77568
DA:331,77568
DA:334,77568
DA:335,77568
DA:336,78033
DA:337,78033
DA:338,78033
DA:339,78033
DA:340,78033
DA:342,18446744073709551151
DA:343,18446744073709551151
DA:346,18446744073709551151
DA:348,18446744073709551151
DA:349,2
DA:350,2
...
```

It is weird, because these lines are unconditionally executed and the count of lines before and after seems normal.

LLVM version: 16.0.2
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to