[PATCH] D106115: [Bazel] Make gentbl_test compatible with coverage

Geoffrey Martin-Noble via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 15 18:08:30 PDT 2021


GMNGeoffrey created this revision.
Herald added subscribers: dcaballe, cota, teijeong, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, grosul1, Joonsoo, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, antiagainst, shauheen, rriddle, mehdi_amini.
GMNGeoffrey requested review of this revision.
Herald added subscribers: llvm-commits, stephenneuendorffer, nicolasvasilache.
Herald added a project: LLVM.

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).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106115

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


Index: utils/bazel/llvm-project-overlay/mlir/tblgen.bzl
===================================================================
--- utils/bazel/llvm-project-overlay/mlir/tblgen.bzl
+++ utils/bazel/llvm-project-overlay/mlir/tblgen.bzl
@@ -252,12 +252,19 @@
         is_executable = True,
     )
 
-    return [DefaultInfo(
-        runfiles = ctx.runfiles(
-            [ctx.executable.tblgen],
-            transitive_files = trans_srcs,
+    return [
+        coverage_common.instrumented_files_info(
+            ctx,
+            source_attributes = ["td_file", "td_srcs"],
+            dependency_attributes = ["tblgen", "deps"],
+        ),
+        DefaultInfo(
+            runfiles = ctx.runfiles(
+                [ctx.executable.tblgen],
+                transitive_files = trans_srcs,
+            ),
         ),
-    )]
+    ]
 
 gentbl_test = rule(
     _gentbl_test_impl,
@@ -266,8 +273,6 @@
           " that unlike gentbl_rule, this builds and invokes `tblgen` in the" +
           " target configuration. Takes all the same arguments as gentbl_rule" +
           " except for `out` (as it does not generate any output)",
-    # Match genrule behavior
-    output_to_genfiles = True,
     attrs = {
         "tblgen": attr.label(
             doc = "The TableGen executable run in the shell command. Note" +


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106115.359184.patch
Type: text/x-patch
Size: 1320 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210716/2fa3fb10/attachment.bin>


More information about the llvm-commits mailing list