diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:43 +0000 |
commit | 3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245 (patch) | |
tree | daf049b282ab10e8c3d03e409b3cd84ff3f7690c /compiler/rustc_data_structures/src/graph/scc/mod.rs | |
parent | Adding debian version 1.68.2+dfsg1-1. (diff) | |
download | rustc-3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245.tar.xz rustc-3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245.zip |
Merging upstream version 1.69.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_data_structures/src/graph/scc/mod.rs')
-rw-r--r-- | compiler/rustc_data_structures/src/graph/scc/mod.rs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/compiler/rustc_data_structures/src/graph/scc/mod.rs b/compiler/rustc_data_structures/src/graph/scc/mod.rs index c8e66eb67..c4b11951a 100644 --- a/compiler/rustc_data_structures/src/graph/scc/mod.rs +++ b/compiler/rustc_data_structures/src/graph/scc/mod.rs @@ -27,7 +27,7 @@ pub struct Sccs<N: Idx, S: Idx> { scc_data: SccData<S>, } -struct SccData<S: Idx> { +pub struct SccData<S: Idx> { /// For each SCC, the range of `all_successors` where its /// successors can be found. ranges: IndexVec<S, Range<usize>>, @@ -43,6 +43,14 @@ impl<N: Idx, S: Idx + Ord> Sccs<N, S> { SccsConstruction::construct(graph) } + pub fn scc_indices(&self) -> &IndexVec<N, S> { + &self.scc_indices + } + + pub fn scc_data(&self) -> &SccData<S> { + &self.scc_data + } + /// Returns the number of SCCs in the graph. pub fn num_sccs(&self) -> usize { self.scc_data.len() @@ -115,6 +123,14 @@ impl<S: Idx> SccData<S> { self.ranges.len() } + pub fn ranges(&self) -> &IndexVec<S, Range<usize>> { + &self.ranges + } + + pub fn all_successors(&self) -> &Vec<S> { + &self.all_successors + } + /// Returns the successors of the given SCC. fn successors(&self, scc: S) -> &[S] { // Annoyingly, `range` does not implement `Copy`, so we have |