Squashed 'third_party/rules_rust/' changes from 078c6908f..bf9ddeb7c
bf9ddeb7c Release 0.25.1 (#2049)
db5b2fd65 Update tinyjson (#2050)
6a7872ae3 Fix prost proto packages not sanitizing to valid module names (#2044)
c080d7bfa Moved legacy protobuf rules to `proto/protobuf` (#2043)
1281cc051 Remove debug code. (#2048)
cd126be1f Fix build failure finding crate_roots when mixed with generated sources (#2041)
7f751cddd Consolidate rust_prost_library and fix extension-only proto generation. (#2047)
6118c81f2 Release 0.25.0 (#2042)
a6f29fd07 Add Prost and Tonic rules. (#2033)
9442aed8c fix: `crate_type` more accurately corresponds to CC linking actions (#1975)
4f4e2b17b Re-enable zig example on CI (#2030)
2ded0c2f5 Fix flaky coverage test in CI (#2028)
36f8251f9 Exclude .tmp_git_root from globs (#1948)
ca750fa83 Eliminate Rustfmt action in Bindgen rules. Bindgen can run rustfmt (#2025)
c55ec0cfb Allow sysroots from cc_toolchains to be added to bindgen actions (#2024)
9314b1b0c Release 0.24.1 (#2023)
92ea74ade Making rust_std attr in rust_toolchain mandatory (#1984)
a54b8e14b Update `rust_library_group` to use `DepVariantInfo` (#2022)
47644346b Release v0.24.0 (#2020)
a6b0a7f39 Rust library group (#1848)
bc43f4841 Fix crate_universe's `all_crate_deps` and `aliases` functions failing in case the crate's Cargo.toml has condtional dependencies (#2018)
8f27ec7c5 fix: load cargo manifest without resolving abs path of deps (#2017)
23f99bb63 feature: `target_compatible_with` added to `CommonAttrs` (#1976)
11f8c9875 Make `rust_doc_test` inherit it's crate aliases attribute (#2007)
8e848414d Regenerated crate_universe outputs for all packages (#2011)
1b6365131 Don't use startup:windows (#2012)
e80582e75 Fix thumbv* platform resolution (#2010)
367f90ef0 Update bindgen version to 0.65.1 (#2008)
e6ed5bf90 Release 0.23.0 (#2003)
93b230bb8 Fix code coverage collection. (#2001)
0a14bfbb0 Minor CI and test cleanup (#2004)
3e2ee941a Update bindgen rules to build clang from source. (#1998)
5a1a7577d Split up cargo_build_script tests (#2002)
eb6413e83 Update various bash scripts to pipe errors to stderr (#1999)
affe947ac Update stardoc version (#1997)
7073146f8 Add support for armv8-m (#1993)
73a06f130 Added Rust 1.70.0 (#1991)
23c20a93f Fixes crates_vendor workspace name detection when using bzlmod (#1990)
f5813fa08 Set windows flags in platform-specific bazelrc (#1988)
c1632b5b5 Fix up anchor link (#1987)
56e760487 Fix typo in crate_universe-generated defs.bzl comment (#1981)
94cbe4c2c Symlink in the exec-root so that relative paths will work, unchanged. (#1781)
af8ef62eb Release 0.22.0 (#1974)
4aaa6de30 Allow specifying exec and target compatibility constraints (#1971)
f1b19c394 Update rules_apple in tests (#1972)
937e63399 Add T2 support for x86_64-unknown-none (#1967)
66b1bf165 fix: lld-link (MSVC) fix flags including `-l` prefix (#1958)
285dcbbb9 feature: expose `extra_rustc_flags` and `extra_exec_rustc_flags` at `rust_register_toolchains` (#1959)
0f25cb462 Removed `rust_toolchain.os` in favor of `rust_toolchain.exec_triple`. (#1960)
a2a1109dc Add T2 support for thumbv7em-none-eabi (#1957)
80f0eb488 Support for `no_std` mode (#1934)
99aaf0830 Rename crates_vendor_manifests to cvm to shorten windows path lengths (#1944)
0a57da049 Added tests for build script dependencies to crate_universe (#1943)
caffb0a08 Release 0.21.1 (#1936)
c869a17c7 Fix regression in building zlib (#1935)
24b9dea4f Release 0.21.0 (#1933)
7677c617e Add support for rustc flags to `rust_proto_library` (#1932)
fa304ae48 Updated zlib BUILD file to support darwin-arm64 (#1931)
a86313282 Added Rust 1.69.0 (#1930)
f0e12c707 Make BuildInfo provider public (#1920)
c6ad23aba Respect `#[global_allocator]` in `cc_common.link` builds (#1926)
d78752504 Exclude target directory from release tars (#1922)
0339cd18a [wasm-bindgen] Update to v0.2.84 (#1919)
07af5678e Handle corner case for windows architecture detection (#1915)
c56e7660d Fix optional deps by platform (#1911)
4663ff6a3 cc_common_link: also respect --custom_malloc if set (#1912)
dab425760 Add Rust 1.68.2 (#1908)
e4bd39f95 Add empty rustfmt.toml (#1907)
eaf513865 Support bzlmod (#1528)
1074ecbab Release v0.20.0 (#1900)
44aec0a79 ci: fix test config in cc_common_link_ubuntu2004 (#1904)
6571cde64 Adds per_crate_rustc_flag build setting. (#1827)
7a47449df Added Rust 1.68.1 (#1898)
e3bcdbad1 Fixed rustdoc warnings in crate_universe (#1897)
529f45900 Added `rustdoc_flags` attribute to rust_doc rule (#1867)
9e3499405 Have rustdoc return its output directory instead of zip default. (#1868)
9d6741f40 Implement support for optional crates enabled with dep: features (#1885)
fd10963ea Skip adding -lstatic to libtest and libstd on Darwin (#1620)
b3314b45e Release 0.19.1 (#1895)
c1a9fd86f Accumulate all features from cargo tree output (#1884)
206f71c95 Disable zig example (#1893)
1a5d07cd2 Add runfiles support to rust_stdlib_filegroup (#1890)
6996cd550 Deleted unused targets and cleanup docs (#1889)
a85e24e20 Fix triple constraints for iOS and watchOS (#1888)
e13fd3bad Release rules_rust and cargo-bazel (#1882)
9e9853d63 Add support for thumbv7em with hard float (#1871)
b3cd5962e Added Rust 1.68.0 (#1866)
f1b7aedf5 Support sparse indexes (#1857)
7f2dd433a Make fetch_shas work with mktemp from coreutils 8.32 (#1870)
a9cc01230 Update crate_universe dependencies (#1872)
c038e94ae Pipe stderr from cargo tree processes (#1879)
222d60322 Parallelize cargo tree calls (#1874)
cdbbf7131 Add Fuchsia platform support (#1833)
17e5b04c2 Use `_make_link_flags_darwin` when target os is `ios`. (#1843)
d9ecc8df4 crate_universe: Support fetching crates with git branch, tag or rev (#1846)
1c694cd60 Forward `toolchains` to `cargo_build_script` targets (#1862)
9affcbfa7 Skip detecting abi for empty values (#1830)
6193fe823 Re-enable crate_universe MacOS tests (#1861)
c25db95ae Updated Rust to 1.67.1 (#1864)
7b8fd06be Support `[patch]` in crate_universe when using multiple `Cargo.toml`s (#1856)
c645fe399 Silence windows build failure (#1863)
75bba7b50 Make rust_clippy providers match rustfmt_test (#1806)
f09d72755 Fix test assertion for arm64 macs (#1845)
f4113bfe1 Fix tests for new Apple toolchain (#1844)
20ce44e30 fix: use target_triple struct instead of string (#1835)
bdbded181 Fix code example in doc (#1838)
4f4014052 Fix typo: plced -> placed (#1834)
baeb0664d Remove ios/android/wasm support for gen_rust_project deps (#1684)
02557a47a Add `render_config` attribute to `crates_vendor`. (#1832)
4357fb154 Updated rules_rust to version 0.18.0 (#1829)
9adfdca9b Various cleanups (#1828)
4fa412385 Added update known shas to include T1-T2 triples (#1824)
905731ad9 Instructions on how to perform `rustfmt` check (#1822) (#1823)
108b1a187 Encapsulate running cargo into a struct (#1815)
57a099b63 Fixes resolver issue with root packages and another dependency format (#1819)
78ca9ba0a Use env method recently added to cargo_metadata (#1813)
92834930f Updated `rust_toolchain.target_json` to take encoded json strings (#1810)
84f1d0657 support `resolver = "2"` target-specific features (#1710)
a5853fd37 Use correct dynamic link args fro proc-macro crates (#1803)
b656e2553 Added tests for the `triple` constructor (#1811)
ea4a79ad9 Disable job in CI to avoid infrastructure failure. (#1816)
2fc02f030 Delete `rust_toolchain.rusrc_srcs` (#1807)
804d5fc1f Convert `rust_toolchain` attrs `exec_triple` and `target_triple` to structs (#1808)
499a2ca38 Updated platform triple values from strings to structs ("triple") (#1804)
aae1dbdcb Unify functions for computing constraint values for platform triple abi (#1805)
0d6d2b1eb Updated rules_rust version to `0.17.0` (#1800)
88e83f2df Added Rust 1.67.0 (#1799)
6922b5012 rustdoc_test: fix and test OUT_DIR (#1779)
ad01d1b0e [crate_universe] add an annotation to disable pipelining (#1733)
f651cd18f Add `CARGO_BAZEL_REPIN_ONLY` repinning allowlist (#1798)
d7f0debb0 Revert "Disable broken clang and ldd CI jobs (#1785)" (#1796)
96f82aaad Fix `cc_common.link` file output name (#1795)
5079b64d5 Fix use of `rustfmt_toolchain` when `rustc` is not provided (#1794)
23c650f35 Have `--experimental_use_cc_common_link` cover `rust_shared_library` (#1792)
ba0fb5956 Added support for `--nolegacy_external_runfiles` to `rust_doc_test` (#1790)
112242bb7 Prevent crates_vendor from restarting bazel. (#1791)
52231ef9f Added compatibility flags to `.bazelrc` to prevent regressions (#1789)
91cd399a0 Add "crate-name={}" tag to Crate Universe targets (#1787)
1b1dae196 Added Rust 1.66.1 (#1767)
fe17e8b8e Add file:// prefix to env var in docs (#1788)
0fe742bff Updated `rust_bindgen` to use `rustfmt_toolchain` (#1770)
042fd6c1c Update docs on setting Rust versions (#1786)
dddd8a0d4 Updated crate_universe dependencies (#1775)
a1330a71f Download `rustc` in `rustfmt_toolchain_repository` (#1769)
e96aad9aa Updated the ios_build example to use `crates_vendor` (#1778)
e315007df Disable broken clang and ldd CI jobs (#1785)
4e89d52a9 rustdoc_test: substitute the root of the current crate (#1777)
a52041fb5 Support `target_settings` in `rust_repository_set` and `rust_toolchain_repository` (#1758)
49906eb29 Update clippy and rustfmt aspects to require CrateInfo providers (#1772)
85564208e Updated rules_rust version to `0.16.1` (#1761)
614499a5b Fixed inability to deserialize crate_universe lockfiles (#1760)
9803d3034 Fix data and compile_data for rust_doc (#1741)
927a364cb Update Release github pipeline to trigger automatically (#1757)
7d03e05f8 Fix release pipeline (#1756)
cf7ca5dfd Updated rules_rust to version `0.16.0` (#1750)
203fe4b9a Remove unnecessary binary file (#1755)
941c7cca9 Don't propagate `compatible_with` to the underlying `cargo_build_script` `rust_binary` target (#1754)
a31490d9a Make loads from @rules_rust//rust:defs.bzl come out on one line (#1753)
7ebad4d50 Generate only the needed subset of binaries for bindgen and proto (#1751)
4ef3d4aaa Repin examples/crate_universe_unnamed (#1752)
d6e300359 Regenerate BUILD files using serde_starlark renderer (#1746)
e7c8a97d1 Convert BUILD.$name-$version.bazel to serde_starlark (#1743)
c09818d3b Exclude generated files from language stats and collapse in code review (#1747)
26a24f030 Added CI for single toolchain channel workspaces (#1712)
caed7d814 Report context on error failing to get version (#1744)
36b57af7b Add gen_binaries annotation to control which bins to make target for (#1718)
d916a6f52 crate_universe re-pinning now defaults to "workspace" (#1723)
f34661ee1 Propagate `compatible_with` attribute to the underlying `_build_script_run` target (#1745)
92977d1bf Re-pinned all dependencies managed by crate_universe (#1735)
d5289ad1c Added `rustfmt_toolchain` and refactored toolchain repository rules (#1719)
532e60ff0 Collect targets in a deterministic order (#1736)
52e02c25b Eliminate all use of hash-based collections from crate_universe (#1737)
31073ff8e Replace tera template with serde_starlark (#1734)
d4e5586d0 Support the RUNFILES_DIR environment variable. (#1732)
1357b85b1 Addressed clippy warnings from `clippy 0.1.67 (ec56537c 2022-12-15)` (#1717)
8bc9f788d Support dsym_folder output group in tests (#1703)
90c5b6eb7 Added CI for minimum supported Rust version (#1720)
be82ff8bd Match prerelease versions with annotation wildcard (#1716)
36c7f285b Arm Thumb Embedded Targets. (#1721)
5ef52e465 Update current_toolchain_files tests to use a dedicated test rule (#1714)
c75ea6f9e Add `Runfiles::current_repository` to runfiles library (#1713)
2f0511782 Updated rules_rust to version `0.15.0` (#1706)
019f87178 Added Rust 1.66.0 (#1705)
1469cd7cb Fix labels to work with canonical label literals. (#1700)
5826a500a Add riscv32imc and riscv64gc to the known sha targets (#1698)
40dee95ce Fixed typos: normla -> normal (#1699)
8f08e77ac load_arbitrary_tool uses tool_suburl to look up sha256 (#1695)
8faec3060 Fix typos in crate_universe rendered comments (#1691)
bd64711ff Silence flaky test (#1693)
46b7ea5af Added a build setting for toolchain channels (#1671)
70b272aad Updated rules_rust to version `0.14.0` (#1669)
91e597dd1 Updated all crates_vendor outputs (#1687)
9a047b0b9 Updated crate_universe dependencies (#1686)
3a91d2f5b Add RV64GC target (#1683)
d9e752ab4 Add per-toolchain `rustc_flags` (#1635)
56237415e stardoc: Use backtick not `<code>` for attr default values (#1682)
d4b31a494 Allow passing a bazel path to vendor explicitly (#1661)
d51bf9ce0 Updated crate_universe to work with `--nolegacy_external_runfiles` (#1680)
7f40636d1 crate_universe/private/crates_vendor.bzl typo fix (#1678)
025bf7db8 Merge cc toolchain flags into build script env (#1675)
b7c36c051 Fix confusing/misleading crate_universe docs (#1677)
29233e354 Revert #1564 (#1663)
ed32b6de2 Common glob excludes (#1673)
61b99cdd1 fix: add space to crate data exclude list (#1665)
8bb25b8b7 Support Windows ARM64 (aarch64-pc-windows-msvc) (#1664)
ddf2a4c23 Re-render crate BUILD files after #1647 (#1655)
44c7e1588 Group deps and aliases by platform triple rather than by cfg string when generating BUILD files. This avoid bazel errors due to duplicate keys/deps. (#1647)
de18d8bb6 Allow `buildifier` attribute to be a file (#1660)
aa0815dc9 Fix naming of ambiguous libs (#1625)
ff314d4ab Also pass -c opt to tests in opt mode CI (#1626)
ff4e90515 Reenable windows job (#1658)
c45b8e91f Updated rules_rust to version `0.13.0` (#1644)
87d6b6c37 Update `//util/label` to support `+` in packages (#1654)
ab6959db5 fix: Fix issue with wasi-0.11.0+wasi-snapshot-preview1 (#1632)
28c090ed0 Replaced custom platform constraint values with aliases to `@platforms` (#1652)
dfbea4f52 Deprecated `rust_toolchain.rustc_srcs` (#1653)
fd1db4391 Remove deprecated attributes from rust_toolchain and cargo_bootstrap (#1651)
c8ab970c4 Generated rust-project.json files now include sysroot paths (#1641)
0a3e04cf9 Fix vendoring when not in a package (#1646)
aece1e37d Deduplicate expand_location targets in rust-project.json crate creation to avoid a bazel crash (#1639)
03a0b2483 [docs] Fixing typos in CargoConfig doc strings (#1638)
bd4fd2ac5 Upgraded cfg-expr dependency to 0.12.0. (#1636)
330554a13 Disable failing job in CI (#1640)
849f106e6 Consider compilation mode when choosing `pic`/`nopic` object files to link (#1624)
53491d719 Updated rules_rust to version `0.12.0` (#1630)
8e8843724 Remove empty glob (#1628)
1f621a944 Added Rust 1.65.0 (#1627)
c6af4d025 Add `-c opt` mode to CI (#1621)
95320cc8b process_wrapper: print line on error to parse message as json (#1566)
81eaccf39 Fixed CI breakage (#1619)
478fc3a57 Fix ambiguous native dependencies in `proc_macro`s and `staticlib`s (#1611)
9e3d8415e Build deps of _build_script_run in 'exec' mode (#1561)
ea031082b Fixed outdated docs (#1614)
a8c540e49 Restore support for old cargo_build_script load statements (#1613)
295b5ccc7 Renamed `_build_script_run` rule to `cargo_build_script` (#1612)
3778069ec Remove references to Google mirror in docs (#1607)
aad54ba29 Updated crate_universe dependencies (#1606)
c349df2a6 Remove Google mirror from Starlark snippet in release notes (#1604)
0493b998d Avoid rendering a mock root package when possible (#1596)
b04aa053c process_wrapper: Apply substitutions to param files (#1565)
b209b3e15 Updated rules_rust to version `0.11.0`. (#1587)
b1079453b Typo correction on doc (#1593)
ca5678266 Updated crate_universe dependencies (#1591)
a364d448f Fixes crates_vendor labels in remote mode when used from the root workspace (#1575)
1cc37c268 Expose the output directory from cargo_build_script (#1588)
7ffe0a555 Ignore non-utf8 text in build script output (#1583)
c5b38fe00 Merge runfiles from transitive dependencies of rust_test crate attr (#1487)
da3d522d5 Fix build scripts targeting the wrong architecture (#1564)
d288ed634 Add `out_dir` support in `cargo_dep_env` (#1571)
78d6c1b46 fix: incorrect rustfmt edition query (#1582)
48927127e Set CARGO_MANIFEST_DIR at runtime for tests (#1559)
76bd69033 Add an output group for the .rmeta (#1585)
352bfeb05 Cleanup deprecated code (#1577)
86dc561f9 Move crate_root_src to utils (#1570)
beb554eb9 update to wasm-bindgen v0.2.83 (#1567)
73fd1616b Export AbsoluteLabel functionality (#1568)
c57e7a399 Remap $PWD to empty string instead of "." (#1563)
f0cdcedc2 Added Rust 1.64.0 (#1562)
1d326554a Update docs to show release policies and support (#1560)
78c793a0a Fix markdown typo in rust_analyzer.md (#1553)
c13980fb6 Add iOS examples (#1546)
8a5e07e9f Update apple_support (#1549)
6dacd9803 Strip leading '@'s for labels in the splicing manifest (#1547)
f73d1d6fb use crate_info.deps in establish_cc_info (#1543)
4845af6c0 Add android example (#1545)
9570b7aa7 Remove -lgcc from Android builds (#1541)
cb9ca1b81 Fix crate_universe/private/srcs.bzl to work with repo mappings (#1540)
d1fc9accc Minor cleanup of CI pipelines (#1534)
2bb077b3b Updated rules_rust to version 0.10.0 (#1533)
b8751b860 add cc config info to dummy wasm32 cc toolchain (#1532)
f5ed797ee Updates rust_test to use main.rs as the root when use_libtest_harness is false (#1518)
cfcaf21d5 Preserve directory structure of source files when some are generated (#1526)
51c065841 migrating to rbe_preconfig and remove bazel_toolchains (#1524)
055abd402 Fix typo in an example of crates_repository rule (#1520)
8bfed1cd2 Added Rust 1.63.0 (#1512)
3a69ce09b Update wasm_bindgen to 0.2.82 (#1513)
git-subtree-dir: third_party/rules_rust
git-subtree-split: bf9ddeb7c83a9fe8a7d87c76134cdd8e16131b62
Signed-off-by: Adam Snaider <adsnaider@gmail.com>
Change-Id: Id9490c68d6221da66953a915a25042ef8b848505
diff --git a/bindgen/3rdparty/patches/BUILD.bazel b/bindgen/3rdparty/patches/BUILD.bazel
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/bindgen/3rdparty/patches/BUILD.bazel
diff --git a/bindgen/3rdparty/patches/README.md b/bindgen/3rdparty/patches/README.md
new file mode 100644
index 0000000..6191ecf
--- /dev/null
+++ b/bindgen/3rdparty/patches/README.md
@@ -0,0 +1,25 @@
+# Patches
+
+All patches pair with the versions of the referenced repositories defined in `@rules_rust//bindgen:repositories.bzl`.
+
+## [llvm-project.cxx17](./llvm-project.cxx17.patch)
+
+The llvm-project requires a compiler that builds with at least C++14 but there's no configuration
+for this on the targets defined in the repo. This patch plumbs through flags for setting the C++
+version on targets to avoid any need for bazel configuration flags. If this patch causes issues
+for users with their current toolchain or toolchain definitions then simply defining the `llvm-raw`
+repository before loading `rust_bindgen_dependencies` should avoid this.
+
+## [llvm-project.incompatible_disallow_empty_glob](./llvm-project.incompatible_disallow_empty_glob.patch)
+
+Uses of `glob` are updated to have `allow_empty = True` added so the llvm-project repo is compatible
+with consumers building with [--incompatible_disallow_empty_glob](https://bazel.build/reference/command-line-reference#flag--incompatible_disallow_empty_glob).
+
+Most of this patch is generated using the following regex and replace patterns. There are a handful
+of additional modifications for more extravagant globs.
+
+| regex | replace |
+| --- | --- |
+| `glob\(([\[\w\d_\-\*\/\.\],=\n\s"]+)\) \+` | `glob($1, allow_empty = True) +` |
+| `glob\(([\[\w\d_\-\*\/\.\],=\n\s"]+)\),` | `glob($1, allow_empty = True),` |
+| `(,[\s\n]+), ` | `$1` |
diff --git a/bindgen/3rdparty/patches/llvm-project.cxx17.patch b/bindgen/3rdparty/patches/llvm-project.cxx17.patch
new file mode 100644
index 0000000..fba5384
--- /dev/null
+++ b/bindgen/3rdparty/patches/llvm-project.cxx17.patch
@@ -0,0 +1,537 @@
+diff --git a/utils/bazel/configure.bzl b/utils/bazel/configure.bzl
+index 4c5ab8bd0972..44de2da1a136 100644
+--- a/utils/bazel/configure.bzl
++++ b/utils/bazel/configure.bzl
+@@ -70,6 +70,11 @@ def _overlay_directories(repository_ctx):
+ ))
+
+ def _llvm_configure_impl(repository_ctx):
++ # Force this repository rule to update if any of the overlay
++ # sources change.
++ for target in repository_ctx.attr._srcs:
++ repository_ctx.path(target)
++
+ _overlay_directories(repository_ctx)
+
+ # Create a starlark file with the requested LLVM targets.
+@@ -86,6 +91,16 @@ llvm_configure = repository_rule(
+ configure = True,
+ attrs = {
+ "targets": attr.string_list(default = DEFAULT_TARGETS),
++ "_srcs": attr.label_list(default = [
++ Label("//utils/bazel/llvm-project-overlay/clang:BUILD.bazel"),
++ Label("//utils/bazel/llvm-project-overlay/libunwind:BUILD.bazel"),
++ Label("//utils/bazel/llvm-project-overlay/llvm:binary_alias.bzl"),
++ Label("//utils/bazel/llvm-project-overlay/llvm:BUILD.bazel"),
++ Label("//utils/bazel/llvm-project-overlay/llvm:cc_plugin_library.bzl"),
++ Label("//utils/bazel/llvm-project-overlay/llvm:config.bzl"),
++ Label("//utils/bazel/llvm-project-overlay/llvm:tblgen.bzl"),
++ Label("//utils/bazel/llvm-project-overlay/llvm:template_rule.bzl"),
++ ]),
+ },
+ )
+
+diff --git a/utils/bazel/llvm-project-overlay/clang/BUILD.bazel b/utils/bazel/llvm-project-overlay/clang/BUILD.bazel
+index a2b1e0f33073..0c1abe607b58 100644
+--- a/utils/bazel/llvm-project-overlay/clang/BUILD.bazel
++++ b/utils/bazel/llvm-project-overlay/clang/BUILD.bazel
+@@ -5,6 +5,7 @@
+ load("//llvm:tblgen.bzl", "gentbl")
+ load("//llvm:binary_alias.bzl", "binary_alias")
+ load("//llvm:cc_plugin_library.bzl", "cc_plugin_library")
++load("//llvm:config.bzl", "llvm_stdcxx_copts")
+
+ package(
+ default_visibility = ["//visibility:public"],
+@@ -28,7 +29,7 @@ cc_binary(
+ ]),
+ copts = [
+ "$(STACK_FRAME_UNLIMITED)",
+- ],
++ ] + llvm_stdcxx_copts,
+ stamp = 0,
+ deps = [
+ "//llvm:Support",
+@@ -391,8 +392,8 @@ cc_library(
+ cc_library(
+ name = "basic",
+ srcs = [
+- "include/clang/Basic/Version.inc",
+ "include/VCSVersion.inc",
++ "include/clang/Basic/Version.inc",
+ ] + glob([
+ "lib/Basic/*.cpp",
+ "lib/Basic/*.c",
+@@ -406,7 +407,7 @@ cc_library(
+ copts = [
+ "-DHAVE_VCS_VERSION_INC",
+ "$(STACK_FRAME_UNLIMITED)",
+- ],
++ ] + llvm_stdcxx_copts,
+ includes = ["include"],
+ textual_hdrs = [
+ "include/clang/Basic/arm_fp16.inc",
+@@ -471,6 +472,7 @@ cc_library(
+ hdrs = glob([
+ "include/clang/Lex/*.h",
+ ]),
++ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+ ":basic",
+@@ -711,7 +713,7 @@ cc_library(
+ # headers such as `CXXABI.h`.
+ "-I$(GENDIR)/external/llvm-project/clang/lib/AST",
+ "-I$(GENDIR)/external/llvm-project/clang/lib/AST/Interp",
+- ],
++ ] + llvm_stdcxx_copts,
+ textual_hdrs = [
+ "include/clang/AST/AttrImpl.inc",
+ "include/clang/AST/AttrNodeTraverse.inc",
+@@ -763,6 +765,7 @@ cc_library(
+ "include/clang/Index/*.h",
+ "include/clang-c/*.h",
+ ]),
++ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+ ":ast",
+@@ -786,6 +789,7 @@ cc_library(
+ hdrs = glob([
+ "include/clang/Analysis/**/*.h",
+ ]),
++ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ textual_hdrs = glob([
+ "include/clang/Analysis/**/*.def",
+@@ -844,7 +848,7 @@ cc_library(
+ "include/clang/Sema/*.h",
+ "include/clang-c/*.h",
+ ]),
+- copts = ["$(STACK_FRAME_UNLIMITED)"],
++ copts = ["$(STACK_FRAME_UNLIMITED)"] + llvm_stdcxx_copts,
+ includes = ["include"],
+ textual_hdrs = [
+ "include/clang/Sema/AttrParsedAttrImpl.inc",
+@@ -911,6 +915,7 @@ cc_library(
+ "include/clang/Parse/AttrParserStringSwitches.inc",
+ "include/clang/Parse/AttrSubMatchRulesParserStringSwitches.inc",
+ ] + glob(["include/clang/Parse/*.h"]),
++ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+ ":ast",
+@@ -932,6 +937,7 @@ cc_library(
+ "lib/ASTMatchers/*.h",
+ ]),
+ hdrs = glob(["include/clang/ASTMatchers/*.h"]),
++ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+ ":ast",
+@@ -948,7 +954,7 @@ cc_library(
+ "lib/ASTMatchers/Dynamic/*.h",
+ ]),
+ hdrs = glob(["include/clang/ASTMatchers/Dynamic/*.h"]),
+- copts = ["$(STACK_FRAME_UNLIMITED)"],
++ copts = ["$(STACK_FRAME_UNLIMITED)"] + llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+ ":ast",
+@@ -966,6 +972,7 @@ cc_library(
+ "lib/Rewrite/*.h",
+ ]),
+ hdrs = glob(["include/clang/Rewrite/Core/*.h"]),
++ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+ ":ast",
+@@ -982,6 +989,7 @@ cc_library(
+ "lib/Testing/*.cpp",
+ ]),
+ hdrs = glob(["include/clang/Testing/*.h"]),
++ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+ ":basic",
+@@ -996,6 +1004,7 @@ cc_library(
+ "lib/Tooling/Core/*.h",
+ ]),
+ hdrs = glob(["include/clang/Tooling/Core/*.h"]),
++ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+ ":ast",
+@@ -1018,6 +1027,7 @@ cc_library(
+ hdrs = glob([
+ "include/clang/Tooling/*.h",
+ ]),
++ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+ ":ast",
+@@ -1042,6 +1052,7 @@ cc_library(
+ hdrs = glob([
+ "include/clang/Tooling/Inclusions/**/*.h",
+ ]),
++ copts = llvm_stdcxx_copts,
+ deps = [
+ ":basic",
+ ":lex",
+@@ -1061,6 +1072,7 @@ cc_library(
+ "include/clang/Tooling/Refactoring/**/*.h",
+ "include/clang/Tooling/Refactoring/**/*.def",
+ ]),
++ copts = llvm_stdcxx_copts,
+ deps = [
+ ":ast",
+ ":ast_matchers",
+@@ -1094,6 +1106,7 @@ cc_library(
+ name = "tooling_syntax",
+ srcs = glob(["lib/Tooling/Syntax/**/*.cpp"]),
+ hdrs = glob(["include/clang/Tooling/Syntax/**/*.h"]),
++ copts = llvm_stdcxx_copts,
+ deps = [
+ ":ast",
+ ":basic",
+@@ -1108,6 +1121,7 @@ cc_library(
+ name = "tooling_dependency_scanning",
+ srcs = glob(["lib/Tooling/DependencyScanning/**/*.cpp"]),
+ hdrs = glob(["include/clang/Tooling/DependencyScanning/**/*.h"]),
++ copts = llvm_stdcxx_copts,
+ deps = [
+ ":basic",
+ ":codegen",
+@@ -1123,6 +1137,7 @@ cc_library(
+ name = "transformer",
+ srcs = glob(["lib/Tooling/Transformer/**/*.cpp"]),
+ hdrs = glob(["include/clang/Tooling/Transformer/**/*.h"]),
++ copts = llvm_stdcxx_copts,
+ deps = [
+ ":ast",
+ ":ast_matchers",
+@@ -1138,6 +1153,7 @@ cc_library(
+ name = "ast-diff",
+ srcs = glob(["lib/Tooling/ASTDiff/*.cpp"]),
+ hdrs = glob(["include/clang/Tooling/ASTDiff/*.h"]),
++ copts = llvm_stdcxx_copts,
+ deps = [
+ ":ast",
+ ":basic",
+@@ -1150,6 +1166,7 @@ cc_library(
+ name = "crosstu",
+ srcs = glob(["lib/CrossTU/*.cpp"]),
+ hdrs = glob(["include/clang/CrossTU/*.h"]),
++ copts = llvm_stdcxx_copts,
+ deps = [
+ ":ast",
+ ":basic",
+@@ -1174,6 +1191,7 @@ cc_library(
+ ] + glob([
+ "include/clang/Format/*.h",
+ ]),
++ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+ ":basic",
+@@ -1188,6 +1206,7 @@ cc_library(
+ name = "edit",
+ srcs = glob(["lib/Edit/*.cpp"]),
+ hdrs = glob(["include/clang/Edit/*.h"]),
++ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+ ":ast",
+@@ -1222,6 +1241,7 @@ cc_library(
+ hdrs = glob([
+ "include/clang/StaticAnalyzer/Core/**/*.h",
+ ]),
++ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ textual_hdrs = glob([
+ "include/clang/StaticAnalyzer/Core/**/*.def",
+@@ -1268,7 +1288,7 @@ cc_library(
+ ] + glob([
+ "include/clang/StaticAnalyzer/Checkers/**/*.h",
+ ]),
+- copts = ["$(STACK_FRAME_UNLIMITED)"],
++ copts = ["$(STACK_FRAME_UNLIMITED)"] + llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+ ":analysis",
+@@ -1316,7 +1336,7 @@ cc_library(
+ hdrs = glob([
+ "include/clang/Driver/*.h",
+ ]),
+- copts = ["$(STACK_FRAME_UNLIMITED)"],
++ copts = ["$(STACK_FRAME_UNLIMITED)"] + llvm_stdcxx_copts,
+ includes = [
+ "include",
+ # TODO: This is likely a layering issue, but files in Arch are currently
+@@ -1479,7 +1499,7 @@ cc_library(
+ hdrs = glob([
+ "include/clang/Frontend/*.h",
+ ]),
+- copts = ["$(STACK_FRAME_UNLIMITED)"],
++ copts = ["$(STACK_FRAME_UNLIMITED)"] + llvm_stdcxx_copts,
+ data = [":builtin_headers_gen"],
+ includes = ["include"],
+ textual_hdrs = glob([
+@@ -1519,6 +1539,7 @@ cc_library(
+ "lib/Frontend/Rewrite/*.h",
+ ]),
+ hdrs = glob(["include/clang/Rewrite/Frontend/*.h"]),
++ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+ ":ast",
+@@ -1541,6 +1562,7 @@ cc_library(
+ "lib/Interpreter/*.h",
+ ]),
+ hdrs = glob(["include/clang/Interpreter/*.h"]),
++ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+ ":analysis",
+@@ -1573,7 +1595,7 @@ cc_library(
+ "lib/CodeGen/*.h",
+ ]),
+ hdrs = glob(["include/clang/CodeGen/*.h"]),
+- copts = ["$(STACK_FRAME_UNLIMITED)"],
++ copts = ["$(STACK_FRAME_UNLIMITED)"] + llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+ ":analysis",
+@@ -1624,6 +1646,7 @@ cc_library(
+ "lib/StaticAnalyzer/Frontend/**/*.h",
+ ]),
+ hdrs = glob(["include/clang/StaticAnalyzer/Frontend/**/*.h"]),
++ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+ ":analysis",
+@@ -1678,6 +1701,7 @@ cc_library(
+ hdrs = glob([
+ "include/clang/Serialization/*.h",
+ ]),
++ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ textual_hdrs = glob([
+ "include/clang/Serialization/*.def",
+@@ -1705,6 +1729,7 @@ cc_library(
+ "lib/FrontendTool/*.h",
+ ]),
+ hdrs = glob(["include/clang/FrontendTool/*.h"]),
++ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+ ":arc_migrate",
+@@ -1726,6 +1751,7 @@ cc_library(
+ "lib/ARCMigrate/*.h",
+ ]),
+ hdrs = glob(["include/clang/ARCMigrate/*.h"]),
++ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+ ":analysis",
+@@ -1752,6 +1778,7 @@ cc_library(
+ "tools/libclang/*.h",
+ ]),
+ hdrs = glob(["include/clang-c/*.h"]),
++ copts = llvm_stdcxx_copts,
+ defines = ["CINDEX_NO_EXPORTS"],
+ deps = [
+ ":arc_migrate",
+@@ -1783,7 +1810,7 @@ cc_plugin_library(
+ copts = select({
+ "@bazel_tools//src/conditions:windows": ["-D_CINDEX_LIB_"],
+ "//conditions:default": [],
+- }),
++ }) + llvm_stdcxx_copts,
+ strip_include_prefix = "include",
+ deps = [
+ ":arc_migrate",
+@@ -1912,7 +1939,7 @@ cc_library(
+ # Disable stack frame size checks in the driver because
+ # clang::ensureStackAddressSpace allocates a large array on the stack.
+ "$(STACK_FRAME_UNLIMITED)",
+- ],
++ ] + llvm_stdcxx_copts,
+ deps = [
+ ":analysis",
+ ":ast",
+@@ -1947,6 +1974,7 @@ cc_library(
+ cc_binary(
+ name = "clang",
+ srcs = [],
++ copts = llvm_stdcxx_copts,
+ stamp = 0,
+ deps = [
+ ":clang-driver",
+diff --git a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
+index 85d79a29b571..716d7f5d9645 100644
+--- a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
++++ b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
+@@ -4,7 +4,7 @@
+
+ load(":template_rule.bzl", "template_rule")
+ load(":tblgen.bzl", "gentbl")
+-load(":config.bzl", "llvm_config_defines")
++load(":config.bzl", "llvm_config_defines", "llvm_stdcxx_copts")
+ load(":targets.bzl", "llvm_targets")
+ load(":enum_targets_gen.bzl", "enum_targets_gen")
+ load(":binary_alias.bzl", "binary_alias")
+@@ -21,10 +21,12 @@ exports_files(["LICENSE.TXT"])
+ # toolchain or the `.bazelrc` file. This is just a workaround until we have a
+ # widely available feature to enable unlimited stack frame instead of using
+ # this `Make` variable.
+-llvm_copts = [
++llvm_c_only_opts = [
+ "$(STACK_FRAME_UNLIMITED)",
+ ]
+
++llvm_copts = llvm_c_only_opts + llvm_stdcxx_copts
++
+ enum_targets_gen(
+ name = "targets_def_gen",
+ src = "include/llvm/Config/Targets.def.in",
+@@ -167,10 +169,69 @@ genrule(
+ "echo -e '#undef HANDLE_EXTENSION' >> $@\n",
+ )
+
++# TODO: This separation is required to separate out C++ and C opts
++# https://github.com/bazelbuild/bazel/issues/16551
+ cc_library(
+- name = "Support",
++ name = "Support-c",
+ srcs = glob([
+ "lib/Support/*.c",
++ ]),
++ hdrs = glob([
++ "include/llvm/Support/**/*.h",
++ "include/llvm/ADT/*.h",
++ ]) + [
++ "include/llvm-c/Core.h",
++ "include/llvm-c/DataTypes.h",
++ "include/llvm-c/Deprecated.h",
++ "include/llvm-c/DisassemblerTypes.h",
++ "include/llvm-c/Error.h",
++ "include/llvm-c/ErrorHandling.h",
++ "include/llvm-c/ExternC.h",
++ "include/llvm-c/Support.h",
++ "include/llvm-c/Types.h",
++ "include/llvm/ExecutionEngine/JITSymbol.h",
++ "include/llvm/Support/Extension.def",
++ "include/llvm/Support/VCSRevision.h",
++ ],
++ copts = llvm_c_only_opts,
++ includes = ["include"],
++ linkopts = select({
++ "@bazel_tools//src/conditions:windows": [],
++ "@bazel_tools//src/conditions:freebsd": [
++ "-pthread",
++ "-lexecinfo",
++ "-ldl",
++ "-lm",
++ ],
++ "//conditions:default": [
++ "-pthread",
++ "-ldl",
++ "-lm",
++ ],
++ }),
++ textual_hdrs = glob([
++ "include/llvm/Support/*.def",
++ "lib/Support/*.h",
++ "lib/Support/*.inc",
++ ]),
++ deps = [
++ ":config",
++ ":Demangle",
++ # We unconditionally depend on the custom LLVM terminfo wrapper. This
++ # will be an empty library unless terminfo is enabled, in which case it
++ # will both provide the necessary dependencies and configuration
++ # defines.
++ "@llvm_terminfo//:terminfo",
++ # We unconditionally depend on the custom LLVM zlib wrapper. This will
++ # be an empty library unless zlib is enabled, in which case it will
++ # both provide the necessary dependencies and configuration defines.
++ "@llvm_zlib//:zlib",
++ ],
++)
++
++cc_library(
++ name = "Support",
++ srcs = glob([
+ "lib/Support/*.cpp",
+ "lib/Support/*.h",
+ "lib/Support/*.inc",
+@@ -223,6 +284,7 @@ cc_library(
+ "include/llvm/Support/*.def",
+ ]),
+ deps = [
++ ":Support-c",
+ ":config",
+ ":Demangle",
+ # We unconditionally depend on the custom LLVM terminfo wrapper. This
+diff --git a/utils/bazel/llvm-project-overlay/llvm/cc_plugin_library.bzl b/utils/bazel/llvm-project-overlay/llvm/cc_plugin_library.bzl
+index 2ebd39c630dc..e45bd8a1ce92 100644
+--- a/utils/bazel/llvm-project-overlay/llvm/cc_plugin_library.bzl
++++ b/utils/bazel/llvm-project-overlay/llvm/cc_plugin_library.bzl
+@@ -16,6 +16,7 @@ configure generic aspects of all generated rules such as `testonly`. Lastly,
+ """
+
+ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_import", "cc_library")
++load(":config.bzl", "llvm_stdcxx_copts")
+
+ def cc_plugin_library(name, srcs, hdrs, include_prefix = None, strip_include_prefix = None, alwayslink = False, features = [], tags = [], testonly = False, **kwargs):
+ # Neither the name of the plugin binary nor tags on whether it is built are
+@@ -29,6 +30,7 @@ def cc_plugin_library(name, srcs, hdrs, include_prefix = None, strip_include_pre
+ dylib_name = name + ".dylib"
+ interface_output_name = name + "_interface_output"
+ import_name = name + "_import"
++ copts = kwargs.pop("copts", [])
+ for impl_name in [dll_name, dylib_name, so_name]:
+ cc_binary(
+ name = impl_name,
+@@ -38,6 +40,7 @@ def cc_plugin_library(name, srcs, hdrs, include_prefix = None, strip_include_pre
+ features = features,
+ tags = ["manual"] + tags,
+ testonly = testonly,
++ copts = copts + llvm_stdcxx_copts,
+ **kwargs
+ )
+ native.filegroup(
+diff --git a/utils/bazel/llvm-project-overlay/llvm/config.bzl b/utils/bazel/llvm-project-overlay/llvm/config.bzl
+index 2046b2645362..736844bfc2d0 100644
+--- a/utils/bazel/llvm-project-overlay/llvm/config.bzl
++++ b/utils/bazel/llvm-project-overlay/llvm/config.bzl
+@@ -97,3 +97,8 @@ llvm_config_defines = os_defines + select({
+ "__STDC_CONSTANT_MACROS",
+ "__STDC_FORMAT_MACROS",
+ ]
++
++llvm_stdcxx_copts = select({
++ "@platforms//os:windows": ["/std:c++17"],
++ "//conditions:default": ["-std=c++17"],
++})
+diff --git a/utils/bazel/llvm-project-overlay/llvm/tblgen.bzl b/utils/bazel/llvm-project-overlay/llvm/tblgen.bzl
+index d43390918e39..e0482a6fd4fa 100644
+--- a/utils/bazel/llvm-project-overlay/llvm/tblgen.bzl
++++ b/utils/bazel/llvm-project-overlay/llvm/tblgen.bzl
+@@ -12,6 +12,8 @@ TODO(chandlerc): Currently this expresses include-based dependencies as
+ correctly understood by the build system.
+ """
+
++load(":config.bzl", "llvm_stdcxx_copts")
++
+ def gentbl(
+ name,
+ tblgen,
+@@ -77,5 +79,6 @@ def gentbl(
+ # distinction between these two.
+ hdrs = [f for (_, f) in tbl_outs],
+ features = ["-parse_headers", "-header_modules"],
++ copts = llvm_stdcxx_copts,
+ **kwargs
+ )
diff --git a/bindgen/3rdparty/patches/llvm-project.incompatible_disallow_empty_glob.patch b/bindgen/3rdparty/patches/llvm-project.incompatible_disallow_empty_glob.patch
new file mode 100644
index 0000000..001affa
--- /dev/null
+++ b/bindgen/3rdparty/patches/llvm-project.incompatible_disallow_empty_glob.patch
@@ -0,0 +1,2191 @@
+diff --git a/utils/bazel/llvm-project-overlay/clang/BUILD.bazel b/utils/bazel/llvm-project-overlay/clang/BUILD.bazel
+index 0c1abe607b58..a382a3bc3d69 100644
+--- a/utils/bazel/llvm-project-overlay/clang/BUILD.bazel
++++ b/utils/bazel/llvm-project-overlay/clang/BUILD.bazel
+@@ -26,7 +26,7 @@ cc_binary(
+ srcs = glob([
+ "utils/TableGen/*.cpp",
+ "utils/TableGen/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = [
+ "$(STACK_FRAME_UNLIMITED)",
+ ] + llvm_stdcxx_copts,
+@@ -68,7 +68,7 @@ gentbl(
+ ],
+ tblgen = ":clang-tblgen",
+ td_file = "include/clang/Basic/Diagnostic.td",
+- td_srcs = glob(["include/clang/Basic/*.td"]),
++ td_srcs = glob(["include/clang/Basic/*.td"], allow_empty = True),
+ )
+
+ gentbl(
+@@ -333,11 +333,11 @@ gentbl(
+ # Table definition files can be used for documentation:
+ filegroup(
+ name = "all_table_defs",
+- srcs = glob(["include/**/*.td"]),
++ srcs = glob(["include/**/*.td"], allow_empty = True),
+ )
+
+ exports_files(
+- glob(["include/**/*.td"]),
++ glob(["include/**/*.td"], allow_empty = True),
+ )
+
+ genrule(
+@@ -384,7 +384,7 @@ cc_library(
+ name = "basic_internal_headers",
+ hdrs = glob([
+ "lib/Basic/*.h",
+- ]),
++ ], allow_empty = True),
+ features = ["-header_modules"],
+ strip_include_prefix = "lib/Basic",
+ )
+@@ -400,10 +400,10 @@ cc_library(
+ "lib/Basic/*.h",
+ "lib/Basic/Targets/*.cpp",
+ "lib/Basic/Targets/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/clang/Basic/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = [
+ "-DHAVE_VCS_VERSION_INC",
+ "$(STACK_FRAME_UNLIMITED)",
+@@ -435,7 +435,7 @@ cc_library(
+ "include/clang/Basic/DiagnosticIndexName.inc",
+ ] + glob([
+ "include/clang/Basic/*.def",
+- ]),
++ ], allow_empty = True),
+ deps = [
+ ":basic_arm_cde_gen",
+ ":basic_arm_fp16_inc_gen",
+@@ -468,10 +468,10 @@ cc_library(
+ srcs = glob([
+ "lib/Lex/*.cpp",
+ "lib/Lex/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/clang/Lex/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+@@ -694,13 +694,13 @@ cc_library(
+ "lib/AST/*.h",
+ "lib/AST/Interp/*.cpp",
+ "lib/AST/Interp/*.h",
+- ]) + [
++ ], allow_empty = True) + [
+ "lib/AST/AttrDocTable.inc",
+ "lib/AST/Interp/Opcodes.inc",
+ ],
+ hdrs = glob([
+ "include/clang/AST/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = [
+ # FIXME: This is necessary to allow "file relative" include paths from
+ # non-generated `srcs` to find generated `srcs` above. Bazel should
+@@ -731,7 +731,7 @@ cc_library(
+ "include/clang/AST/StmtNodes.inc",
+ ] + glob([
+ "include/clang/AST/*.def",
+- ]),
++ ], allow_empty = True),
+ deps = [
+ ":ast_attr_gen",
+ ":ast_comment_command_info_gen",
+@@ -760,7 +760,7 @@ cc_library(
+ srcs = glob([
+ "lib/Index/*.cpp",
+ "lib/Index/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/clang/Index/*.h",
+ "include/clang-c/*.h",
+@@ -785,15 +785,15 @@ cc_library(
+ srcs = glob([
+ "lib/Analysis/*.cpp",
+ "lib/Analysis/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/clang/Analysis/**/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ textual_hdrs = glob([
+ "include/clang/Analysis/**/*.def",
+- ]),
++ ], allow_empty = True),
+ deps = [
+ ":ast",
+ ":ast_matchers",
+@@ -843,7 +843,7 @@ cc_library(
+ srcs = glob([
+ "lib/Sema/*.cpp",
+ "lib/Sema/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/clang/Sema/*.h",
+ "include/clang-c/*.h",
+@@ -910,11 +910,11 @@ cc_library(
+ ] + glob([
+ "lib/Parse/*.cpp",
+ "lib/Parse/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = [
+ "include/clang/Parse/AttrParserStringSwitches.inc",
+ "include/clang/Parse/AttrSubMatchRulesParserStringSwitches.inc",
+- ] + glob(["include/clang/Parse/*.h"]),
++ ] + glob(["include/clang/Parse/*.h"], allow_empty = True),
+ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+@@ -935,8 +935,8 @@ cc_library(
+ srcs = glob([
+ "lib/ASTMatchers/*.cpp",
+ "lib/ASTMatchers/*.h",
+- ]),
+- hdrs = glob(["include/clang/ASTMatchers/*.h"]),
++ ], allow_empty = True),
++ hdrs = glob(["include/clang/ASTMatchers/*.h"], allow_empty = True),
+ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+@@ -952,8 +952,8 @@ cc_library(
+ srcs = glob([
+ "lib/ASTMatchers/Dynamic/*.cpp",
+ "lib/ASTMatchers/Dynamic/*.h",
+- ]),
+- hdrs = glob(["include/clang/ASTMatchers/Dynamic/*.h"]),
++ ], allow_empty = True),
++ hdrs = glob(["include/clang/ASTMatchers/Dynamic/*.h"], allow_empty = True),
+ copts = ["$(STACK_FRAME_UNLIMITED)"] + llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+@@ -970,8 +970,8 @@ cc_library(
+ srcs = glob([
+ "lib/Rewrite/*.cpp",
+ "lib/Rewrite/*.h",
+- ]),
+- hdrs = glob(["include/clang/Rewrite/Core/*.h"]),
++ ], allow_empty = True),
++ hdrs = glob(["include/clang/Rewrite/Core/*.h"], allow_empty = True),
+ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+@@ -987,8 +987,8 @@ cc_library(
+ name = "testing",
+ srcs = glob([
+ "lib/Testing/*.cpp",
+- ]),
+- hdrs = glob(["include/clang/Testing/*.h"]),
++ ], allow_empty = True),
++ hdrs = glob(["include/clang/Testing/*.h"], allow_empty = True),
+ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+@@ -1002,8 +1002,8 @@ cc_library(
+ srcs = glob([
+ "lib/Tooling/Core/*.cpp",
+ "lib/Tooling/Core/*.h",
+- ]),
+- hdrs = glob(["include/clang/Tooling/Core/*.h"]),
++ ], allow_empty = True),
++ hdrs = glob(["include/clang/Tooling/Core/*.h"], allow_empty = True),
+ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+@@ -1026,7 +1026,7 @@ cc_library(
+ ),
+ hdrs = glob([
+ "include/clang/Tooling/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+@@ -1048,10 +1048,10 @@ cc_library(
+ name = "tooling_inclusions",
+ srcs = glob([
+ "lib/Tooling/Inclusions/**/*.cpp",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/clang/Tooling/Inclusions/**/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_stdcxx_copts,
+ deps = [
+ ":basic",
+@@ -1067,11 +1067,11 @@ cc_library(
+ srcs = glob([
+ "lib/Tooling/Refactoring/**/*.cpp",
+ "lib/Tooling/Refactoring/**/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/clang/Tooling/Refactoring/**/*.h",
+ "include/clang/Tooling/Refactoring/**/*.def",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_stdcxx_copts,
+ deps = [
+ ":ast",
+@@ -1104,8 +1104,8 @@ gentbl(
+
+ cc_library(
+ name = "tooling_syntax",
+- srcs = glob(["lib/Tooling/Syntax/**/*.cpp"]),
+- hdrs = glob(["include/clang/Tooling/Syntax/**/*.h"]),
++ srcs = glob(["lib/Tooling/Syntax/**/*.cpp"], allow_empty = True),
++ hdrs = glob(["include/clang/Tooling/Syntax/**/*.h"], allow_empty = True),
+ copts = llvm_stdcxx_copts,
+ deps = [
+ ":ast",
+@@ -1119,8 +1119,8 @@ cc_library(
+
+ cc_library(
+ name = "tooling_dependency_scanning",
+- srcs = glob(["lib/Tooling/DependencyScanning/**/*.cpp"]),
+- hdrs = glob(["include/clang/Tooling/DependencyScanning/**/*.h"]),
++ srcs = glob(["lib/Tooling/DependencyScanning/**/*.cpp"], allow_empty = True),
++ hdrs = glob(["include/clang/Tooling/DependencyScanning/**/*.h"], allow_empty = True),
+ copts = llvm_stdcxx_copts,
+ deps = [
+ ":basic",
+@@ -1135,8 +1135,8 @@ cc_library(
+
+ cc_library(
+ name = "transformer",
+- srcs = glob(["lib/Tooling/Transformer/**/*.cpp"]),
+- hdrs = glob(["include/clang/Tooling/Transformer/**/*.h"]),
++ srcs = glob(["lib/Tooling/Transformer/**/*.cpp"], allow_empty = True),
++ hdrs = glob(["include/clang/Tooling/Transformer/**/*.h"], allow_empty = True),
+ copts = llvm_stdcxx_copts,
+ deps = [
+ ":ast",
+@@ -1151,8 +1151,8 @@ cc_library(
+
+ cc_library(
+ name = "ast-diff",
+- srcs = glob(["lib/Tooling/ASTDiff/*.cpp"]),
+- hdrs = glob(["include/clang/Tooling/ASTDiff/*.h"]),
++ srcs = glob(["lib/Tooling/ASTDiff/*.cpp"], allow_empty = True),
++ hdrs = glob(["include/clang/Tooling/ASTDiff/*.h"], allow_empty = True),
+ copts = llvm_stdcxx_copts,
+ deps = [
+ ":ast",
+@@ -1164,8 +1164,8 @@ cc_library(
+
+ cc_library(
+ name = "crosstu",
+- srcs = glob(["lib/CrossTU/*.cpp"]),
+- hdrs = glob(["include/clang/CrossTU/*.h"]),
++ srcs = glob(["lib/CrossTU/*.cpp"], allow_empty = True),
++ hdrs = glob(["include/clang/CrossTU/*.h"], allow_empty = True),
+ copts = llvm_stdcxx_copts,
+ deps = [
+ ":ast",
+@@ -1184,13 +1184,13 @@ cc_library(
+ "lib/Format/*.cpp",
+ "lib/Format/*.h",
+ ],
+- ),
++ allow_empty = True),
+ hdrs = [
+ "lib/Format/FormatTokenLexer.h",
+ "lib/Format/Macros.h",
+ ] + glob([
+ "include/clang/Format/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+@@ -1204,8 +1204,8 @@ cc_library(
+
+ cc_library(
+ name = "edit",
+- srcs = glob(["lib/Edit/*.cpp"]),
+- hdrs = glob(["include/clang/Edit/*.h"]),
++ srcs = glob(["lib/Edit/*.cpp"], allow_empty = True),
++ hdrs = glob(["include/clang/Edit/*.h"], allow_empty = True),
+ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+@@ -1237,15 +1237,15 @@ cc_library(
+ srcs = glob([
+ "lib/StaticAnalyzer/Core/**/*.cpp",
+ "lib/StaticAnalyzer/Core/**/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/clang/StaticAnalyzer/Core/**/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ textual_hdrs = glob([
+ "include/clang/StaticAnalyzer/Core/**/*.def",
+- ]),
++ ], allow_empty = True),
+ deps = [
+ ":analysis",
+ ":ast",
+@@ -1282,12 +1282,12 @@ cc_library(
+ srcs = glob([
+ "lib/StaticAnalyzer/Checkers/**/*.cpp",
+ "lib/StaticAnalyzer/Checkers/**/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = [
+ "include/clang/StaticAnalyzer/Checkers/Checkers.inc",
+ ] + glob([
+ "include/clang/StaticAnalyzer/Checkers/**/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = ["$(STACK_FRAME_UNLIMITED)"] + llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+@@ -1332,10 +1332,10 @@ cc_library(
+ exclude = [
+ "lib/Driver/ToolChains/MSVCSetupApi.h",
+ ],
+- ),
++ allow_empty = True),
+ hdrs = glob([
+ "include/clang/Driver/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = ["$(STACK_FRAME_UNLIMITED)"] + llvm_stdcxx_copts,
+ includes = [
+ "include",
+@@ -1349,7 +1349,7 @@ cc_library(
+ }),
+ textual_hdrs = glob([
+ "include/clang/Driver/*.def",
+- ]),
++ ], allow_empty = True),
+ deps = [
+ ":ast",
+ ":basic",
+@@ -1466,7 +1466,7 @@ gentbl(
+ # We generate the set of builtin headers under a special subdirectory in the
+ # 'bin' section of the bazel output so that they can be used as data
+ # dependencies. It requires listing explicitly all the generated inputs here.
+-builtin_headers = glob(["lib/Headers/**/*.h"]) + [
++builtin_headers = glob(["lib/Headers/**/*.h"], allow_empty = True) + [
+ "lib/Headers/arm_cde.h",
+ "lib/Headers/arm_fp16.h",
+ "lib/Headers/arm_mve.h",
+@@ -1495,16 +1495,16 @@ cc_library(
+ srcs = glob([
+ "lib/Frontend/*.cpp",
+ "lib/Frontend/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/clang/Frontend/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = ["$(STACK_FRAME_UNLIMITED)"] + llvm_stdcxx_copts,
+ data = [":builtin_headers_gen"],
+ includes = ["include"],
+ textual_hdrs = glob([
+ "include/clang/Frontend/*.def",
+- ]),
++ ], allow_empty = True),
+ deps = [
+ ":ast",
+ ":basic",
+@@ -1537,8 +1537,8 @@ cc_library(
+ srcs = glob([
+ "lib/Frontend/Rewrite/*.cpp",
+ "lib/Frontend/Rewrite/*.h",
+- ]),
+- hdrs = glob(["include/clang/Rewrite/Frontend/*.h"]),
++ ], allow_empty = True),
++ hdrs = glob(["include/clang/Rewrite/Frontend/*.h"], allow_empty = True),
+ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+@@ -1560,8 +1560,8 @@ cc_library(
+ srcs = glob([
+ "lib/Interpreter/*.cpp",
+ "lib/Interpreter/*.h",
+- ]),
+- hdrs = glob(["include/clang/Interpreter/*.h"]),
++ ], allow_empty = True),
++ hdrs = glob(["include/clang/Interpreter/*.h"], allow_empty = True),
+ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+@@ -1593,8 +1593,8 @@ cc_library(
+ srcs = glob([
+ "lib/CodeGen/*.cpp",
+ "lib/CodeGen/*.h",
+- ]),
+- hdrs = glob(["include/clang/CodeGen/*.h"]),
++ ], allow_empty = True),
++ hdrs = glob(["include/clang/CodeGen/*.h"], allow_empty = True),
+ copts = ["$(STACK_FRAME_UNLIMITED)"] + llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+@@ -1644,8 +1644,8 @@ cc_library(
+ srcs = glob([
+ "lib/StaticAnalyzer/Frontend/**/*.cpp",
+ "lib/StaticAnalyzer/Frontend/**/*.h",
+- ]),
+- hdrs = glob(["include/clang/StaticAnalyzer/Frontend/**/*.h"]),
++ ], allow_empty = True),
++ hdrs = glob(["include/clang/StaticAnalyzer/Frontend/**/*.h"], allow_empty = True),
+ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+@@ -1697,15 +1697,15 @@ cc_library(
+ ] + glob([
+ "lib/Serialization/*.cpp",
+ "lib/Serialization/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/clang/Serialization/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ textual_hdrs = glob([
+ "include/clang/Serialization/*.def",
+- ]),
++ ], allow_empty = True),
+ deps = [
+ ":ast",
+ ":basic",
+@@ -1727,8 +1727,8 @@ cc_library(
+ srcs = glob([
+ "lib/FrontendTool/*.cpp",
+ "lib/FrontendTool/*.h",
+- ]),
+- hdrs = glob(["include/clang/FrontendTool/*.h"]),
++ ], allow_empty = True),
++ hdrs = glob(["include/clang/FrontendTool/*.h"], allow_empty = True),
+ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+@@ -1749,8 +1749,8 @@ cc_library(
+ srcs = glob([
+ "lib/ARCMigrate/*.cpp",
+ "lib/ARCMigrate/*.h",
+- ]),
+- hdrs = glob(["include/clang/ARCMigrate/*.h"]),
++ ], allow_empty = True),
++ hdrs = glob(["include/clang/ARCMigrate/*.h"], allow_empty = True),
+ copts = llvm_stdcxx_copts,
+ includes = ["include"],
+ deps = [
+@@ -1776,7 +1776,7 @@ cc_library(
+ srcs = glob([
+ "tools/libclang/*.cpp",
+ "tools/libclang/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob(["include/clang-c/*.h"]),
+ copts = llvm_stdcxx_copts,
+ defines = ["CINDEX_NO_EXPORTS"],
+@@ -1805,7 +1805,7 @@ cc_plugin_library(
+ srcs = glob([
+ "tools/libclang/*.cpp",
+ "tools/libclang/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob(["include/clang-c/*.h"]),
+ copts = select({
+ "@bazel_tools//src/conditions:windows": ["-D_CINDEX_LIB_"],
+@@ -1914,7 +1914,7 @@ cc_binary(
+ srcs = glob([
+ "tools/clang-import-test/*.cpp",
+ "tools/clang-import-test/*.h",
+- ]),
++ ], allow_empty = True),
+ stamp = 0,
+ deps = [
+ ":ast",
+@@ -1934,7 +1934,7 @@ cc_library(
+ srcs = glob([
+ "tools/driver/*.cpp",
+ "tools/driver/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = [
+ # Disable stack frame size checks in the driver because
+ # clang::ensureStackAddressSpace allocates a large array on the stack.
+@@ -1986,7 +1986,7 @@ cc_binary(
+ srcs = glob([
+ "tools/diagtool/*.cpp",
+ "tools/diagtool/*.h",
+- ]),
++ ], allow_empty = True),
+ stamp = 0,
+ deps = [
+ ":basic",
+diff --git a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
+index 716d7f5d9645..1e3e7a8ff0e7 100644
+--- a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
++++ b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
+@@ -39,7 +39,7 @@ enum_targets_gen(
+ llvm_target_asm_printers = [
+ t
+ for t in llvm_targets
+- if glob(["lib/Target/{}/*AsmPrinter.cpp".format(t)])
++ if glob(["lib/Target/{}/*AsmPrinter.cpp".format(t)], allow_empty = True)
+ ]
+
+ enum_targets_gen(
+@@ -54,7 +54,7 @@ enum_targets_gen(
+ llvm_target_asm_parsers = [
+ t
+ for t in llvm_targets
+- if glob(["lib/Target/{}/AsmParser/CMakeLists.txt".format(t)])
++ if glob(["lib/Target/{}/AsmParser/CMakeLists.txt".format(t)], allow_empty = True)
+ ]
+
+ enum_targets_gen(
+@@ -69,7 +69,7 @@ enum_targets_gen(
+ llvm_target_disassemblers = [
+ t
+ for t in llvm_targets
+- if glob(["lib/Target/{}/Disassembler/CMakeLists.txt".format(t)])
++ if glob(["lib/Target/{}/Disassembler/CMakeLists.txt".format(t)], allow_empty = True)
+ ]
+
+ enum_targets_gen(
+@@ -84,7 +84,7 @@ enum_targets_gen(
+ llvm_target_mcas = [
+ t
+ for t in llvm_targets
+- if glob(["lib/Target/{}/MCA/CMakeLists.txt".format(t)])
++ if glob(["lib/Target/{}/MCA/CMakeLists.txt".format(t)], allow_empty = True)
+ ]
+
+ enum_targets_gen(
+@@ -149,8 +149,8 @@ cc_library(
+ srcs = glob([
+ "lib/Demangle/*.cpp",
+ "lib/Demangle/*.h",
+- ]),
+- hdrs = glob(["include/llvm/Demangle/*.h"]),
++ ], allow_empty = True),
++ hdrs = glob(["include/llvm/Demangle/*.h"], allow_empty = True),
+ copts = llvm_copts,
+ deps = [":config"],
+ )
+@@ -175,11 +175,11 @@ cc_library(
+ name = "Support-c",
+ srcs = glob([
+ "lib/Support/*.c",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/llvm/Support/**/*.h",
+ "include/llvm/ADT/*.h",
+- ]) + [
++ ], allow_empty = True) + [
+ "include/llvm-c/Core.h",
+ "include/llvm-c/DataTypes.h",
+ "include/llvm-c/Deprecated.h",
+@@ -213,7 +213,7 @@ cc_library(
+ "include/llvm/Support/*.def",
+ "lib/Support/*.h",
+ "lib/Support/*.inc",
+- ]),
++ ], allow_empty = True),
+ deps = [
+ ":config",
+ ":Demangle",
+@@ -241,16 +241,16 @@ cc_library(
+ "@bazel_tools//src/conditions:windows": glob([
+ "lib/Support/Windows/*.h",
+ "lib/Support/Windows/*.inc",
+- ]),
++ ], allow_empty = True),
+ "//conditions:default": glob([
+ "lib/Support/Unix/*.h",
+ "lib/Support/Unix/*.inc",
+- ]),
++ ], allow_empty = True),
+ }),
+ hdrs = glob([
+ "include/llvm/Support/**/*.h",
+ "include/llvm/ADT/*.h",
+- ]) + [
++ ], allow_empty = True) + [
+ "include/llvm-c/Core.h",
+ "include/llvm-c/DataTypes.h",
+ "include/llvm-c/Deprecated.h",
+@@ -282,7 +282,7 @@ cc_library(
+ }),
+ textual_hdrs = glob([
+ "include/llvm/Support/*.def",
+- ]),
++ ], allow_empty = True),
+ deps = [
+ ":Support-c",
+ ":config",
+@@ -306,8 +306,8 @@ cc_library(
+ srcs = glob([
+ "lib/FileCheck/*.cpp",
+ "lib/FileCheck/*.h",
+- ]),
+- hdrs = glob(["include/llvm/FileCheck/*.h"]),
++ ], allow_empty = True),
++ hdrs = glob(["include/llvm/FileCheck/*.h"], allow_empty = True),
+ copts = llvm_copts,
+ deps = [":Support"],
+ )
+@@ -317,8 +317,8 @@ cc_library(
+ srcs = glob([
+ "lib/LineEditor/*.cpp",
+ "lib/LineEditor/*.h",
+- ]),
+- hdrs = glob(["include/llvm/LineEditor/*.h"]),
++ ], allow_empty = True),
++ hdrs = glob(["include/llvm/LineEditor/*.h"], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":Support",
+@@ -331,8 +331,8 @@ cc_library(
+ srcs = glob([
+ "lib/Option/*.cpp",
+ "lib/Option/*.h",
+- ]),
+- hdrs = glob(["include/llvm/Option/*.h"]),
++ ], allow_empty = True),
++ hdrs = glob(["include/llvm/Option/*.h"], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":Support",
+@@ -345,8 +345,8 @@ cc_library(
+ srcs = glob([
+ "lib/TableGen/*.cpp",
+ "lib/TableGen/*.h",
+- ]),
+- hdrs = glob(["include/llvm/TableGen/*.h"]),
++ ], allow_empty = True),
++ hdrs = glob(["include/llvm/TableGen/*.h"], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":Support",
+@@ -365,7 +365,7 @@ cc_library(
+ exclude = [
+ "include/llvm/LinkAllPasses.h",
+ ],
+- ) + [
++ allow_empty = True) + [
+ "include/llvm/IR/Value.def",
+ "include/llvm-c/Comdat.h",
+ "include/llvm-c/DebugInfo.h",
+@@ -379,16 +379,16 @@ cc_library(
+ "lib/BinaryFormat/*.cpp",
+ "lib/BinaryFormat/*.def",
+ "lib/BinaryFormat/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/llvm/BinaryFormat/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ includes = ["include"],
+ textual_hdrs = glob([
+ "include/llvm/BinaryFormat/*.def",
+ "include/llvm/BinaryFormat/ELFRelocs/*.def",
+- ]),
++ ], allow_empty = True),
+ deps = [
+ ":Support",
+ ],
+@@ -396,7 +396,7 @@ cc_library(
+
+ cc_library(
+ name = "DebugInfo",
+- hdrs = glob(["include/llvm/DebugInfo/*.h"]),
++ hdrs = glob(["include/llvm/DebugInfo/*.h"], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":Object",
+@@ -409,8 +409,8 @@ cc_library(
+ srcs = glob([
+ "lib/DebugInfo/MSF/*.cpp",
+ "lib/DebugInfo/MSF/*.h",
+- ]),
+- hdrs = glob(["include/llvm/DebugInfo/MSF/*.h"]),
++ ], allow_empty = True),
++ hdrs = glob(["include/llvm/DebugInfo/MSF/*.h"], allow_empty = True),
+ copts = llvm_copts,
+ deps = [":Support"],
+ )
+@@ -420,14 +420,14 @@ cc_library(
+ srcs = glob([
+ "lib/DebugInfo/CodeView/*.cpp",
+ "lib/DebugInfo/CodeView/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/llvm/DebugInfo/CodeView/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ textual_hdrs = glob([
+ "include/llvm/DebugInfo/CodeView/*.def",
+- ]),
++ ], allow_empty = True),
+ deps = [
+ ":BinaryFormat",
+ ":DebugInfoMSF",
+@@ -442,11 +442,11 @@ cc_library(
+ "lib/DebugInfo/PDB/*.h",
+ "lib/DebugInfo/PDB/Native/*.cpp",
+ "lib/DebugInfo/PDB/Native/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/llvm/DebugInfo/PDB/*.h",
+ "include/llvm/DebugInfo/PDB/Native/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":BinaryFormat",
+@@ -463,10 +463,10 @@ cc_library(
+ name = "Debuginfod",
+ srcs = glob([
+ "lib/Debuginfod/*.cpp",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/llvm/Debuginfod/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":Support",
+@@ -478,12 +478,12 @@ cc_library(
+ srcs = glob([
+ "lib/MC/*.cpp",
+ "lib/MC/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/llvm/MC/*.h",
+ "include/llvm/MC/*.def",
+ "include/llvm/MC/*.inc",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":BinaryFormat",
+@@ -499,8 +499,8 @@ cc_library(
+ srcs = glob([
+ "lib/DebugInfo/DWARF/*.cpp",
+ "lib/DebugInfo/DWARF/*.h",
+- ]),
+- hdrs = glob(["include/llvm/DebugInfo/DWARF/*.h"]),
++ ], allow_empty = True),
++ hdrs = glob(["include/llvm/DebugInfo/DWARF/*.h"], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":BinaryFormat",
+@@ -516,8 +516,8 @@ cc_library(
+ srcs = glob([
+ "lib/DebugInfo/Symbolize/*.cpp",
+ "lib/DebugInfo/Symbolize/*.h",
+- ]),
+- hdrs = glob(["include/llvm/DebugInfo/Symbolize/*.h"]),
++ ], allow_empty = True),
++ hdrs = glob(["include/llvm/DebugInfo/Symbolize/*.h"], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":BinaryFormat",
+@@ -553,7 +553,7 @@ cc_library(
+ hdrs = glob([
+ "utils/TableGen/*.h",
+ "utils/TableGen/GlobalISel/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ features = ["-header_modules"],
+ strip_include_prefix = "utils/TableGen",
+@@ -581,7 +581,7 @@ gentbl(
+ td_srcs = glob([
+ "include/llvm/CodeGen/*.td",
+ "include/llvm/IR/Intrinsics*.td",
+- ]),
++ ], allow_empty = True),
+ )
+
+ gentbl(
+@@ -592,7 +592,7 @@ gentbl(
+ td_srcs = glob([
+ "include/llvm/CodeGen/*.td",
+ "include/llvm/IR/Intrinsics*.td",
+- ]),
++ ], allow_empty = True),
+ )
+
+ # Note that the intrinsics are not currently set up so they can be pruned for
+@@ -672,7 +672,7 @@ llvm_target_intrinsics_list = [
+ td_srcs = glob([
+ "include/llvm/CodeGen/*.td",
+ "include/llvm/IR/*.td",
+- ]),
++ ], allow_empty = True),
+ ),
+ ] for target in llvm_target_intrinsics_list]
+
+@@ -692,7 +692,7 @@ cc_library(
+ srcs = glob([
+ "lib/Bitstream/Reader/*.cpp",
+ "lib/Bitstream/Reader/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = [
+ "include/llvm/Bitstream/BitCodes.h",
+ "include/llvm/Bitstream/BitstreamReader.h",
+@@ -707,7 +707,7 @@ cc_library(
+ name = "BitstreamWriter",
+ srcs = glob([
+ "lib/Bitstream/Writer/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = [
+ "include/llvm/Bitstream/BitCodes.h",
+ "include/llvm/Bitstream/BitstreamWriter.h",
+@@ -726,13 +726,13 @@ cc_library(
+ "lib/Remarks/*.h",
+ ],
+ exclude = ["lib/Remarks/RemarkLinker.cpp"],
+- ),
++ allow_empty = True),
+ hdrs = glob(
+ [
+ "include/llvm/Remarks/*.h",
+ ],
+ exclude = ["include/llvm/Remarks/RemarkLinker.h"],
+- ) + [
++ allow_empty = True) + [
+ "include/llvm-c/Remarks.h",
+ ],
+ copts = llvm_copts,
+@@ -767,7 +767,7 @@ cc_library(
+ srcs = glob([
+ "lib/IR/*.cpp",
+ "lib/IR/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob(
+ [
+ "include/llvm/*.h",
+@@ -776,12 +776,12 @@ cc_library(
+ exclude = [
+ "include/llvm/LinkAllPasses.h",
+ ],
+- ) + [
++ allow_empty = True) + [
+ "include/llvm-c/Comdat.h",
+ "include/llvm-c/DebugInfo.h",
+ ] + [":llvm_intrinsics_headers"],
+ copts = llvm_copts,
+- textual_hdrs = glob(["include/llvm/IR/*.def"]),
++ textual_hdrs = glob(["include/llvm/IR/*.def"], allow_empty = True),
+ deps = [
+ ":BinaryFormat",
+ ":Remarks",
+@@ -798,7 +798,7 @@ cc_library(
+ srcs = glob([
+ "lib/Bitcode/Reader/*.cpp",
+ "lib/Bitcode/Reader/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = [
+ "include/llvm-c/BitReader.h",
+ "include/llvm/Bitcode/BitcodeAnalyzer.h",
+@@ -820,8 +820,8 @@ cc_library(
+ srcs = glob([
+ "lib/MC/MCParser/*.cpp",
+ "lib/MC/MCParser/*.h",
+- ]),
+- hdrs = glob(["include/llvm/MC/MCParser/*.h"]),
++ ], allow_empty = True),
++ hdrs = glob(["include/llvm/MC/MCParser/*.h"], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":BinaryFormat",
+@@ -835,12 +835,12 @@ cc_library(
+ name = "TextAPI",
+ srcs = glob([
+ "lib/TextAPI/**/*.cpp",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/llvm/TextAPI/**/*.h",
+ "include/llvm/TextAPI/**/*.def",
+ "lib/TextAPI/**/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":BinaryFormat",
+@@ -853,10 +853,10 @@ cc_library(
+ srcs = glob([
+ "lib/Object/*.cpp",
+ "lib/Object/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/llvm/Object/*.h",
+- ]) + [
++ ], allow_empty = True) + [
+ "include/llvm-c/Object.h",
+ ],
+ copts = llvm_copts,
+@@ -877,8 +877,8 @@ cc_library(
+ srcs = glob([
+ "lib/ObjectYAML/*.cpp",
+ "lib/ObjectYAML/*.h",
+- ]),
+- hdrs = glob(["include/llvm/ObjectYAML/*.h"]),
++ ], allow_empty = True),
++ hdrs = glob(["include/llvm/ObjectYAML/*.h"], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":BinaryFormat",
+@@ -893,11 +893,11 @@ cc_library(
+ srcs = glob([
+ "lib/ProfileData/*.cpp",
+ "lib/ProfileData/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/llvm/ProfileData/*.h",
+ "include/llvm/ProfileData/*.inc",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":Core",
+@@ -912,8 +912,8 @@ cc_library(
+ srcs = glob([
+ "lib/ProfileData/Coverage/*.cpp",
+ "lib/ProfileData/Coverage/*.h",
+- ]),
+- hdrs = glob(["include/llvm/ProfileData/Coverage/*.h"]),
++ ], allow_empty = True),
++ hdrs = glob(["include/llvm/ProfileData/Coverage/*.h"], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":Object",
+@@ -930,20 +930,20 @@ cc_library(
+ "lib/Analysis/*.h",
+ "lib/Analysis/*.def",
+ ],
+- ),
++ allow_empty = True),
+ hdrs = glob(
+ [
+ "include/llvm/Analysis/*.h",
+ "include/llvm/Analysis/Utils/*.h",
+ ],
+- ) + [
++ allow_empty = True) + [
+ "include/llvm-c/Analysis.h",
+ "include/llvm-c/Initialization.h",
+ ],
+ copts = llvm_copts,
+ textual_hdrs = glob([
+ "include/llvm/Analysis/*.def",
+- ]),
++ ], allow_empty = True),
+ deps = [
+ ":BinaryFormat",
+ ":Core",
+@@ -959,7 +959,7 @@ cc_library(
+ srcs = glob([
+ "lib/Bitcode/Writer/*.cpp",
+ "lib/Bitcode/Writer/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = [
+ "include/llvm-c/BitWriter.h",
+ "include/llvm/Bitcode/BitcodeCommon.h",
+@@ -984,10 +984,10 @@ cc_library(
+ srcs = glob([
+ "lib/Target/*.cpp",
+ "lib/Target/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/llvm/Target/*.h",
+- ]) + [
++ ], allow_empty = True) + [
+ "include/llvm-c/Target.h",
+ "include/llvm-c/TargetMachine.h",
+ ],
+@@ -1007,8 +1007,8 @@ cc_library(
+ srcs = glob([
+ "lib/DWP/*.cpp",
+ "lib/DWP/*.h",
+- ]),
+- hdrs = glob(["include/llvm/DWP/*.h"]),
++ ], allow_empty = True),
++ hdrs = glob(["include/llvm/DWP/*.h"], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":DebugInfoDWARF",
+@@ -1024,8 +1024,8 @@ cc_library(
+ srcs = glob([
+ "lib/Transforms/Utils/*.cpp",
+ "lib/Transforms/Utils/*.h",
+- ]),
+- hdrs = glob(["include/llvm/Transforms/Utils/*.h"]) + [
++ ], allow_empty = True),
++ hdrs = glob(["include/llvm/Transforms/Utils/*.h"], allow_empty = True) + [
+ "include/llvm/Transforms/Utils.h",
+ "include/llvm-c/Transforms/Utils.h",
+ ],
+@@ -1053,7 +1053,7 @@ gentbl(
+ td_srcs = glob([
+ "include/llvm/CodeGen/*.td",
+ "include/llvm/IR/Intrinsics*.td",
+- ]) + [
++ ], allow_empty = True) + [
+ "lib/Target/AMDGPU/InstCombineTables.td",
+ "include/llvm/TableGen/SearchableTable.td",
+ ],
+@@ -1064,8 +1064,8 @@ cc_library(
+ srcs = glob([
+ "lib/Transforms/InstCombine/*.cpp",
+ "lib/Transforms/InstCombine/*.h",
+- ]),
+- hdrs = glob(["include/llvm/Transforms/InstCombine/*.h"]) + [
++ ], allow_empty = True),
++ hdrs = glob(["include/llvm/Transforms/InstCombine/*.h"], allow_empty = True) + [
+ "include/llvm-c/Transforms/InstCombine.h",
+ ],
+ copts = llvm_copts,
+@@ -1085,7 +1085,7 @@ cc_library(
+ srcs = glob([
+ "lib/Transforms/AggressiveInstCombine/*.cpp",
+ "lib/Transforms/AggressiveInstCombine/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = [
+ "include/llvm-c/Transforms/AggressiveInstCombine.h",
+ "include/llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h",
+@@ -1105,8 +1105,8 @@ cc_library(
+ "lib/Transforms/Instrumentation/*.cpp",
+ "lib/Transforms/Instrumentation/*.h",
+ "lib/Transforms/Instrumentation/*.inc",
+- ]),
+- hdrs = glob(["include/llvm/Transforms/Instrumentation/*.h"]) + [
++ ], allow_empty = True),
++ hdrs = glob(["include/llvm/Transforms/Instrumentation/*.h"], allow_empty = True) + [
+ "include/llvm/Transforms/Instrumentation.h",
+ ],
+ copts = llvm_copts,
+@@ -1127,7 +1127,7 @@ cc_library(
+ srcs = glob([
+ "lib/Transforms/ObjCARC/*.cpp",
+ "lib/Transforms/ObjCARC/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = ["include/llvm/Transforms/ObjCARC.h"],
+ copts = llvm_copts,
+ deps = [
+@@ -1145,8 +1145,8 @@ cc_library(
+ srcs = glob([
+ "lib/Transforms/Scalar/*.cpp",
+ "lib/Transforms/Scalar/*.h",
+- ]),
+- hdrs = glob(["include/llvm/Transforms/Scalar/*.h"]) + [
++ ], allow_empty = True),
++ hdrs = glob(["include/llvm/Transforms/Scalar/*.h"], allow_empty = True) + [
+ "include/llvm-c/Transforms/Scalar.h",
+ "include/llvm/Transforms/Scalar.h",
+ ],
+@@ -1169,10 +1169,10 @@ cc_library(
+ srcs = glob([
+ "lib/Transforms/Vectorize/*.cpp",
+ "lib/Transforms/Vectorize/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/llvm/Transforms/Vectorize/*.h",
+- ]) + [
++ ], allow_empty = True) + [
+ "include/llvm-c/Transforms/Vectorize.h",
+ "include/llvm/Transforms/Vectorize.h",
+ ],
+@@ -1192,7 +1192,7 @@ filegroup(
+ srcs = glob([
+ "include/llvm/Frontend/OpenMP/*.td",
+ "include/llvm/Frontend/Directive/*.td",
+- ]),
++ ], allow_empty = True),
+ )
+
+ gentbl(
+@@ -1221,19 +1221,19 @@ cc_library(
+ name = "FrontendOpenMP",
+ srcs = glob([
+ "lib/Frontend/OpenMP/*.cpp",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/llvm/Frontend/OpenMP/*.h",
+ "include/llvm/Frontend/OpenMP/OMP/*.h",
+ "include/llvm/Frontend/*.h",
+- ]) + [
++ ], allow_empty = True) + [
+ "include/llvm/Frontend/OpenMP/OMP.h.inc",
+ "include/llvm/Frontend/OpenMP/OMP.inc",
+ ],
+ copts = llvm_copts,
+ textual_hdrs = glob([
+ "include/llvm/Frontend/OpenMP/*.def",
+- ]),
++ ], allow_empty = True),
+ deps = [
+ ":Analysis",
+ ":Core",
+@@ -1248,7 +1248,7 @@ filegroup(
+ srcs = glob([
+ "include/llvm/Frontend/OpenACC/*.td",
+ "include/llvm/Frontend/Directive/*.td",
+- ]),
++ ], allow_empty = True),
+ )
+
+ gentbl(
+@@ -1277,12 +1277,12 @@ cc_library(
+ name = "FrontendOpenACC",
+ srcs = glob([
+ "lib/Frontend/OpenACC/*.cpp",
+- ]) + [
++ ], allow_empty = True) + [
+ "include/llvm/Frontend/OpenACC/ACC.inc",
+ ],
+ hdrs = glob([
+ "include/llvm/Frontend/OpenACC/*.h",
+- ]) + ["include/llvm/Frontend/OpenACC/ACC.h.inc"],
++ ], allow_empty = True) + ["include/llvm/Frontend/OpenACC/ACC.h.inc"],
+ copts = llvm_copts,
+ deps = [
+ ":Analysis",
+@@ -1297,8 +1297,8 @@ cc_library(
+ srcs = glob([
+ "lib/AsmParser/*.cpp",
+ "lib/AsmParser/*.h",
+- ]),
+- hdrs = glob(["include/llvm/AsmParser/*.h"]),
++ ], allow_empty = True),
++ hdrs = glob(["include/llvm/AsmParser/*.h"], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":BinaryFormat",
+@@ -1312,10 +1312,10 @@ cc_library(
+ srcs = glob([
+ "lib/IRReader/*.cpp",
+ "lib/IRReader/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/llvm/IRReader/*.h",
+- ]) + [
++ ], allow_empty = True) + [
+ "include/llvm-c/IRReader.h",
+ ],
+ copts = llvm_copts,
+@@ -1333,10 +1333,10 @@ cc_library(
+ srcs = glob([
+ "lib/Linker/*.cpp",
+ "lib/Linker/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/llvm/Linker/*.h",
+- ]) + [
++ ], allow_empty = True) + [
+ "include/llvm-c/Linker.h",
+ ],
+ copts = llvm_copts,
+@@ -1353,10 +1353,10 @@ cc_library(
+ srcs = glob([
+ "lib/Transforms/IPO/*.cpp",
+ "lib/Transforms/IPO/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/llvm/Transforms/IPO/*.h",
+- ]) + [
++ ], allow_empty = True) + [
+ "include/llvm-c/Transforms/IPO.h",
+ "include/llvm-c/Transforms/PassManagerBuilder.h",
+ "include/llvm/Transforms/IPO.h",
+@@ -1391,7 +1391,7 @@ cc_library(
+ srcs = glob([
+ "lib/Transforms/CFGuard/*.cpp",
+ "lib/Transforms/CFGuard/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = ["include/llvm/Transforms/CFGuard.h"],
+ copts = llvm_copts,
+ deps = [
+@@ -1405,7 +1405,7 @@ cc_library(
+ srcs = glob([
+ "lib/Transforms/Coroutines/*.cpp",
+ "lib/Transforms/Coroutines/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = [
+ "include/llvm-c/Transforms/Coroutines.h",
+ "include/llvm/Transforms/Coroutines.h",
+@@ -1445,7 +1445,7 @@ cc_library(
+ cc_library(
+ name = "asm_printer_defs",
+ copts = llvm_copts,
+- textual_hdrs = glob(["lib/CodeGen/AsmPrinter/*.def"]),
++ textual_hdrs = glob(["lib/CodeGen/AsmPrinter/*.def"], allow_empty = True),
+ )
+
+ cc_library(
+@@ -1457,19 +1457,19 @@ cc_library(
+ "lib/CodeGen/SelectionDAG/*.cpp",
+ "lib/CodeGen/SelectionDAG/*.h",
+ ],
+- ),
++ allow_empty = True),
+ hdrs = [
+ "include/llvm/LinkAllPasses.h",
+ ] + glob(
+ [
+ "include/llvm/CodeGen/**/*.h",
+ ],
+- ),
++ allow_empty = True),
+ copts = llvm_copts,
+ textual_hdrs = glob([
+ "include/llvm/CodeGen/**/*.def",
+ "include/llvm/CodeGen/**/*.inc",
+- ]),
++ ], allow_empty = True),
+ deps = [
+ ":Analysis",
+ ":AsmParser",
+@@ -1498,10 +1498,10 @@ cc_library(
+ srcs = glob([
+ "lib/MC/MCDisassembler/*.cpp",
+ "lib/MC/MCDisassembler/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/llvm/MC/MCDisassembler/*.h",
+- ]) + [
++ ], allow_empty = True) + [
+ "include/llvm-c/Disassembler.h",
+ ],
+ copts = llvm_copts,
+@@ -1818,7 +1818,7 @@ filegroup(
+ "include/llvm/TableGen/*.td",
+ "include/llvm/Target/*.td",
+ "include/llvm/Target/GlobalISel/*.td",
+- ]),
++ ], allow_empty = True),
+ )
+
+ gentbl(
+@@ -1836,7 +1836,7 @@ gentbl(
+ ":common_target_td_sources",
+ ] + glob([
+ "lib/Target/AMDGPU/*.td",
+- ]),
++ ], allow_empty = True),
+ )
+
+ gentbl(
+@@ -1858,7 +1858,7 @@ gentbl(
+ ":common_target_td_sources",
+ ] + glob([
+ "lib/Target/AMDGPU/*.td",
+- ]),
++ ], allow_empty = True),
+ )
+
+ [[
+@@ -1880,7 +1880,7 @@ gentbl(
+ ] + glob([
+ "lib/Target/" + target["name"] + "/*.td",
+ "lib/Target/" + target["name"] + "/GISel/*.td",
+- ]),
++ ], allow_empty = True),
+ deps = target.get("tbl_deps", []),
+ )],
+ [cc_library(
+@@ -1914,7 +1914,7 @@ gentbl(
+ # library. This mixture is likely incompatible with header modules.
+ "lib/Target/" + target["name"] + "/MCTargetDesc/*.h",
+ "lib/Target/" + target["name"] + "/Utils/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "lib/Target/" + target["name"] + "/MCTargetDesc/*.h",
+ "lib/Target/" + target["name"] + "/Utils/*.h",
+@@ -1938,7 +1938,7 @@ gentbl(
+ # distinction between these two.
+ "lib/Target/" + target["name"] + "/*.def",
+ "lib/Target/" + target["name"] + "/*.inc",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ features = [
+ "-parse_headers",
+@@ -1967,14 +1967,14 @@ gentbl(
+ "lib/Target/" + target["name"] + "/GISel/*.h",
+ "lib/Target/" + target["name"] + "/*.cpp",
+ "lib/Target/" + target["name"] + "/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = ["lib/Target/" + target["name"] + "/" + target["short_name"] + ".h"],
+ copts = llvm_copts,
+ strip_include_prefix = "lib/Target/" + target["name"],
+ textual_hdrs = glob([
+ "lib/Target/" + target["name"] + "/*.def",
+ "lib/Target/" + target["name"] + "/*.inc",
+- ]),
++ ], allow_empty = True),
+ deps = [
+ ":Analysis",
+ ":BinaryFormat",
+@@ -2001,7 +2001,7 @@ gentbl(
+ srcs = glob([
+ "lib/Target/" + target["name"] + "/AsmParser/*.cpp",
+ "lib/Target/" + target["name"] + "/AsmParser/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":BinaryFormat",
+@@ -2031,7 +2031,7 @@ gentbl(
+ # distinction between these two.
+ hdrs = glob([
+ "lib/Target/" + target["name"] + "/Disassembler/*.h",
+- ]),
++ ], allow_empty = True),
+ features = [
+ "-parse_headers",
+ "-header_modules",
+@@ -2044,7 +2044,7 @@ gentbl(
+ "lib/Target/" + target["name"] + "/Disassembler/*.cpp",
+ "lib/Target/" + target["name"] + "/Disassembler/*.c",
+ "lib/Target/" + target["name"] + "/Disassembler/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":CodeGen",
+@@ -2065,7 +2065,7 @@ gentbl(
+ "lib/Target/" + target["name"] + "/MCA/*.cpp",
+ "lib/Target/" + target["name"] + "/MCA/*.c",
+ "lib/Target/" + target["name"] + "/MCA/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":MC",
+@@ -2126,10 +2126,10 @@ cc_library(
+ srcs = glob([
+ "lib/Analysis/ML/*.cpp",
+ "lib/Analysis/ML/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/llvm/Analysis/ML/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":Analysis",
+@@ -2143,8 +2143,8 @@ cc_library(
+ srcs = glob([
+ "lib/Passes/*.cpp",
+ "lib/Passes/*.h",
+- ]),
+- hdrs = glob(["include/llvm/Passes/*.h"]) + ["include/llvm-c/Transforms/PassBuilder.h"],
++ ], allow_empty = True),
++ hdrs = glob(["include/llvm/Passes/*.h"], allow_empty = True) + ["include/llvm-c/Transforms/PassBuilder.h"],
+ copts = llvm_copts,
+ deps = [
+ ":Analysis",
+@@ -2166,11 +2166,11 @@ cc_library(
+ srcs = glob([
+ "lib/LTO/*.cpp",
+ "lib/LTO/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/llvm/LTO/*.h",
+ "include/llvm/LTO/legacy/*.h",
+- ]) + [
++ ], allow_empty = True) + [
+ "include/llvm-c/lto.h",
+ ],
+ copts = llvm_copts,
+@@ -2203,7 +2203,7 @@ cc_library(
+ "lib/ExecutionEngine/RuntimeDyld/*.h",
+ "lib/ExecutionEngine/RuntimeDyld/Targets/*.cpp",
+ "lib/ExecutionEngine/RuntimeDyld/Targets/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob(
+ [
+ "include/llvm/ExecutionEngine/*.h",
+@@ -2212,7 +2212,7 @@ cc_library(
+ "include/llvm/ExecutionEngine/MCJIT*.h",
+ "include/llvm/ExecutionEngine/OProfileWrapper.h",
+ ],
+- ) + [
++ allow_empty = True) + [
+ "include/llvm-c/ExecutionEngine.h",
+ ],
+ copts = llvm_copts,
+@@ -2237,7 +2237,7 @@ cc_library(
+ srcs = glob([
+ "lib/ExecutionEngine/Interpreter/*.cpp",
+ "lib/ExecutionEngine/Interpreter/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = ["include/llvm/ExecutionEngine/Interpreter.h"],
+ copts = llvm_copts,
+ deps = [
+@@ -2255,10 +2255,10 @@ cc_library(
+ srcs = glob([
+ "lib/ExecutionEngine/JITLink/*.cpp",
+ "lib/ExecutionEngine/JITLink/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/llvm/ExecutionEngine/JITLink/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":ExecutionEngine",
+@@ -2274,8 +2274,8 @@ cc_library(
+ srcs = glob([
+ "lib/ExecutionEngine/MCJIT/*.cpp",
+ "lib/ExecutionEngine/MCJIT/*.h",
+- ]),
+- hdrs = glob(["include/llvm/ExecutionEngine/MCJIT*.h"]),
++ ], allow_empty = True),
++ hdrs = glob(["include/llvm/ExecutionEngine/MCJIT*.h"], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":CodeGen",
+@@ -2294,11 +2294,11 @@ cc_library(
+ srcs = glob([
+ "lib/ExecutionEngine/Orc/*.cpp",
+ "lib/ExecutionEngine/Orc/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/llvm/ExecutionEngine/Orc/*.h",
+ "include/llvm/ExecutionEngine/Orc/RPC/*.h",
+- ]) + [
++ ], allow_empty = True) + [
+ "include/llvm-c/LLJIT.h",
+ "include/llvm-c/Orc.h",
+ "include/llvm-c/OrcEE.h",
+@@ -2325,10 +2325,10 @@ cc_library(
+ name = "OrcShared",
+ srcs = glob([
+ "lib/ExecutionEngine/Orc/Shared/*.cpp",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/llvm/ExecutionEngine/Orc/Shared/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":BinaryFormat",
+@@ -2350,10 +2350,10 @@ cc_library(
+ srcs = glob([
+ "lib/ExecutionEngine/Orc/TargetProcess/*.cpp",
+ "lib/ExecutionEngine/Orc/TargetProcess/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/llvm/ExecutionEngine/Orc/TargetProcess/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":BinaryFormat",
+@@ -2376,8 +2376,8 @@ cc_library(
+ srcs = glob([
+ "lib/DWARFLinker/*.cpp",
+ "lib/DWARFLinker/*.h",
+- ]),
+- hdrs = glob(["include/llvm/DWARFLinker/*.h"]),
++ ], allow_empty = True),
++ hdrs = glob(["include/llvm/DWARFLinker/*.h"], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":CodeGen",
+@@ -2442,10 +2442,10 @@ cc_library(
+ srcs = glob([
+ "lib/InterfaceStub/*.cpp",
+ "lib/InterfaceStub/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/llvm/InterfaceStub/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":Object",
+@@ -2458,10 +2458,10 @@ cc_library(
+ name = "WindowsManifest",
+ srcs = glob([
+ "lib/WindowsManifest/*.cpp",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/llvm/WindowsManifest/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ linkopts = [
+ # Libxml2 is required to process Windows manifests. Without this,
+@@ -2499,10 +2499,10 @@ cc_library(
+ srcs = glob([
+ "lib/MCA/**/*.cpp",
+ "lib/MCA/**/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/llvm/MCA/**/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":MC",
+@@ -2526,8 +2526,8 @@ cc_library(
+ srcs = glob([
+ "lib/XRay/*.cpp",
+ "lib/XRay/*.h",
+- ]),
+- hdrs = glob(["include/llvm/XRay/*.h"]),
++ ], allow_empty = True),
++ hdrs = glob(["include/llvm/XRay/*.h"], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":Object",
+@@ -2594,7 +2594,7 @@ cc_binary(
+ srcs = glob([
+ "tools/dsymutil/*.cpp",
+ "tools/dsymutil/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -2620,7 +2620,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llc/*.cpp",
+ "tools/llc/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -2644,7 +2644,7 @@ cc_binary(
+ srcs = glob([
+ "tools/lli/*.cpp",
+ "tools/lli/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ # ll scripts rely on symbols from dependent
+ # libraries being resolvable.
+@@ -2689,7 +2689,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-ar/*.cpp",
+ "tools/llvm-ar/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -2725,7 +2725,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-as/*.cpp",
+ "tools/llvm-as/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -2742,7 +2742,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-bcanalyzer/*.cpp",
+ "tools/llvm-bcanalyzer/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -2755,7 +2755,7 @@ cc_binary(
+ name = "llvm-cat",
+ srcs = glob([
+ "tools/llvm-cat/*.cpp",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -2773,7 +2773,7 @@ cc_binary(
+ "tools/llvm-cfi-verify/*.cpp",
+ "tools/llvm-cfi-verify/lib/*.cpp",
+ "tools/llvm-cfi-verify/lib/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -2796,7 +2796,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-cov/*.cpp",
+ "tools/llvm-cov/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -2825,7 +2825,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-cvtres/*.cpp",
+ "tools/llvm-cvtres/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -2841,7 +2841,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-cxxdump/*.cpp",
+ "tools/llvm-cxxdump/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -2857,7 +2857,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-cxxmap/*.cpp",
+ "tools/llvm-cxxmap/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -2882,7 +2882,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-cxxfilt/*.cpp",
+ "tools/llvm-cxxfilt/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -2898,7 +2898,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-dis/*.cpp",
+ "tools/llvm-dis/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -2914,7 +2914,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-dwarfdump/*.cpp",
+ "tools/llvm-dwarfdump/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -2933,7 +2933,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-dwp/*.cpp",
+ "tools/llvm-dwp/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -2974,7 +2974,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-extract/*.cpp",
+ "tools/llvm-extract/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -2993,7 +2993,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-ifs/*.cpp",
+ "tools/llvm-ifs/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -3009,7 +3009,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-jitlink/*.cpp",
+ "tools/llvm-jitlink/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ # Make symbols from the standard library dynamically resolvable.
+ linkopts = select({
+@@ -3048,7 +3048,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-libtool-darwin/*.cpp",
+ "tools/llvm-libtool-darwin/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -3063,7 +3063,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-link/*.cpp",
+ "tools/llvm-link/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -3112,7 +3112,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-lto/*.cpp",
+ "tools/llvm-lto/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -3134,7 +3134,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-lto2/*.cpp",
+ "tools/llvm-lto2/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -3153,7 +3153,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-mc/*.cpp",
+ "tools/llvm-mc/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -3175,7 +3175,7 @@ cc_binary(
+ "tools/llvm-mca/*.h",
+ "tools/llvm-mca/Views/*.cpp",
+ "tools/llvm-mca/Views/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -3208,7 +3208,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-ml/*.cpp",
+ "tools/llvm-ml/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -3227,7 +3227,7 @@ cc_binary(
+ name = "llvm-modextract",
+ srcs = glob([
+ "tools/llvm-modextract/*.cpp",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -3255,7 +3255,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-mt/*.cpp",
+ "tools/llvm-mt/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ tags = [
+@@ -3287,7 +3287,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-nm/*.cpp",
+ "tools/llvm-nm/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -3369,7 +3369,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-stress/*.cpp",
+ "tools/llvm-stress/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -3425,7 +3425,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-objdump/*.cpp",
+ "tools/llvm-objdump/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -3482,7 +3482,7 @@ cc_binary(
+ name = "llvm-opt-report",
+ srcs = glob([
+ "tools/llvm-opt-report/*.cpp",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -3498,7 +3498,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-pdbutil/*.cpp",
+ "tools/llvm-pdbutil/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -3518,7 +3518,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-profdata/*.cpp",
+ "tools/llvm-profdata/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -3533,7 +3533,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-profgen/*.cpp",
+ "tools/llvm-profgen/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -3578,7 +3578,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-rc/*.cpp",
+ "tools/llvm-rc/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -3613,7 +3613,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-readobj/*.cpp",
+ "tools/llvm-readobj/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -3641,7 +3641,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-reduce/**/*.cpp",
+ "tools/llvm-reduce/**/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ includes = ["tools/llvm-reduce"],
+ stamp = 0,
+@@ -3658,7 +3658,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-rtdyld/*.cpp",
+ "tools/llvm-rtdyld/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -3691,7 +3691,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-size/*.cpp",
+ "tools/llvm-size/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -3707,7 +3707,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-split/*.cpp",
+ "tools/llvm-split/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -3736,7 +3736,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-strings/*.cpp",
+ "tools/llvm-strings/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -3764,7 +3764,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-symbolizer/*.cpp",
+ "tools/llvm-symbolizer/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -3789,7 +3789,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-undname/*.cpp",
+ "tools/llvm-undname/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -3804,7 +3804,7 @@ cc_binary(
+ "tools/llvm-xray/*.cpp",
+ "tools/llvm-xray/*.cc",
+ "tools/llvm-xray/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -3821,7 +3821,7 @@ cc_binary(
+ srcs = glob([
+ "tools/opt/*.cpp",
+ "tools/opt/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ linkopts = select({
+ "@bazel_tools//src/conditions:windows": [],
+@@ -3854,7 +3854,7 @@ cc_binary(
+ srcs = glob([
+ "tools/sancov/*.cpp",
+ "tools/sancov/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -3875,7 +3875,7 @@ cc_binary(
+ srcs = glob([
+ "tools/sanstats/*.cpp",
+ "tools/sanstats/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -3890,7 +3890,7 @@ cc_binary(
+ srcs = glob([
+ "tools/split-file/*.cpp",
+ "tools/split-file/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -3904,8 +3904,8 @@ cc_binary(
+ cc_library(
+ name = "FuzzMutate",
+ testonly = True,
+- srcs = glob(["lib/FuzzMutate/*.cpp"]),
+- hdrs = glob(["include/llvm/FuzzMutate/*.h"]),
++ srcs = glob(["lib/FuzzMutate/*.cpp"], allow_empty = True),
++ hdrs = glob(["include/llvm/FuzzMutate/*.h"], allow_empty = True),
+ copts = llvm_copts,
+ includes = ["include"],
+ deps = [
+@@ -3921,8 +3921,8 @@ cc_library(
+ cc_library(
+ name = "Diff",
+ testonly = True,
+- srcs = glob(["tools/llvm-diff/lib/*.cpp"]),
+- hdrs = glob(["tools/llvm-diff/lib/*.h"]),
++ srcs = glob(["tools/llvm-diff/lib/*.cpp"], allow_empty = True),
++ hdrs = glob(["tools/llvm-diff/lib/*.h"], allow_empty = True),
+ deps = [
+ ":Core",
+ ":Support",
+@@ -4023,7 +4023,7 @@ cc_library(
+ py_binary(
+ name = "lit",
+ testonly = True,
+- srcs = ["utils/lit/lit.py"] + glob(["utils/lit/lit/**/*.py"]),
++ srcs = ["utils/lit/lit.py"] + glob(["utils/lit/lit/**/*.py"], allow_empty = True),
+ )
+
+ cc_library(
+@@ -4032,10 +4032,10 @@ cc_library(
+ srcs = glob([
+ "lib/Testing/Support/*.cpp",
+ "lib/Testing/Support/*.h",
+- ]),
++ ], allow_empty = True),
+ hdrs = glob([
+ "include/llvm/Testing/Support/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ deps = [
+ ":Support",
+@@ -4054,7 +4054,7 @@ cc_binary(
+ srcs = glob([
+ "utils/FileCheck/*.cpp",
+ "utils/FileCheck/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [":FileCheckLib"],
+@@ -4065,7 +4065,7 @@ cc_binary(
+ srcs = glob([
+ "tools/bugpoint/*.cpp",
+ "tools/bugpoint/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -4093,7 +4093,7 @@ cc_binary(
+ srcs = glob([
+ "utils/count/*.c",
+ "utils/count/*.h",
+- ]),
++ ], allow_empty = True),
+ stamp = 0,
+ )
+
+@@ -4103,7 +4103,7 @@ cc_binary(
+ srcs = glob([
+ "tools/lli/ChildTarget/*.cpp",
+ "tools/lli/ChildTarget/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ # The tests load code into this binary that expect to see symbols
+ # from libstdc++ such as __cxa_begin_catch and _ZTIi. The latter
+@@ -4164,7 +4164,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-diff/*.cpp",
+ "tools/llvm-diff/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -4181,7 +4181,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-isel-fuzzer/*.cpp",
+ "tools/llvm-isel-fuzzer/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -4225,7 +4225,7 @@ cc_binary(
+ srcs = glob([
+ "utils/not/*.cpp",
+ "utils/not/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [":Support"],
+@@ -4287,7 +4287,7 @@ cc_binary(
+ srcs = glob([
+ "tools/llvm-tli-checker/*.cpp",
+ "tools/llvm-tli-checker/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -4314,7 +4314,7 @@ cc_binary(
+ srcs = glob([
+ "tools/obj2yaml/*.cpp",
+ "tools/obj2yaml/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -4332,7 +4332,7 @@ cc_binary(
+ srcs = glob([
+ "tools/verify-uselistorder/*.cpp",
+ "tools/verify-uselistorder/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [
+@@ -4351,7 +4351,7 @@ cc_binary(
+ srcs = glob([
+ "tools/yaml2obj/*.cpp",
+ "tools/yaml2obj/*.h",
+- ]),
++ ], allow_empty = True),
+ copts = llvm_copts,
+ stamp = 0,
+ deps = [