256 references to ControlFlowRegionKind
Microsoft.CodeAnalysis (152)
Operations\ControlFlowBranch.cs (4)
88
Debug.Assert(source.Kind !=
ControlFlowRegionKind
.Root);
142
if (leavingRegions[i].Kind ==
ControlFlowRegionKind
.Try && leavingRegions[i + 1].Kind ==
ControlFlowRegionKind
.TryAndFinally)
150
Debug.Assert(builder.Last().Kind ==
ControlFlowRegionKind
.Finally);
Operations\ControlFlowGraph.cs (2)
46
Debug.Assert(root.Kind ==
ControlFlowRegionKind
.Root);
215
/// Root (<see cref="
ControlFlowRegionKind
.Root"/>) region for the graph.
Operations\ControlFlowGraphBuilder.cs (94)
23
/// There are different kinds of regions, <see cref="
ControlFlowRegionKind
"/>.
116
var root = new RegionBuilder(
ControlFlowRegionKind
.Root);
122
builder.EnterRegion(new RegionBuilder(
ControlFlowRegionKind
.LocalLifetime));
349
Debug.Assert(region.Kind !=
ControlFlowRegionKind
.Root);
352
if (region.Kind ==
ControlFlowRegionKind
.Try && enclosing.Kind ==
ControlFlowRegionKind
.TryAndFinally)
355
Debug.Assert(enclosing.NestedRegions[1].Kind ==
ControlFlowRegionKind
.Finally);
372
Debug.Assert(@finally.Kind ==
ControlFlowRegionKind
.Finally);
407
ControlFlowRegion? enclosing = fromRegion.Kind ==
ControlFlowRegionKind
.Root ? null : fromRegion.EnclosingRegion;
408
if (fromRegion.Kind ==
ControlFlowRegionKind
.Try)
412
case
ControlFlowRegionKind
.TryAndFinally:
414
Debug.Assert(enclosing.NestedRegions[1].Kind ==
ControlFlowRegionKind
.Finally);
422
case
ControlFlowRegionKind
.TryAndCatch:
431
else if (fromRegion.Kind ==
ControlFlowRegionKind
.Filter)
434
Debug.Assert(enclosing!.Kind ==
ControlFlowRegionKind
.FilterAndHandler);
437
Debug.Assert(tryAndCatch.Kind ==
ControlFlowRegionKind
.TryAndCatch);
461
Debug.Assert(tryAndCatch.Kind ==
ControlFlowRegionKind
.TryAndCatch);
471
case
ControlFlowRegionKind
.Catch:
475
case
ControlFlowRegionKind
.FilterAndHandler:
477
Debug.Assert(@catch.NestedRegions[0].Kind ==
ControlFlowRegionKind
.Filter);
530
if (r.Kind ==
ControlFlowRegionKind
.LocalLifetime &&
541
case
ControlFlowRegionKind
.Root:
542
case
ControlFlowRegionKind
.Filter:
543
case
ControlFlowRegionKind
.Try:
544
case
ControlFlowRegionKind
.Catch:
545
case
ControlFlowRegionKind
.Finally:
546
case
ControlFlowRegionKind
.LocalLifetime:
547
case
ControlFlowRegionKind
.StaticLocalInitializer:
548
case
ControlFlowRegionKind
.ErroneousBody:
553
if (subRegion.Kind ==
ControlFlowRegionKind
.LocalLifetime && subRegion.FirstBlock == region.FirstBlock && subRegion.LastBlock == region.LastBlock)
555
Debug.Assert(region.Kind !=
ControlFlowRegionKind
.Root);
573
if (subRegion.Kind ==
ControlFlowRegionKind
.LocalLifetime && !subRegion.HasLocalFunctions &&
599
case
ControlFlowRegionKind
.TryAndCatch:
600
case
ControlFlowRegionKind
.TryAndFinally:
601
case
ControlFlowRegionKind
.FilterAndHandler:
616
Debug.Assert(subRegion.Kind !=
ControlFlowRegionKind
.Root);
730
Debug.Assert(currentRegion.Kind ==
ControlFlowRegionKind
.Filter ||
731
currentRegion.Kind ==
ControlFlowRegionKind
.Finally);
752
if (currentRegion.Kind ==
ControlFlowRegionKind
.Finally &&
759
Debug.Assert(tryAndFinally.Kind ==
ControlFlowRegionKind
.TryAndFinally);
763
Debug.Assert(@try.Kind ==
ControlFlowRegionKind
.Try);
775
@try.Kind =
ControlFlowRegionKind
.LocalLifetime;
1025
case
ControlFlowRegionKind
.Filter:
1026
case
ControlFlowRegionKind
.Catch:
1027
case
ControlFlowRegionKind
.Finally:
1386
EnterRegion(new RegionBuilder(
ControlFlowRegionKind
.LocalLifetime, locals: operation.Locals));
1484
EnterRegion(new RegionBuilder(
ControlFlowRegionKind
.LocalLifetime, locals: operation.Locals));
1524
EnterRegion(new RegionBuilder(
ControlFlowRegionKind
.ErroneousBody));
1639
var resultCaptureRegion = new RegionBuilder(
ControlFlowRegionKind
.LocalLifetime, isStackSpillRegion: true);
1835
frameOpt.RegionBuilderOpt = new RegionBuilder(
ControlFlowRegionKind
.LocalLifetime, isStackSpillRegion: true);
3559
var locals = new RegionBuilder(
ControlFlowRegionKind
.LocalLifetime, locals: operation.Locals);
3649
tryAndFinallyRegion = new RegionBuilder(
ControlFlowRegionKind
.TryAndFinally);
3651
EnterRegion(new RegionBuilder(
ControlFlowRegionKind
.Try));
3657
EnterRegion(new RegionBuilder(
ControlFlowRegionKind
.TryAndCatch));
3658
EnterRegion(new RegionBuilder(
ControlFlowRegionKind
.Try));
3661
Debug.Assert(CurrentRegionRequired.Kind ==
ControlFlowRegionKind
.Try);
3680
filterAndHandlerRegion = new RegionBuilder(
ControlFlowRegionKind
.FilterAndHandler, catchClause.ExceptionType, catchClause.Locals);
3683
var filterRegion = new RegionBuilder(
ControlFlowRegionKind
.Filter, catchClause.ExceptionType);
3699
var handlerRegion = new RegionBuilder(
ControlFlowRegionKind
.Catch, catchClause.ExceptionType,
3738
Debug.Assert(CurrentRegionRequired.Kind ==
ControlFlowRegionKind
.TryAndCatch);
3744
Debug.Assert(CurrentRegionRequired.Kind ==
ControlFlowRegionKind
.Try);
3747
var finallyRegion = new RegionBuilder(
ControlFlowRegionKind
.Finally);
3940
var usingRegion = new RegionBuilder(
ControlFlowRegionKind
.LocalLifetime, locals: locals);
4057
resourceRegion = new RegionBuilder(
ControlFlowRegionKind
.LocalLifetime);
4067
EnterRegion(new RegionBuilder(
ControlFlowRegionKind
.TryAndFinally));
4068
EnterRegion(new RegionBuilder(
ControlFlowRegionKind
.Try));
4072
Debug.Assert(CurrentRegionRequired.Kind ==
ControlFlowRegionKind
.Try);
4079
Debug.Assert(CurrentRegionRequired.Kind ==
ControlFlowRegionKind
.TryAndFinally);
4094
Debug.Assert(CurrentRegionRequired.Kind ==
ControlFlowRegionKind
.TryAndFinally);
4099
var finallyRegion = new RegionBuilder(
ControlFlowRegionKind
.Finally);
4227
var lockRegion = new RegionBuilder(
ControlFlowRegionKind
.LocalLifetime,
4278
EnterRegion(new RegionBuilder(
ControlFlowRegionKind
.TryAndFinally));
4279
EnterRegion(new RegionBuilder(
ControlFlowRegionKind
.Try));
4313
Debug.Assert(CurrentRegionRequired.Kind ==
ControlFlowRegionKind
.Try);
4321
EnterRegion(new RegionBuilder(
ControlFlowRegionKind
.Finally));
4361
Debug.Assert(CurrentRegionRequired.Kind ==
ControlFlowRegionKind
.TryAndFinally);
4376
var enumeratorCaptureRegion = new RegionBuilder(
ControlFlowRegionKind
.LocalLifetime);
4401
regionForCollection = new RegionBuilder(
ControlFlowRegionKind
.LocalLifetime, locals: ImmutableArray.Create(local));
4418
EnterRegion(new RegionBuilder(
ControlFlowRegionKind
.TryAndFinally));
4419
EnterRegion(new RegionBuilder(
ControlFlowRegionKind
.Try));
4432
var localsRegion = new RegionBuilder(
ControlFlowRegionKind
.LocalLifetime, locals: operation.Locals);
4450
Debug.Assert(_currentRegion.Kind ==
ControlFlowRegionKind
.Try);
4467
Debug.Assert(_currentRegion.Kind ==
ControlFlowRegionKind
.TryAndFinally);
4651
var loopRegion = new RegionBuilder(
ControlFlowRegionKind
.LocalLifetime, locals: locals);
5373
var switchRegion = new RegionBuilder(
ControlFlowRegionKind
.LocalLifetime, locals: locals);
5638
EnterRegion(new RegionBuilder(
ControlFlowRegionKind
.LocalLifetime, locals: operation.Locals));
5654
EnterRegion(new RegionBuilder(
ControlFlowRegionKind
.LocalLifetime, locals: operation.ConditionLocals));
5682
EnterRegion(new RegionBuilder(
ControlFlowRegionKind
.LocalLifetime, locals: operation.Locals));
5740
EnterRegion(new RegionBuilder(
ControlFlowRegionKind
.StaticLocalInitializer));
6557
var constructorRegion = new RegionBuilder(
ControlFlowRegionKind
.LocalLifetime);
6617
EnterRegion(new RegionBuilder(
ControlFlowRegionKind
.LocalLifetime));
7038
EnterRegion(new RegionBuilder(
ControlFlowRegionKind
.LocalLifetime, locals: initializer.Locals));
7484
var armScopeRegion = new RegionBuilder(
ControlFlowRegionKind
.LocalLifetime, locals: arm.Locals);
7685
var innerCaptureRegion = new RegionBuilder(
ControlFlowRegionKind
.LocalLifetime);
Operations\ControlFlowGraphBuilder.RegionBuilder.cs (25)
17
public
ControlFlowRegionKind
Kind;
31
public RegionBuilder(
ControlFlowRegionKind
kind, ITypeSymbol? exceptionType = null, ImmutableArray<ILocalSymbol> locals = default, bool isStackSpillRegion = false)
33
Debug.Assert(!isStackSpillRegion || (kind ==
ControlFlowRegionKind
.LocalLifetime && locals.IsDefaultOrEmpty));
66
Debug.Assert(Kind !=
ControlFlowRegionKind
.Root);
78
Debug.Assert(Kind !=
ControlFlowRegionKind
.Root);
97
Debug.Assert(Kind !=
ControlFlowRegionKind
.Root);
110
Debug.Assert(Kind !=
ControlFlowRegionKind
.Root);
142
ControlFlowRegionKind
lastKind = Regions.Last().Kind;
145
case
ControlFlowRegionKind
.FilterAndHandler:
147
Debug.Assert(lastKind == (Regions.Count < 2 ?
ControlFlowRegionKind
.Filter :
ControlFlowRegionKind
.Catch));
150
case
ControlFlowRegionKind
.TryAndCatch:
153
Debug.Assert(lastKind ==
ControlFlowRegionKind
.Try);
157
Debug.Assert(lastKind ==
ControlFlowRegionKind
.Catch || lastKind ==
ControlFlowRegionKind
.FilterAndHandler);
161
case
ControlFlowRegionKind
.TryAndFinally:
165
Debug.Assert(lastKind ==
ControlFlowRegionKind
.Try);
169
Debug.Assert(lastKind ==
ControlFlowRegionKind
.Finally);
174
Debug.Assert(lastKind !=
ControlFlowRegionKind
.Filter);
175
Debug.Assert(lastKind !=
ControlFlowRegionKind
.Catch);
176
Debug.Assert(lastKind !=
ControlFlowRegionKind
.Finally);
177
Debug.Assert(lastKind !=
ControlFlowRegionKind
.Try);
251
Debug.Assert((Kind !=
ControlFlowRegionKind
.FilterAndHandler &&
252
Kind !=
ControlFlowRegionKind
.TryAndCatch &&
253
Kind !=
ControlFlowRegionKind
.TryAndFinally) ||
Operations\ControlFlowRegion.cs (27)
20
public
ControlFlowRegionKind
Kind { get; }
23
/// Enclosing region. Null for <see cref="
ControlFlowRegionKind
.Root"/>
28
/// Target exception type for <see cref="
ControlFlowRegionKind
.Filter"/>, <see cref="
ControlFlowRegionKind
.Catch"/>,
29
/// <see cref="
ControlFlowRegionKind
.FilterAndHandler "/>
63
internal ControlFlowRegion(
ControlFlowRegionKind
kind, int firstBlockOrdinal, int lastBlockOrdinal,
86
Debug.Assert(r.EnclosingRegion == null && r.Kind !=
ControlFlowRegionKind
.Root);
94
case
ControlFlowRegionKind
.TryAndFinally:
95
case
ControlFlowRegionKind
.FilterAndHandler:
97
Debug.Assert(NestedRegions[0].Kind == (kind ==
ControlFlowRegionKind
.TryAndFinally ?
ControlFlowRegionKind
.Try :
ControlFlowRegionKind
.Filter));
98
Debug.Assert(NestedRegions[1].Kind == (kind ==
ControlFlowRegionKind
.TryAndFinally ?
ControlFlowRegionKind
.Finally :
ControlFlowRegionKind
.Catch));
104
case
ControlFlowRegionKind
.TryAndCatch:
106
Debug.Assert(NestedRegions[0].Kind ==
ControlFlowRegionKind
.Try);
116
Debug.Assert(r.Kind ==
ControlFlowRegionKind
.FilterAndHandler || r.Kind ==
ControlFlowRegionKind
.Catch);
122
case
ControlFlowRegionKind
.Root:
123
case
ControlFlowRegionKind
.LocalLifetime:
124
case
ControlFlowRegionKind
.Try:
125
case
ControlFlowRegionKind
.Filter:
126
case
ControlFlowRegionKind
.Catch:
127
case
ControlFlowRegionKind
.Finally:
128
case
ControlFlowRegionKind
.StaticLocalInitializer:
129
case
ControlFlowRegionKind
.ErroneousBody:
Microsoft.CodeAnalysis.CodeStyle (27)
CustomDataFlowAnalysis.cs (18)
176
if (current.EnclosingRegion.Kind ==
ControlFlowRegionKind
.Finally &&
258
Debug.Assert(region.Kind !=
ControlFlowRegionKind
.Root);
260
if (region.Kind ==
ControlFlowRegionKind
.Try && enclosing.Kind ==
ControlFlowRegionKind
.TryAndFinally)
263
Debug.Assert(enclosing.NestedRegions[1].Kind ==
ControlFlowRegionKind
.Finally);
280
Debug.Assert(@finally.Kind ==
ControlFlowRegionKind
.Finally);
319
var enclosing = fromRegion.Kind ==
ControlFlowRegionKind
.Root ? null : fromRegion.EnclosingRegion;
320
if (fromRegion.Kind ==
ControlFlowRegionKind
.Try)
324
case
ControlFlowRegionKind
.TryAndFinally:
326
Debug.Assert(enclosing.NestedRegions[1].Kind ==
ControlFlowRegionKind
.Finally);
336
case
ControlFlowRegionKind
.TryAndCatch:
345
else if (fromRegion.Kind ==
ControlFlowRegionKind
.Filter)
348
Debug.Assert(enclosing.Kind ==
ControlFlowRegionKind
.FilterAndHandler);
350
Debug.Assert(tryAndCatch.Kind ==
ControlFlowRegionKind
.TryAndCatch);
374
Debug.Assert(tryAndCatch.Kind ==
ControlFlowRegionKind
.TryAndCatch);
384
case
ControlFlowRegionKind
.Catch:
388
case
ControlFlowRegionKind
.FilterAndHandler:
390
Debug.Assert(@catch.NestedRegions[0].Kind ==
ControlFlowRegionKind
.Filter);
OperationExtensions.cs (1)
309
case
ControlFlowRegionKind
.Catch:
SymbolUsageAnalysis.DataFlowAnalyzer.cs (2)
169
if (basicBlock.EnclosingRegion.Kind ==
ControlFlowRegionKind
.Catch &&
189
if (region.Kind ==
ControlFlowRegionKind
.TryAndFinally)
SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (6)
370
case
ControlFlowRegionKind
.Catch:
371
case
ControlFlowRegionKind
.Filter:
372
case
ControlFlowRegionKind
.FilterAndHandler:
373
case
ControlFlowRegionKind
.Finally:
387
case
ControlFlowRegionKind
.TryAndCatch:
388
case
ControlFlowRegionKind
.TryAndFinally:
Microsoft.CodeAnalysis.Test.Utilities (50)
Compilation\ControlFlowGraphVerifier.cs (32)
151
Assert.Equal(
ControlFlowRegionKind
.Root, currentRegion.Kind);
297
Assert.True(block.EnclosingRegion.Kind ==
ControlFlowRegionKind
.Filter || block.EnclosingRegion.Kind ==
ControlFlowRegionKind
.Finally);
772
while (region.Kind !=
ControlFlowRegionKind
.Root)
774
if (region.Kind ==
ControlFlowRegionKind
.Try && region.EnclosingRegion.Kind ==
ControlFlowRegionKind
.TryAndFinally)
776
Debug.Assert(region.EnclosingRegion.NestedRegions[1].Kind ==
ControlFlowRegionKind
.Finally);
1458
case
ControlFlowRegionKind
.Filter:
1465
case
ControlFlowRegionKind
.Try:
1470
case
ControlFlowRegionKind
.FilterAndHandler:
1473
case
ControlFlowRegionKind
.Finally:
1477
case
ControlFlowRegionKind
.Catch:
1480
case
ControlFlowRegionKind
.FilterAndHandler:
1484
case
ControlFlowRegionKind
.TryAndCatch:
1492
case
ControlFlowRegionKind
.LocalLifetime:
1498
case
ControlFlowRegionKind
.TryAndCatch:
1499
case
ControlFlowRegionKind
.TryAndFinally:
1506
case
ControlFlowRegionKind
.StaticLocalInitializer:
1512
case
ControlFlowRegionKind
.ErroneousBody:
1556
case
ControlFlowRegionKind
.LocalLifetime:
1557
case
ControlFlowRegionKind
.Filter:
1558
case
ControlFlowRegionKind
.Try:
1559
case
ControlFlowRegionKind
.Finally:
1560
case
ControlFlowRegionKind
.FilterAndHandler:
1561
case
ControlFlowRegionKind
.StaticLocalInitializer:
1562
case
ControlFlowRegionKind
.ErroneousBody:
1566
case
ControlFlowRegionKind
.Catch:
1569
case
ControlFlowRegionKind
.FilterAndHandler:
1570
case
ControlFlowRegionKind
.TryAndCatch:
1581
goto case
ControlFlowRegionKind
.Filter;
1583
case
ControlFlowRegionKind
.TryAndCatch:
1584
case
ControlFlowRegionKind
.TryAndFinally:
CustomDataFlowAnalysis.cs (18)
176
if (current.EnclosingRegion.Kind ==
ControlFlowRegionKind
.Finally &&
258
Debug.Assert(region.Kind !=
ControlFlowRegionKind
.Root);
260
if (region.Kind ==
ControlFlowRegionKind
.Try && enclosing.Kind ==
ControlFlowRegionKind
.TryAndFinally)
263
Debug.Assert(enclosing.NestedRegions[1].Kind ==
ControlFlowRegionKind
.Finally);
280
Debug.Assert(@finally.Kind ==
ControlFlowRegionKind
.Finally);
319
var enclosing = fromRegion.Kind ==
ControlFlowRegionKind
.Root ? null : fromRegion.EnclosingRegion;
320
if (fromRegion.Kind ==
ControlFlowRegionKind
.Try)
324
case
ControlFlowRegionKind
.TryAndFinally:
326
Debug.Assert(enclosing.NestedRegions[1].Kind ==
ControlFlowRegionKind
.Finally);
336
case
ControlFlowRegionKind
.TryAndCatch:
345
else if (fromRegion.Kind ==
ControlFlowRegionKind
.Filter)
348
Debug.Assert(enclosing.Kind ==
ControlFlowRegionKind
.FilterAndHandler);
350
Debug.Assert(tryAndCatch.Kind ==
ControlFlowRegionKind
.TryAndCatch);
374
Debug.Assert(tryAndCatch.Kind ==
ControlFlowRegionKind
.TryAndCatch);
384
case
ControlFlowRegionKind
.Catch:
388
case
ControlFlowRegionKind
.FilterAndHandler:
390
Debug.Assert(@catch.NestedRegions[0].Kind ==
ControlFlowRegionKind
.Filter);
Microsoft.CodeAnalysis.Workspaces (27)
CustomDataFlowAnalysis.cs (18)
176
if (current.EnclosingRegion.Kind ==
ControlFlowRegionKind
.Finally &&
258
Debug.Assert(region.Kind !=
ControlFlowRegionKind
.Root);
260
if (region.Kind ==
ControlFlowRegionKind
.Try && enclosing.Kind ==
ControlFlowRegionKind
.TryAndFinally)
263
Debug.Assert(enclosing.NestedRegions[1].Kind ==
ControlFlowRegionKind
.Finally);
280
Debug.Assert(@finally.Kind ==
ControlFlowRegionKind
.Finally);
319
var enclosing = fromRegion.Kind ==
ControlFlowRegionKind
.Root ? null : fromRegion.EnclosingRegion;
320
if (fromRegion.Kind ==
ControlFlowRegionKind
.Try)
324
case
ControlFlowRegionKind
.TryAndFinally:
326
Debug.Assert(enclosing.NestedRegions[1].Kind ==
ControlFlowRegionKind
.Finally);
336
case
ControlFlowRegionKind
.TryAndCatch:
345
else if (fromRegion.Kind ==
ControlFlowRegionKind
.Filter)
348
Debug.Assert(enclosing.Kind ==
ControlFlowRegionKind
.FilterAndHandler);
350
Debug.Assert(tryAndCatch.Kind ==
ControlFlowRegionKind
.TryAndCatch);
374
Debug.Assert(tryAndCatch.Kind ==
ControlFlowRegionKind
.TryAndCatch);
384
case
ControlFlowRegionKind
.Catch:
388
case
ControlFlowRegionKind
.FilterAndHandler:
390
Debug.Assert(@catch.NestedRegions[0].Kind ==
ControlFlowRegionKind
.Filter);
OperationExtensions.cs (1)
309
case
ControlFlowRegionKind
.Catch:
SymbolUsageAnalysis.DataFlowAnalyzer.cs (2)
169
if (basicBlock.EnclosingRegion.Kind ==
ControlFlowRegionKind
.Catch &&
189
if (region.Kind ==
ControlFlowRegionKind
.TryAndFinally)
SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (6)
370
case
ControlFlowRegionKind
.Catch:
371
case
ControlFlowRegionKind
.Filter:
372
case
ControlFlowRegionKind
.FilterAndHandler:
373
case
ControlFlowRegionKind
.Finally:
387
case
ControlFlowRegionKind
.TryAndCatch:
388
case
ControlFlowRegionKind
.TryAndFinally: