diff options
| author | Joshua Nelson <jnelson@cloudflare.com> | 2022-09-06 21:26:02 -0500 |
|---|---|---|
| committer | Joshua Nelson <jnelson@cloudflare.com> | 2022-09-06 21:46:31 -0500 |
| commit | 3a4e3c778889fdf2c4ccb7af26f1e81fc324e98b (patch) | |
| tree | 0ceeb33352bfdf89517471c018a8ffff0c9831df /compiler/rustc_query_impl | |
| parent | c630c87ceb0c49c5dc2b1a6119c67e9033dce828 (diff) | |
| download | rust-3a4e3c778889fdf2c4ccb7af26f1e81fc324e98b.tar.gz rust-3a4e3c778889fdf2c4ccb7af26f1e81fc324e98b.zip | |
Get rid of the emitted `rustc_query_names` and `rustc_cached_queries` macro
We can avoid these by adding slightly more information to `rustc_query_append` instead.
Diffstat (limited to 'compiler/rustc_query_impl')
| -rw-r--r-- | compiler/rustc_query_impl/src/plumbing.rs | 20 | ||||
| -rw-r--r-- | compiler/rustc_query_impl/src/profiling_support.rs | 10 |
2 files changed, 21 insertions, 9 deletions
diff --git a/compiler/rustc_query_impl/src/plumbing.rs b/compiler/rustc_query_impl/src/plumbing.rs index 274df5b5e5e..7e48125307a 100644 --- a/compiler/rustc_query_impl/src/plumbing.rs +++ b/compiler/rustc_query_impl/src/plumbing.rs @@ -148,19 +148,31 @@ impl<'tcx> QueryCtxt<'tcx> { encoder: &mut on_disk_cache::CacheEncoder<'_, 'tcx>, query_result_index: &mut on_disk_cache::EncodedDepNodeIndex, ) { + macro_rules! expand_if_cached { + ([] $encode:expr) => {}; + ([(cache) $($rest:tt)*] $encode:expr) => { + $encode + }; + ([$other:tt $($modifiers:tt)*] $encode:expr) => { + expand_if_cached!([$($modifiers)*] $encode) + }; + } + macro_rules! encode_queries { - ($($query:ident,)*) => { + ( + $($(#[$attr:meta])* + [$($modifiers:tt)*] fn $query:ident($($K:tt)*) -> $V:ty,)*) => { $( - on_disk_cache::encode_query_results::<_, super::queries::$query<'_>>( + expand_if_cached!([$($modifiers)*] on_disk_cache::encode_query_results::<_, super::queries::$query<'_>>( self, encoder, query_result_index - ); + )); )* } } - rustc_cached_queries!(encode_queries!); + rustc_query_append!(encode_queries!); } pub fn try_print_query_stack( diff --git a/compiler/rustc_query_impl/src/profiling_support.rs b/compiler/rustc_query_impl/src/profiling_support.rs index a9bb4756dbc..98ec3bc0977 100644 --- a/compiler/rustc_query_impl/src/profiling_support.rs +++ b/compiler/rustc_query_impl/src/profiling_support.rs @@ -307,18 +307,18 @@ pub fn alloc_self_profile_query_strings(tcx: TyCtxt<'_>) { macro_rules! alloc_once { ( - $( $( #[$attr:meta] )* $name:ident, )+ - ) => { - $({ + $($(#[$attr:meta])* + [$($modifiers:tt)*] fn $name:ident($($K:tt)*) -> $V:ty,)*) => { + $( alloc_self_profile_query_strings_for_query_cache( tcx, stringify!($name), &tcx.query_caches.$name, &mut string_cache, ); - })+ + )+ } } - rustc_query_names! { alloc_once! } + rustc_query_append! { alloc_once! } } |
