[PATCH] D115197: Added some documentation and minor cleanups.
Itai Zukerman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 6 15:55:14 PST 2021
izuk created this revision.
izuk requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D115197
Files:
utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
utils/bazel/llvm-project-overlay/llvm/enum_targets_gen.bzl
utils/bazel/llvm-project-overlay/llvm/target_macros.bzl
Index: utils/bazel/llvm-project-overlay/llvm/target_macros.bzl
===================================================================
--- utils/bazel/llvm-project-overlay/llvm/target_macros.bzl
+++ utils/bazel/llvm-project-overlay/llvm/target_macros.bzl
@@ -17,10 +17,10 @@
return [m.split("/")[2] for m in matches]
def enabled_targets(pattern):
- """Build a list of Bazel targets matching the pattern.
+ """Build a list of enabled LLVM targets.
- This macro builds an expression that evaluates to a list of enabled
- Bazel targets of the form `<target><pattern>`.
+ This macro builds a depency list that evaluates to Bazel targets of the
+ form `<target><pattern>` for every enabled LLVM target.
"""
# Build a list of selects that either choose the Bazel target or not,
# depending on the `:targets` flag.
@@ -32,7 +32,7 @@
for t in llvm_targets
]
# Fold over the selects with "+".
- result = selects[0]
- for s in selects[1:]:
+ result = []
+ for s in selects:
result += s
return result
Index: utils/bazel/llvm-project-overlay/llvm/enum_targets_gen.bzl
===================================================================
--- utils/bazel/llvm-project-overlay/llvm/enum_targets_gen.bzl
+++ utils/bazel/llvm-project-overlay/llvm/enum_targets_gen.bzl
@@ -53,7 +53,9 @@
),
"valid_targets": attr.string_list(
mandatory = True,
- doc = "A list of LLVM targets that are valid for this enum.",
+ doc = "A list of LLVM targets that are valid for this enum. " +
+ "Since this value depends on what files are present, it " +
+ "must be evaluated outside the implementation of the rule.",
),
"targets": attr.label(
mandatory = True,
Index: utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
===================================================================
--- utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
+++ utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
@@ -28,6 +28,12 @@
]
# A command-line flag for restricting the list of LLVM targets to build.
+#
+# See `llvm_targets` in `:targets.bzl` for the full list of available targets.
+#
+# Usage:
+#
+# $ bazel build -- at llvm-projectllvm:targets=AArch64,X86 --config=generic_clang @llvm-project...
string_list_flag(
name = "targets",
build_setting_default = llvm_targets,
@@ -43,7 +49,7 @@
for target in llvm_targets
]
-# Replace macros in headers with lists of enabled targets.
+# Expand LLVM target enumerations in C++ headers with lists of enabled targets.
[
enum_targets_gen(
name = name,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115197.392212.patch
Type: text/x-patch
Size: 2679 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211206/025ba35b/attachment.bin>
More information about the llvm-commits
mailing list