Skip to content

LLVM coverage does not process headers which are included via a search path #21667

Open
@quuuuux

Description

@quuuuux

Description of the bug:

When using --experimental_use_llvm_covmap and --experimental_generate_llvm_lcov, header files are only processed if they are included via a relative path (#include "include/foo.h") rather than a search path (includes = ["include"] followed by #include <foo.h> or #include "foo.h").

Which category does this issue belong to?

C++ Rules

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

A minimal reproducer can be found at https://github.com/quuuuux/bazel_clang_coverage_reproducer. Flipping https://github.com/quuuuux/bazel_clang_coverage_reproducer/blob/master/test.cc#L3 from 1 to 0 demonstrates that the issue goes away if the header is included via a relative path.

Which operating system are you running Bazel on?

Ubuntu 22.04 LTS

What is the output of bazel info release?

release 6.2.1

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?

No response

Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

Via search path:

cat bazel-out/_coverage/_coverage_report.dat
SF:lib.cc
...
end_of_record
SF:works.h
...
end_of_record

Via relative path:

cat bazel-out/_coverage/_coverage_report.dat
SF:include/doesntwork.h
...
end_of_record
SF:lib.cc
...
end_of_record
SF:works.h
...
end_of_record

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2We'll consider working on this in future. (Assignee optional)coverageteam-Rules-CPPIssues for C++ rulestype: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions