internal static IEnumerable <(BasicBlock predecessorBlock, BranchWithInfo branchWithInfo)> GetPredecessorsWithBranches(this BasicBlock basicBlock, ControlFlowGraph cfg) { foreach (ControlFlowBranch predecessorBranch in basicBlock.Predecessors) { var branchWithInfo = new BranchWithInfo(predecessorBranch); if (!predecessorBranch.FinallyRegions.IsEmpty) { var lastFinally = predecessorBranch.FinallyRegions[^ 1];
internal static IEnumerable <(BasicBlock predecessorBlock, BranchWithInfo branchWithInfo)> GetPredecessorsWithBranches(this BasicBlock basicBlock, ControlFlowGraph cfg) { foreach (ControlFlowBranch predecessorBranch in basicBlock.Predecessors) { var branchWithInfo = new BranchWithInfo(predecessorBranch); if (predecessorBranch.FinallyRegions.Length > 0) { var lastFinally = predecessorBranch.FinallyRegions[predecessorBranch.FinallyRegions.Length - 1]; yield return(predecessorBlock : cfg.Blocks[lastFinally.LastBlockOrdinal], branchWithInfo); } else { yield return(predecessorBlock : predecessorBranch.Source, branchWithInfo); } } }