bazel-contrib / bazel-contrib/rules_foreign_cc

Incorrect merging of cc_infos in _define_out_cc_info (framework.bzl)

Open Beginner friendly
#1,576 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
737
Forks
270
PR merge metrics
No merged PRs in 30d

Description

Currently, there is merging of Cc infos performed here:
https://github.com/bazel-contrib/rules_foreign_cc/blob/main/foreign_cc/private/framework.bzl#L1237

This is incorrect, because the `CcInfo` of the output target does **not** contain any `direct_public_headers`, only `headers`. This is problematic for tools like depend-on-what-you-use (DWYU), which need targets to have `direct_public_headers`.

The correct implementation is:

```starlark
return cc_common.merge_cc_infos(direct_cc_infos = [cc_info], cc_infos = [inputs_info])
```

Contributor guide

Open the contributing guide

Research direction

Open foreign_cc/private/framework.bzl at _define_out_cc_info around line 1237 and inspect how the output CcInfo is merged with inputs_info. Apply the stated merge behavior, then verify that the resulting output preserves direct_public_headers for tools such as DWYU.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.