give some unwind-related terminators a more clear name
This commit is contained in:
parent
c0b6ffaaea
commit
818ec8e23a
39 changed files with 123 additions and 117 deletions
|
@ -35,7 +35,7 @@ impl<'tcx> MirPatch<'tcx> {
|
|||
|
||||
for (bb, block) in body.basic_blocks.iter_enumerated() {
|
||||
// Check if we already have a resume block
|
||||
if let TerminatorKind::Resume = block.terminator().kind && block.statements.is_empty() {
|
||||
if let TerminatorKind::UnwindResume = block.terminator().kind && block.statements.is_empty() {
|
||||
result.resume_block = Some(bb);
|
||||
continue;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ impl<'tcx> MirPatch<'tcx> {
|
|||
}
|
||||
|
||||
// Check if we already have a terminate block
|
||||
if let TerminatorKind::Terminate = block.terminator().kind && block.statements.is_empty() {
|
||||
if let TerminatorKind::UnwindTerminate = block.terminator().kind && block.statements.is_empty() {
|
||||
result.terminate_block = Some(bb);
|
||||
continue;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ impl<'tcx> MirPatch<'tcx> {
|
|||
statements: vec![],
|
||||
terminator: Some(Terminator {
|
||||
source_info: SourceInfo::outermost(self.body_span),
|
||||
kind: TerminatorKind::Resume,
|
||||
kind: TerminatorKind::UnwindResume,
|
||||
}),
|
||||
is_cleanup: true,
|
||||
});
|
||||
|
@ -102,7 +102,7 @@ impl<'tcx> MirPatch<'tcx> {
|
|||
statements: vec![],
|
||||
terminator: Some(Terminator {
|
||||
source_info: SourceInfo::outermost(self.body_span),
|
||||
kind: TerminatorKind::Terminate,
|
||||
kind: TerminatorKind::UnwindTerminate,
|
||||
}),
|
||||
is_cleanup: true,
|
||||
});
|
||||
|
|
|
@ -262,8 +262,8 @@ pub fn terminator_kind_name(term: &Terminator<'_>) -> &'static str {
|
|||
match term.kind {
|
||||
Goto { .. } => "Goto",
|
||||
SwitchInt { .. } => "SwitchInt",
|
||||
Resume => "Resume",
|
||||
Terminate => "Terminate",
|
||||
UnwindResume => "Resume",
|
||||
UnwindTerminate => "Terminate",
|
||||
Return => "Return",
|
||||
Unreachable => "Unreachable",
|
||||
Drop { .. } => "Drop",
|
||||
|
|
|
@ -593,13 +593,13 @@ pub enum TerminatorKind<'tcx> {
|
|||
///
|
||||
/// Only permitted in cleanup blocks. `Resume` is not permitted with `-C unwind=abort` after
|
||||
/// deaggregation runs.
|
||||
Resume,
|
||||
UnwindResume,
|
||||
|
||||
/// Indicates that the landing pad is finished and that the process should terminate.
|
||||
///
|
||||
/// Used to prevent unwinding for foreign items or with `-C unwind=abort`. Only permitted in
|
||||
/// cleanup blocks.
|
||||
Terminate,
|
||||
UnwindTerminate,
|
||||
|
||||
/// Returns from the function.
|
||||
///
|
||||
|
@ -790,8 +790,8 @@ impl TerminatorKind<'_> {
|
|||
match self {
|
||||
TerminatorKind::Goto { .. } => "Goto",
|
||||
TerminatorKind::SwitchInt { .. } => "SwitchInt",
|
||||
TerminatorKind::Resume => "Resume",
|
||||
TerminatorKind::Terminate => "Terminate",
|
||||
TerminatorKind::UnwindResume => "Resume",
|
||||
TerminatorKind::UnwindTerminate => "Terminate",
|
||||
TerminatorKind::Return => "Return",
|
||||
TerminatorKind::Unreachable => "Unreachable",
|
||||
TerminatorKind::Drop { .. } => "Drop",
|
||||
|
|
|
@ -155,8 +155,8 @@ impl<'tcx> TerminatorKind<'tcx> {
|
|||
| InlineAsm { destination: Some(t), unwind: _, .. } => {
|
||||
Some(t).into_iter().chain((&[]).into_iter().copied())
|
||||
}
|
||||
Resume
|
||||
| Terminate
|
||||
UnwindResume
|
||||
| UnwindTerminate
|
||||
| GeneratorDrop
|
||||
| Return
|
||||
| Unreachable
|
||||
|
@ -197,8 +197,8 @@ impl<'tcx> TerminatorKind<'tcx> {
|
|||
| InlineAsm { destination: Some(ref mut t), unwind: _, .. } => {
|
||||
Some(t).into_iter().chain(&mut [])
|
||||
}
|
||||
Resume
|
||||
| Terminate
|
||||
UnwindResume
|
||||
| UnwindTerminate
|
||||
| GeneratorDrop
|
||||
| Return
|
||||
| Unreachable
|
||||
|
@ -214,8 +214,8 @@ impl<'tcx> TerminatorKind<'tcx> {
|
|||
pub fn unwind(&self) -> Option<&UnwindAction> {
|
||||
match *self {
|
||||
TerminatorKind::Goto { .. }
|
||||
| TerminatorKind::Resume
|
||||
| TerminatorKind::Terminate
|
||||
| TerminatorKind::UnwindResume
|
||||
| TerminatorKind::UnwindTerminate
|
||||
| TerminatorKind::Return
|
||||
| TerminatorKind::Unreachable
|
||||
| TerminatorKind::GeneratorDrop
|
||||
|
@ -233,8 +233,8 @@ impl<'tcx> TerminatorKind<'tcx> {
|
|||
pub fn unwind_mut(&mut self) -> Option<&mut UnwindAction> {
|
||||
match *self {
|
||||
TerminatorKind::Goto { .. }
|
||||
| TerminatorKind::Resume
|
||||
| TerminatorKind::Terminate
|
||||
| TerminatorKind::UnwindResume
|
||||
| TerminatorKind::UnwindTerminate
|
||||
| TerminatorKind::Return
|
||||
| TerminatorKind::Unreachable
|
||||
| TerminatorKind::GeneratorDrop
|
||||
|
@ -311,8 +311,8 @@ impl<'tcx> TerminatorKind<'tcx> {
|
|||
SwitchInt { discr, .. } => write!(fmt, "switchInt({discr:?})"),
|
||||
Return => write!(fmt, "return"),
|
||||
GeneratorDrop => write!(fmt, "generator_drop"),
|
||||
Resume => write!(fmt, "resume"),
|
||||
Terminate => write!(fmt, "abort"),
|
||||
UnwindResume => write!(fmt, "resume"),
|
||||
UnwindTerminate => write!(fmt, "abort"),
|
||||
Yield { value, resume_arg, .. } => write!(fmt, "{resume_arg:?} = yield({value:?})"),
|
||||
Unreachable => write!(fmt, "unreachable"),
|
||||
Drop { place, .. } => write!(fmt, "drop({place:?})"),
|
||||
|
@ -391,7 +391,7 @@ impl<'tcx> TerminatorKind<'tcx> {
|
|||
pub fn fmt_successor_labels(&self) -> Vec<Cow<'static, str>> {
|
||||
use self::TerminatorKind::*;
|
||||
match *self {
|
||||
Return | Resume | Terminate | Unreachable | GeneratorDrop => vec![],
|
||||
Return | UnwindResume | UnwindTerminate | Unreachable | GeneratorDrop => vec![],
|
||||
Goto { .. } => vec!["".into()],
|
||||
SwitchInt { ref targets, .. } => targets
|
||||
.values
|
||||
|
@ -486,7 +486,9 @@ impl<'tcx> TerminatorKind<'tcx> {
|
|||
pub fn edges(&self) -> TerminatorEdges<'_, 'tcx> {
|
||||
use TerminatorKind::*;
|
||||
match *self {
|
||||
Return | Resume | Terminate | GeneratorDrop | Unreachable => TerminatorEdges::None,
|
||||
Return | UnwindResume | UnwindTerminate | GeneratorDrop | Unreachable => {
|
||||
TerminatorEdges::None
|
||||
}
|
||||
|
||||
Goto { target } => TerminatorEdges::Single(target),
|
||||
|
||||
|
|
|
@ -469,8 +469,8 @@ macro_rules! make_mir_visitor {
|
|||
self.visit_source_info(source_info);
|
||||
match kind {
|
||||
TerminatorKind::Goto { .. } |
|
||||
TerminatorKind::Resume |
|
||||
TerminatorKind::Terminate |
|
||||
TerminatorKind::UnwindResume |
|
||||
TerminatorKind::UnwindTerminate |
|
||||
TerminatorKind::GeneratorDrop |
|
||||
TerminatorKind::Unreachable |
|
||||
TerminatorKind::FalseEdge { .. } |
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue