示例#1
0
 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];
示例#2
0
 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);
         }
     }
 }