Rename Abort
terminator to Terminate
Unify terminology used in unwind action and terminator, and reflect the fact that a nounwind panic is triggered instead of an immediate abort is triggered for this terminator.
This commit is contained in:
parent
0a5dac3062
commit
e3f2edc75b
36 changed files with 112 additions and 67 deletions
|
@ -37,7 +37,19 @@ impl<'tcx> MirPatch<'tcx> {
|
|||
// Check if we already have a resume block
|
||||
if let TerminatorKind::Resume = block.terminator().kind && block.statements.is_empty() {
|
||||
result.resume_block = Some(bb);
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check if we already have an unreachable block
|
||||
if let TerminatorKind::Unreachable = block.terminator().kind && block.statements.is_empty() {
|
||||
result.unreachable_block = Some(bb);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check if we already have a terminate block
|
||||
if let TerminatorKind::Terminate = block.terminator().kind && block.statements.is_empty() {
|
||||
result.terminate_block = Some(bb);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,6 +73,40 @@ impl<'tcx> MirPatch<'tcx> {
|
|||
bb
|
||||
}
|
||||
|
||||
pub fn unreachable_block(&mut self) -> BasicBlock {
|
||||
if let Some(bb) = self.unreachable_block {
|
||||
return bb;
|
||||
}
|
||||
|
||||
let bb = self.new_block(BasicBlockData {
|
||||
statements: vec![],
|
||||
terminator: Some(Terminator {
|
||||
source_info: SourceInfo::outermost(self.body_span),
|
||||
kind: TerminatorKind::Unreachable,
|
||||
}),
|
||||
is_cleanup: true,
|
||||
});
|
||||
self.unreachable_block = Some(bb);
|
||||
bb
|
||||
}
|
||||
|
||||
pub fn terminate_block(&mut self) -> BasicBlock {
|
||||
if let Some(bb) = self.terminate_block {
|
||||
return bb;
|
||||
}
|
||||
|
||||
let bb = self.new_block(BasicBlockData {
|
||||
statements: vec![],
|
||||
terminator: Some(Terminator {
|
||||
source_info: SourceInfo::outermost(self.body_span),
|
||||
kind: TerminatorKind::Terminate,
|
||||
}),
|
||||
is_cleanup: true,
|
||||
});
|
||||
self.terminate_block = Some(bb);
|
||||
bb
|
||||
}
|
||||
|
||||
pub fn is_patched(&self, bb: BasicBlock) -> bool {
|
||||
self.patch_map[bb].is_some()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue