未验证 提交 3f4dbb52 编写于 作者: A AlekseyTs 提交者: GitHub

Add BasicBlock.IsReachable property. (#25698)

上级 9888b3a4
...@@ -1050,7 +1050,7 @@ void M(bool x) ...@@ -1050,7 +1050,7 @@ void M(bool x)
Leaving: {R6} {R1} Leaving: {R6} {R1}
} }
Block[B5] - Block Block[B5] - Block [UnReachable]
Predecessors (0) Predecessors (0)
Statements (1) Statements (1)
IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'x = true;') IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'x = true;')
......
...@@ -622,7 +622,7 @@ void F(dynamic alternative, dynamic result) ...@@ -622,7 +622,7 @@ void F(dynamic alternative, dynamic result)
IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: null, Constant: null, IsImplicit) (Syntax: 'null') IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: null, Constant: null, IsImplicit) (Syntax: 'null')
Next (Regular) Block[B2] Next (Regular) Block[B2]
Block[B2] - Block Block[B2] - Block [UnReachable]
Predecessors: [B1] Predecessors: [B1]
Statements (1) Statements (1)
IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'null') IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'null')
...@@ -717,7 +717,7 @@ void F(int alternative, int result) ...@@ -717,7 +717,7 @@ void F(int alternative, int result)
IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: null, Constant: null, IsInvalid, IsImplicit) (Syntax: 'null') IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: null, Constant: null, IsInvalid, IsImplicit) (Syntax: 'null')
Next (Regular) Block[B2] Next (Regular) Block[B2]
Block[B2] - Block Block[B2] - Block [UnReachable]
Predecessors: [B1] Predecessors: [B1]
Statements (1) Statements (1)
IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'null') IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'null')
...@@ -810,7 +810,7 @@ void F(int? alternative, int? result) ...@@ -810,7 +810,7 @@ void F(int? alternative, int? result)
IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: null, Constant: null, IsImplicit) (Syntax: 'null') IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: null, Constant: null, IsImplicit) (Syntax: 'null')
Next (Regular) Block[B2] Next (Regular) Block[B2]
Block[B2] - Block Block[B2] - Block [UnReachable]
Predecessors: [B1] Predecessors: [B1]
Statements (1) Statements (1)
IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'null') IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'null')
...@@ -1203,7 +1203,7 @@ void F(object alternative, object result) ...@@ -1203,7 +1203,7 @@ void F(object alternative, object result)
IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.String, Constant: ""a"", IsImplicit) (Syntax: 'input') IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: System.String, Constant: ""a"", IsImplicit) (Syntax: 'input')
Next (Regular) Block[B4] Next (Regular) Block[B4]
Block[B3] - Block Block[B3] - Block [UnReachable]
Predecessors: [B1] Predecessors: [B1]
Statements (1) Statements (1)
IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'alternative') IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'alternative')
......
...@@ -1277,7 +1277,7 @@ void M() ...@@ -1277,7 +1277,7 @@ void M()
Next (Regular) Block[B3] Next (Regular) Block[B3]
Leaving: {R1} Leaving: {R1}
Block[B2] - Block Block[B2] - Block [UnReachable]
Predecessors: [B1] Predecessors: [B1]
Statements (1) Statements (1)
IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'condition = true;') IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'condition = true;')
......
...@@ -223,7 +223,7 @@ void F(bool a) ...@@ -223,7 +223,7 @@ void F(bool a)
Block[B0] - Entry Block[B0] - Entry
Statements (0) Statements (0)
Next (Regular) Block[B2] Next (Regular) Block[B2]
Block[B1] - Block Block[B1] - Block [UnReachable]
Predecessors (0) Predecessors (0)
Statements (1) Statements (1)
IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'a = true;') IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'a = true;')
...@@ -273,7 +273,7 @@ int F(bool a) ...@@ -273,7 +273,7 @@ int F(bool a)
Statements (0) Statements (0)
Next (Return) Block[B3] Next (Return) Block[B3]
ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1')
Block[B2] - Block Block[B2] - Block [UnReachable]
Predecessors (0) Predecessors (0)
Statements (1) Statements (1)
IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'a = true;') IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'a = true;')
...@@ -624,7 +624,7 @@ int F() ...@@ -624,7 +624,7 @@ int F()
Statements (0) Statements (0)
Next (Return) Block[B3] Next (Return) Block[B3]
ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1')
Block[B2] - Block Block[B2] - Block [UnReachable]
Predecessors (0) Predecessors (0)
Statements (0) Statements (0)
Next (Return) Block[B3] Next (Return) Block[B3]
...@@ -1189,7 +1189,7 @@ System.Collections.Generic.IEnumerable<int> F(bool a) ...@@ -1189,7 +1189,7 @@ System.Collections.Generic.IEnumerable<int> F(bool a)
Block[B0] - Entry Block[B0] - Entry
Statements (0) Statements (0)
Next (Regular) Block[B2] Next (Regular) Block[B2]
Block[B1] - Block Block[B1] - Block [UnReachable]
Predecessors (0) Predecessors (0)
Statements (1) Statements (1)
IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'a = true;') IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'a = true;')
......
...@@ -39,7 +39,7 @@ void F() ...@@ -39,7 +39,7 @@ void F()
Predecessors: [B0] Predecessors: [B0]
Statements (0) Statements (0)
Next (ReThrow) Block[null] Next (ReThrow) Block[null]
Block[B2] - Exit Block[B2] - Exit [UnReachable]
Predecessors (0) Predecessors (0)
Statements (0) Statements (0)
"; ";
...@@ -88,7 +88,7 @@ void F(int x) ...@@ -88,7 +88,7 @@ void F(int x)
ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1')
Next (ReThrow) Block[null] Next (ReThrow) Block[null]
Block[B2] - Block Block[B2] - Block [UnReachable]
Predecessors (0) Predecessors (0)
Statements (1) Statements (1)
IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'x = 2;') IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'x = 2;')
...@@ -100,7 +100,7 @@ void F(int x) ...@@ -100,7 +100,7 @@ void F(int x)
ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2')
Next (Regular) Block[B3] Next (Regular) Block[B3]
Block[B3] - Exit Block[B3] - Exit [UnReachable]
Predecessors: [B2] Predecessors: [B2]
Statements (0) Statements (0)
"; ";
...@@ -133,7 +133,7 @@ void F(System.Exception ex) ...@@ -133,7 +133,7 @@ void F(System.Exception ex)
Statements (0) Statements (0)
Next (Throw) Block[null] Next (Throw) Block[null]
IParameterReferenceOperation: ex (OperationKind.ParameterReference, Type: System.Exception) (Syntax: 'ex') IParameterReferenceOperation: ex (OperationKind.ParameterReference, Type: System.Exception) (Syntax: 'ex')
Block[B2] - Exit Block[B2] - Exit [UnReachable]
Predecessors (0) Predecessors (0)
Statements (0) Statements (0)
"; ";
...@@ -186,7 +186,7 @@ void F(System.Exception ex) ...@@ -186,7 +186,7 @@ void F(System.Exception ex)
Next (Throw) Block[null] Next (Throw) Block[null]
IParameterReferenceOperation: ex (OperationKind.ParameterReference, Type: System.Exception) (Syntax: 'ex') IParameterReferenceOperation: ex (OperationKind.ParameterReference, Type: System.Exception) (Syntax: 'ex')
Block[B2] - Block Block[B2] - Block [UnReachable]
Predecessors (0) Predecessors (0)
Statements (1) Statements (1)
IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'x = 2;') IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'x = 2;')
...@@ -201,7 +201,7 @@ void F(System.Exception ex) ...@@ -201,7 +201,7 @@ void F(System.Exception ex)
Leaving: {R1} Leaving: {R1}
} }
Block[B3] - Exit Block[B3] - Exit [UnReachable]
Predecessors: [B2] Predecessors: [B2]
Statements (0) Statements (0)
"; ";
...@@ -249,7 +249,7 @@ void F(int x, System.Exception ex) ...@@ -249,7 +249,7 @@ void F(int x, System.Exception ex)
IParameterReferenceOperation: ex (OperationKind.ParameterReference, Type: System.Exception, IsInvalid) (Syntax: 'ex') IParameterReferenceOperation: ex (OperationKind.ParameterReference, Type: System.Exception, IsInvalid) (Syntax: 'ex')
Right: Right:
IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32, IsInvalid) (Syntax: 'x') IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32, IsInvalid) (Syntax: 'x')
Block[B2] - Block Block[B2] - Block [UnReachable]
Predecessors (0) Predecessors (0)
Statements (1) Statements (1)
IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null, IsInvalid) (Syntax: 'x = throw ex + x;') IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null, IsInvalid) (Syntax: 'x = throw ex + x;')
...@@ -267,7 +267,7 @@ void F(int x, System.Exception ex) ...@@ -267,7 +267,7 @@ void F(int x, System.Exception ex)
IOperation: (OperationKind.None, Type: null, IsInvalid, IsImplicit) (Syntax: 'throw ex + x') IOperation: (OperationKind.None, Type: null, IsInvalid, IsImplicit) (Syntax: 'throw ex + x')
Next (Regular) Block[B3] Next (Regular) Block[B3]
Block[B3] - Exit Block[B3] - Exit [UnReachable]
Predecessors: [B2] Predecessors: [B2]
Statements (0) Statements (0)
"; ";
...@@ -308,7 +308,7 @@ void F(int x, System.Exception ex) ...@@ -308,7 +308,7 @@ void F(int x, System.Exception ex)
Next (Throw) Block[null] Next (Throw) Block[null]
IParameterReferenceOperation: ex (OperationKind.ParameterReference, Type: System.Exception) (Syntax: 'ex') IParameterReferenceOperation: ex (OperationKind.ParameterReference, Type: System.Exception) (Syntax: 'ex')
Block[B2] - Block Block[B2] - Block [UnReachable]
Predecessors (0) Predecessors (0)
Statements (1) Statements (1)
IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null, IsInvalid) (Syntax: 'x = (throw ex) + x;') IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null, IsInvalid) (Syntax: 'x = (throw ex) + x;')
...@@ -330,7 +330,7 @@ void F(int x, System.Exception ex) ...@@ -330,7 +330,7 @@ void F(int x, System.Exception ex)
IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'x') IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'x')
Next (Regular) Block[B3] Next (Regular) Block[B3]
Block[B3] - Exit Block[B3] - Exit [UnReachable]
Predecessors: [B2] Predecessors: [B2]
Statements (0) Statements (0)
"; ";
...@@ -375,7 +375,7 @@ void F(int x, System.Exception ex) ...@@ -375,7 +375,7 @@ void F(int x, System.Exception ex)
Next (Throw) Block[null] Next (Throw) Block[null]
IParameterReferenceOperation: ex (OperationKind.ParameterReference, Type: System.Exception, IsInvalid) (Syntax: 'ex') IParameterReferenceOperation: ex (OperationKind.ParameterReference, Type: System.Exception, IsInvalid) (Syntax: 'ex')
Block[B2] - Block Block[B2] - Block [UnReachable]
Predecessors (0) Predecessors (0)
Statements (1) Statements (1)
IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null, IsInvalid) (Syntax: 'x = x + throw ex;') IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null, IsInvalid) (Syntax: 'x = x + throw ex;')
...@@ -397,7 +397,7 @@ void F(int x, System.Exception ex) ...@@ -397,7 +397,7 @@ void F(int x, System.Exception ex)
IOperation: (OperationKind.None, Type: null, IsInvalid, IsImplicit) (Syntax: 'throw ex') IOperation: (OperationKind.None, Type: null, IsInvalid, IsImplicit) (Syntax: 'throw ex')
Next (Regular) Block[B3] Next (Regular) Block[B3]
Block[B3] - Exit Block[B3] - Exit [UnReachable]
Predecessors: [B2] Predecessors: [B2]
Statements (0) Statements (0)
"; ";
...@@ -442,7 +442,7 @@ void F(int x, System.Exception ex) ...@@ -442,7 +442,7 @@ void F(int x, System.Exception ex)
Next (Throw) Block[null] Next (Throw) Block[null]
IParameterReferenceOperation: ex (OperationKind.ParameterReference, Type: System.Exception) (Syntax: 'ex') IParameterReferenceOperation: ex (OperationKind.ParameterReference, Type: System.Exception) (Syntax: 'ex')
Block[B2] - Block Block[B2] - Block [UnReachable]
Predecessors (0) Predecessors (0)
Statements (1) Statements (1)
IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null, IsInvalid) (Syntax: 'x = x + (throw ex);') IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null, IsInvalid) (Syntax: 'x = x + (throw ex);')
...@@ -464,7 +464,7 @@ void F(int x, System.Exception ex) ...@@ -464,7 +464,7 @@ void F(int x, System.Exception ex)
IOperation: (OperationKind.None, Type: null, IsInvalid, IsImplicit) (Syntax: 'throw ex') IOperation: (OperationKind.None, Type: null, IsInvalid, IsImplicit) (Syntax: 'throw ex')
Next (Regular) Block[B3] Next (Regular) Block[B3]
Block[B3] - Exit Block[B3] - Exit [UnReachable]
Predecessors: [B2] Predecessors: [B2]
Statements (0) Statements (0)
"; ";
...@@ -522,7 +522,7 @@ void F(object x, object y, System.Exception ex) ...@@ -522,7 +522,7 @@ void F(object x, object y, System.Exception ex)
Statements (0) Statements (0)
Next (Throw) Block[null] Next (Throw) Block[null]
IParameterReferenceOperation: ex (OperationKind.ParameterReference, Type: System.Exception) (Syntax: 'ex') IParameterReferenceOperation: ex (OperationKind.ParameterReference, Type: System.Exception) (Syntax: 'ex')
Block[B4] - Block Block[B4] - Block [UnReachable]
Predecessors (0) Predecessors (0)
Statements (1) Statements (1)
IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'throw ex') IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'throw ex')
...@@ -606,7 +606,7 @@ void F(object x, object y, object z, System.Exception ex) ...@@ -606,7 +606,7 @@ void F(object x, object y, object z, System.Exception ex)
Statements (0) Statements (0)
Next (Throw) Block[null] Next (Throw) Block[null]
IParameterReferenceOperation: ex (OperationKind.ParameterReference, Type: System.Exception) (Syntax: 'ex') IParameterReferenceOperation: ex (OperationKind.ParameterReference, Type: System.Exception) (Syntax: 'ex')
Block[B4] - Block Block[B4] - Block [UnReachable]
Predecessors (0) Predecessors (0)
Statements (1) Statements (1)
IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'throw ex') IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'throw ex')
...@@ -779,7 +779,7 @@ void F(int u) ...@@ -779,7 +779,7 @@ void F(int u)
ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2')
Next (ReThrow) Block[null] Next (ReThrow) Block[null]
Block[B3] - Block Block[B3] - Block [UnReachable]
Predecessors (0) Predecessors (0)
Statements (1) Statements (1)
IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'u = 3;') IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'u = 3;')
...@@ -885,7 +885,7 @@ void F(object x, object y, object z, int u) ...@@ -885,7 +885,7 @@ void F(object x, object y, object z, int u)
Next (Throw) Block[null] Next (Throw) Block[null]
IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid) (Syntax: '') IInvalidOperation (OperationKind.Invalid, Type: null, IsInvalid) (Syntax: '')
Children(0) Children(0)
Block[B5] - Block Block[B5] - Block [UnReachable]
Predecessors (0) Predecessors (0)
Statements (1) Statements (1)
IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'throw') IFlowCaptureOperation: 1 (OperationKind.FlowCapture, Type: null, IsInvalid, IsImplicit) (Syntax: 'throw')
...@@ -958,7 +958,7 @@ void F(System.Exception ex) ...@@ -958,7 +958,7 @@ void F(System.Exception ex)
Next (Throw) Block[null] Next (Throw) Block[null]
IParameterReferenceOperation: ex (OperationKind.ParameterReference, Type: System.Exception) (Syntax: 'ex') IParameterReferenceOperation: ex (OperationKind.ParameterReference, Type: System.Exception) (Syntax: 'ex')
Block[B2] - Exit Block[B2] - Exit [UnReachable]
Predecessors (0) Predecessors (0)
Statements (0) Statements (0)
"; ";
...@@ -1072,7 +1072,7 @@ void F(System.Exception ex, bool a) ...@@ -1072,7 +1072,7 @@ void F(System.Exception ex, bool a)
Statements (0) Statements (0)
Next (Throw) Block[null] Next (Throw) Block[null]
IParameterReferenceOperation: ex (OperationKind.ParameterReference, Type: System.Exception) (Syntax: 'ex') IParameterReferenceOperation: ex (OperationKind.ParameterReference, Type: System.Exception) (Syntax: 'ex')
Block[B3] - Exit Block[B3] - Exit [UnReachable]
Predecessors (0) Predecessors (0)
Statements (0) Statements (0)
"; ";
...@@ -1195,7 +1195,7 @@ void F(System.Exception ex) ...@@ -1195,7 +1195,7 @@ void F(System.Exception ex)
Statements (0) Statements (0)
Next (Throw) Block[null] Next (Throw) Block[null]
IParameterReferenceOperation: ex (OperationKind.ParameterReference, Type: System.Exception) (Syntax: 'ex') IParameterReferenceOperation: ex (OperationKind.ParameterReference, Type: System.Exception) (Syntax: 'ex')
Block[B3] - Exit Block[B3] - Exit [UnReachable]
Predecessors (0) Predecessors (0)
Statements (0) Statements (0)
"; ";
...@@ -1345,7 +1345,7 @@ void F(System.Exception ex, int x) ...@@ -1345,7 +1345,7 @@ void F(System.Exception ex, int x)
Statements (0) Statements (0)
Next (Throw) Block[null] Next (Throw) Block[null]
IParameterReferenceOperation: ex (OperationKind.ParameterReference, Type: System.Exception) (Syntax: 'ex') IParameterReferenceOperation: ex (OperationKind.ParameterReference, Type: System.Exception) (Syntax: 'ex')
Block[B3] - Block Block[B3] - Block [UnReachable]
Predecessors (0) Predecessors (0)
Statements (1) Statements (1)
IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'x = 2;') IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'x = 2;')
...@@ -1425,7 +1425,7 @@ void F(int x) ...@@ -1425,7 +1425,7 @@ void F(int x)
Predecessors: [B3] Predecessors: [B3]
Statements (0) Statements (0)
Next (ReThrow) Block[null] Next (ReThrow) Block[null]
Block[B3] - Block Block[B3] - Block [UnReachable]
Predecessors (0) Predecessors (0)
Statements (1) Statements (1)
IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'x = 2;') IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'x = 2;')
...@@ -1486,7 +1486,7 @@ int F(bool a, System.Exception ex1, System.Exception ex2) ...@@ -1486,7 +1486,7 @@ int F(bool a, System.Exception ex1, System.Exception ex2)
Statements (0) Statements (0)
Next (Throw) Block[null] Next (Throw) Block[null]
IParameterReferenceOperation: ex2 (OperationKind.ParameterReference, Type: System.Exception) (Syntax: 'ex2') IParameterReferenceOperation: ex2 (OperationKind.ParameterReference, Type: System.Exception) (Syntax: 'ex2')
Block[B3] - Exit Block[B3] - Exit [UnReachable]
Predecessors (0) Predecessors (0)
Statements (0) Statements (0)
"; ";
...@@ -1541,7 +1541,7 @@ void F(int x, System.Exception ex1, System.Exception ex2, bool a) ...@@ -1541,7 +1541,7 @@ void F(int x, System.Exception ex1, System.Exception ex2, bool a)
Statements (0) Statements (0)
Next (Throw) Block[null] Next (Throw) Block[null]
IParameterReferenceOperation: ex2 (OperationKind.ParameterReference, Type: System.Exception) (Syntax: 'ex2') IParameterReferenceOperation: ex2 (OperationKind.ParameterReference, Type: System.Exception) (Syntax: 'ex2')
Block[B3] - Exit Block[B3] - Exit [UnReachable]
Predecessors (0) Predecessors (0)
Statements (0) Statements (0)
"; ";
...@@ -1843,7 +1843,7 @@ void F(int u) ...@@ -1843,7 +1843,7 @@ void F(int u)
Next (ReThrow) Block[null] Next (ReThrow) Block[null]
} }
Block[B3] - Exit Block[B3] - Exit [UnReachable]
Predecessors: [B1] Predecessors: [B1]
Statements (0) Statements (0)
"; ";
...@@ -1906,7 +1906,7 @@ void F(int u, System.Exception ex) ...@@ -1906,7 +1906,7 @@ void F(int u, System.Exception ex)
IParameterReferenceOperation: ex (OperationKind.ParameterReference, Type: System.Exception) (Syntax: 'ex') IParameterReferenceOperation: ex (OperationKind.ParameterReference, Type: System.Exception) (Syntax: 'ex')
} }
Block[B3] - Exit Block[B3] - Exit [UnReachable]
Predecessors: [B1] Predecessors: [B1]
Statements (0) Statements (0)
"; ";
......
...@@ -54,6 +54,8 @@ public BasicBlock(BasicBlockKind kind) ...@@ -54,6 +54,8 @@ public BasicBlock(BasicBlockKind kind)
public int Ordinal { get; internal set; } = -1; public int Ordinal { get; internal set; } = -1;
public bool IsReachable { get; internal set; } = false;
/// <summary> /// <summary>
/// Enclosing region /// Enclosing region
/// </summary> /// </summary>
......
...@@ -190,6 +190,11 @@ public sealed class Region ...@@ -190,6 +190,11 @@ public sealed class Region
} }
#endif #endif
} }
internal bool ContainsBlock(int destinationOrdinal)
{
return FirstBlockOrdinal <= destinationOrdinal && LastBlockOrdinal >= destinationOrdinal;
}
} }
} }
} }
...@@ -32,6 +32,7 @@ Microsoft.CodeAnalysis.Operations.BasicBlock.BranchKind.Return = 2 -> Microsoft. ...@@ -32,6 +32,7 @@ Microsoft.CodeAnalysis.Operations.BasicBlock.BranchKind.Return = 2 -> Microsoft.
Microsoft.CodeAnalysis.Operations.BasicBlock.BranchKind.StructuredExceptionHandling = 3 -> Microsoft.CodeAnalysis.Operations.BasicBlock.BranchKind Microsoft.CodeAnalysis.Operations.BasicBlock.BranchKind.StructuredExceptionHandling = 3 -> Microsoft.CodeAnalysis.Operations.BasicBlock.BranchKind
Microsoft.CodeAnalysis.Operations.BasicBlock.BranchKind.Throw = 5 -> Microsoft.CodeAnalysis.Operations.BasicBlock.BranchKind Microsoft.CodeAnalysis.Operations.BasicBlock.BranchKind.Throw = 5 -> Microsoft.CodeAnalysis.Operations.BasicBlock.BranchKind
Microsoft.CodeAnalysis.Operations.BasicBlock.Conditional.get -> (Microsoft.CodeAnalysis.IOperation Condition, bool JumpIfTrue, Microsoft.CodeAnalysis.Operations.BasicBlock.Branch Branch) Microsoft.CodeAnalysis.Operations.BasicBlock.Conditional.get -> (Microsoft.CodeAnalysis.IOperation Condition, bool JumpIfTrue, Microsoft.CodeAnalysis.Operations.BasicBlock.Branch Branch)
Microsoft.CodeAnalysis.Operations.BasicBlock.IsReachable.get -> bool
Microsoft.CodeAnalysis.Operations.BasicBlock.Kind.get -> Microsoft.CodeAnalysis.Operations.BasicBlockKind Microsoft.CodeAnalysis.Operations.BasicBlock.Kind.get -> Microsoft.CodeAnalysis.Operations.BasicBlockKind
Microsoft.CodeAnalysis.Operations.BasicBlock.Next.get -> (Microsoft.CodeAnalysis.IOperation Value, Microsoft.CodeAnalysis.Operations.BasicBlock.Branch Branch) Microsoft.CodeAnalysis.Operations.BasicBlock.Next.get -> (Microsoft.CodeAnalysis.IOperation Value, Microsoft.CodeAnalysis.Operations.BasicBlock.Branch Branch)
Microsoft.CodeAnalysis.Operations.BasicBlock.Ordinal.get -> int Microsoft.CodeAnalysis.Operations.BasicBlock.Ordinal.get -> int
......
...@@ -659,7 +659,7 @@ Block[B1] - Block ...@@ -659,7 +659,7 @@ Block[B1] - Block
IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: null, Constant: null, IsImplicit) (Syntax: 'Nothing') IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: null, Constant: null, IsImplicit) (Syntax: 'Nothing')
Next (Regular) Block[B2] Next (Regular) Block[B2]
Block[B2] - Block Block[B2] - Block [UnReachable]
Predecessors: [B1] Predecessors: [B1]
Statements (1) Statements (1)
IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'Nothing') IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'Nothing')
...@@ -755,7 +755,7 @@ Block[B1] - Block ...@@ -755,7 +755,7 @@ Block[B1] - Block
IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: null, Constant: null, IsImplicit) (Syntax: 'Nothing') IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: null, Constant: null, IsImplicit) (Syntax: 'Nothing')
Next (Regular) Block[B2] Next (Regular) Block[B2]
Block[B2] - Block Block[B2] - Block [UnReachable]
Predecessors: [B1] Predecessors: [B1]
Statements (1) Statements (1)
IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'Nothing') IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'Nothing')
...@@ -851,7 +851,7 @@ Block[B1] - Block ...@@ -851,7 +851,7 @@ Block[B1] - Block
IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: null, Constant: null, IsImplicit) (Syntax: 'Nothing') IFlowCaptureReferenceOperation: 1 (OperationKind.FlowCaptureReference, Type: null, Constant: null, IsImplicit) (Syntax: 'Nothing')
Next (Regular) Block[B2] Next (Regular) Block[B2]
Block[B2] - Block Block[B2] - Block [UnReachable]
Predecessors: [B1] Predecessors: [B1]
Statements (1) Statements (1)
IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'Nothing') IFlowCaptureOperation: 2 (OperationKind.FlowCapture, Type: null, IsImplicit) (Syntax: 'Nothing')
......
...@@ -28,7 +28,7 @@ Block[B1] - Block ...@@ -28,7 +28,7 @@ Block[B1] - Block
Predecessors: [B0] Predecessors: [B0]
Statements (0) Statements (0)
Next (ProgramTermination) Block[null] Next (ProgramTermination) Block[null]
Block[B2] - Exit Block[B2] - Exit [UnReachable]
Predecessors (0) Predecessors (0)
Statements (0) Statements (0)
]]>.Value ]]>.Value
...@@ -69,7 +69,7 @@ Block[B1] - Block ...@@ -69,7 +69,7 @@ Block[B1] - Block
ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1')
Next (ProgramTermination) Block[null] Next (ProgramTermination) Block[null]
Block[B2] - Block Block[B2] - Block [UnReachable]
Predecessors (0) Predecessors (0)
Statements (1) Statements (1)
IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'x = 2') IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'x = 2')
...@@ -81,7 +81,7 @@ Block[B2] - Block ...@@ -81,7 +81,7 @@ Block[B2] - Block
ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2')
Next (Regular) Block[B3] Next (Regular) Block[B3]
Block[B3] - Exit Block[B3] - Exit [UnReachable]
Predecessors: [B2] Predecessors: [B2]
Statements (0) Statements (0)
]]>.Value ]]>.Value
...@@ -139,7 +139,7 @@ Block[B0] - Entry ...@@ -139,7 +139,7 @@ Block[B0] - Entry
Next (ProgramTermination) Block[null] Next (ProgramTermination) Block[null]
} }
Block[B3] - Exit Block[B3] - Exit [UnReachable]
Predecessors: [B1] Predecessors: [B1]
Statements (0) Statements (0)
]]>.Value ]]>.Value
...@@ -182,7 +182,7 @@ Block[B1] - Block ...@@ -182,7 +182,7 @@ Block[B1] - Block
ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1')
Next (ProgramTermination) Block[null] Next (ProgramTermination) Block[null]
Block[B2] - Exit Block[B2] - Exit [UnReachable]
Predecessors (0) Predecessors (0)
Statements (0) Statements (0)
]]>.Value ]]>.Value
...@@ -218,7 +218,7 @@ Block[B1] - Block ...@@ -218,7 +218,7 @@ Block[B1] - Block
IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Boolean) (Syntax: 'x') IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Boolean) (Syntax: 'x')
Next (ProgramTermination) Block[null] Next (ProgramTermination) Block[null]
Block[B2] - Exit Block[B2] - Exit [UnReachable]
Predecessors (0) Predecessors (0)
Statements (0) Statements (0)
]]>.Value ]]>.Value
...@@ -276,7 +276,7 @@ Block[B3] - Block ...@@ -276,7 +276,7 @@ Block[B3] - Block
Predecessors: [B1] [B2] Predecessors: [B1] [B2]
Statements (0) Statements (0)
Next (ProgramTermination) Block[null] Next (ProgramTermination) Block[null]
Block[B4] - Exit Block[B4] - Exit [UnReachable]
Predecessors (0) Predecessors (0)
Statements (0) Statements (0)
]]>.Value ]]>.Value
...@@ -324,7 +324,7 @@ Block[B1] - Block ...@@ -324,7 +324,7 @@ Block[B1] - Block
IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Boolean) (Syntax: 'a') IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Boolean) (Syntax: 'a')
Next (ProgramTermination) Block[null] Next (ProgramTermination) Block[null]
Block[B2] - Exit Block[B2] - Exit [UnReachable]
Predecessors (0) Predecessors (0)
Statements (0) Statements (0)
]]>.Value ]]>.Value
...@@ -463,7 +463,7 @@ Block[B0] - Entry ...@@ -463,7 +463,7 @@ Block[B0] - Entry
} }
.finally {R3} .finally {R3}
{ {
Block[B2] - Block Block[B2] - Block [UnReachable]
Predecessors (0) Predecessors (0)
Statements (1) Statements (1)
IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'x = 1') IExpressionStatementOperation (OperationKind.ExpressionStatement, Type: null) (Syntax: 'x = 1')
...@@ -477,7 +477,7 @@ Block[B0] - Entry ...@@ -477,7 +477,7 @@ Block[B0] - Entry
Next (StructuredExceptionHandling) Block[null] Next (StructuredExceptionHandling) Block[null]
} }
Block[B3] - Exit Block[B3] - Exit [UnReachable]
Predecessors (0) Predecessors (0)
Statements (0) Statements (0)
]]>.Value ]]>.Value
......
...@@ -57,6 +57,7 @@ public static string GetFlowGraph(Compilation compilation, ControlFlowGraph grap ...@@ -57,6 +57,7 @@ public static string GetFlowGraph(Compilation compilation, ControlFlowGraph grap
Assert.Null(currentRegion.ExceptionType); Assert.Null(currentRegion.ExceptionType);
Assert.Empty(currentRegion.Locals); Assert.Empty(currentRegion.Locals);
Assert.Equal(ControlFlowGraph.RegionKind.Root, currentRegion.Kind); Assert.Equal(ControlFlowGraph.RegionKind.Root, currentRegion.Kind);
Assert.True(block.IsReachable);
break; break;
case BasicBlockKind.Exit: case BasicBlockKind.Exit:
...@@ -85,7 +86,7 @@ public static string GetFlowGraph(Compilation compilation, ControlFlowGraph grap ...@@ -85,7 +86,7 @@ public static string GetFlowGraph(Compilation compilation, ControlFlowGraph grap
stringBuilder.AppendLine(); stringBuilder.AppendLine();
} }
appendLine($"Block[B{i}] - {block.Kind}"); appendLine($"Block[B{i}] - {block.Kind}{(block.IsReachable ? "" : " [UnReachable]")}");
var predecessors = block.Predecessors; var predecessors = block.Predecessors;
...@@ -130,6 +131,7 @@ public static string GetFlowGraph(Compilation compilation, ControlFlowGraph grap ...@@ -130,6 +131,7 @@ public static string GetFlowGraph(Compilation compilation, ControlFlowGraph grap
Assert.Same(blocks[conditionalBranch.Destination.Ordinal], conditionalBranch.Destination); Assert.Same(blocks[conditionalBranch.Destination.Ordinal], conditionalBranch.Destination);
} }
Assert.NotEqual(BasicBlock.BranchKind.StructuredExceptionHandling, conditionalBranch.Kind);
appendLine($" Jump if {(block.Conditional.JumpIfTrue ? "True" : "False")} ({conditionalBranch.Kind}) to Block[{getDestinationString(ref conditionalBranch)}]"); appendLine($" Jump if {(block.Conditional.JumpIfTrue ? "True" : "False")} ({conditionalBranch.Kind}) to Block[{getDestinationString(ref conditionalBranch)}]");
IOperation value = block.Conditional.Condition; IOperation value = block.Conditional.Condition;
...@@ -153,6 +155,13 @@ public static string GetFlowGraph(Compilation compilation, ControlFlowGraph grap ...@@ -153,6 +155,13 @@ public static string GetFlowGraph(Compilation compilation, ControlFlowGraph grap
Assert.Same(blocks[nextBranch.Destination.Ordinal], nextBranch.Destination); Assert.Same(blocks[nextBranch.Destination.Ordinal], nextBranch.Destination);
} }
if (nextBranch.Kind == BasicBlock.BranchKind.StructuredExceptionHandling)
{
Assert.Null(nextBranch.Destination);
Assert.Equal(block.Region.LastBlockOrdinal, block.Ordinal);
Assert.True(block.Region.Kind == ControlFlowGraph.RegionKind.Filter || block.Region.Kind == ControlFlowGraph.RegionKind.Finally);
}
appendLine($" Next ({nextBranch.Kind}) Block[{getDestinationString(ref nextBranch)}]"); appendLine($" Next ({nextBranch.Kind}) Block[{getDestinationString(ref nextBranch)}]");
IOperation value = block.Next.Value; IOperation value = block.Next.Value;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册