LLVM coverage does not process headers which are included via a search path
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
### 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 ` 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
```
Contributor guide
Research direction
Start with the minimal reproducer at quuuuux/bazel_clang_coverage_reproducer and compare test.cc line 3 with the two generated coverage reports. Trace the LLVM coverage handling for headers included through a search path versus a relative path; done means the search-path header appears in bazel-out/_coverage/_coverage_report.dat alongside the other files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- build-system, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100