Skip to content

Commit 05d16b1

Browse files
GMNGeoffreymemfrob
authored andcommitted
[Bazel] Make gentbl_test compatible with coverage
Add explicit coverage provider. Also remove output_to_genfiles which isn't necessary for this test (it's just copy-pasta from gentbl_rule, which needs it for output C++ header files). Reviewed By: jpienaar Differential Revision: https://reviews.llvm.org/D106115
1 parent 0d59273 commit 05d16b1

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

utils/bazel/llvm-project-overlay/mlir/tblgen.bzl

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,19 @@ def _gentbl_test_impl(ctx):
257257
is_executable = True,
258258
)
259259

260-
return [DefaultInfo(
261-
runfiles = ctx.runfiles(
262-
[ctx.executable.tblgen],
263-
transitive_files = trans_srcs,
260+
return [
261+
coverage_common.instrumented_files_info(
262+
ctx,
263+
source_attributes = ["td_file", "td_srcs"],
264+
dependency_attributes = ["tblgen", "deps"],
265+
),
266+
DefaultInfo(
267+
runfiles = ctx.runfiles(
268+
[ctx.executable.tblgen],
269+
transitive_files = trans_srcs,
270+
),
264271
),
265-
)]
272+
]
266273

267274
gentbl_test = rule(
268275
_gentbl_test_impl,
@@ -271,8 +278,6 @@ gentbl_test = rule(
271278
" that unlike gentbl_rule, this builds and invokes `tblgen` in the" +
272279
" target configuration. Takes all the same arguments as gentbl_rule" +
273280
" except for `out` (as it does not generate any output)",
274-
# Match genrule behavior
275-
output_to_genfiles = True,
276281
attrs = {
277282
"tblgen": attr.label(
278283
doc = "The TableGen executable run in the shell command. Note" +

0 commit comments

Comments
 (0)