Further simplify the macros generated by rustc_queries

- Add a new `rustc_query_names` macro. This allows a much simpler syntax for the matchers in the macros passed to it as a callback.
- Convert `define_dep_nodes` and `alloc_once` to use `rustc_query_names`. This is possible because they only use the names
  (despite the quite complicated matchers in `define_dep_nodes`, none of the other arguments are used).
- Get rid of `rustc_dep_node_append`.
This commit is contained in:
Joshua Nelson 2022-08-29 17:45:18 -05:00
parent 699bfa882b
commit 05886e28a4
3 changed files with 18 additions and 32 deletions

View file

@ -144,10 +144,7 @@ impl DepKind {
macro_rules! define_dep_nodes {
(
$(
[$($attrs:tt)*]
$variant:ident $(( $tuple_arg_ty:ty $(,)? ))*
,)*
$( $variant:ident, )*
) => (
#[macro_export]
macro_rules! make_dep_kind_array {
@ -179,21 +176,14 @@ macro_rules! define_dep_nodes {
);
}
rustc_dep_node_append!(define_dep_nodes![
rustc_query_names!(define_dep_nodes![
// We use this for most things when incr. comp. is turned off.
[] Null,
Null,
// We use this to create a forever-red node.
[] Red,
[anon] TraitSelect,
// WARNING: if `Symbol` is changed, make sure you update `make_compile_codegen_unit` below.
[] CompileCodegenUnit(Symbol),
// WARNING: if `MonoItem` is changed, make sure you update `make_compile_mono_item` below.
// Only used by rustc_codegen_cranelift
[] CompileMonoItem(MonoItem),
Red,
TraitSelect,
CompileCodegenUnit,
CompileMonoItem,
]);
// WARNING: `construct` is generic and does not know that `CompileCodegenUnit` takes `Symbol`s as keys.