282 references to ControlFlowRegionKind
ILLink.RoslynAnalyzer (26)
DataFlow\ControlFlowGraphProxy.cs (26)
39 ControlFlowRegionKind.Try => RegionKind.Try, 40 ControlFlowRegionKind.Catch => RegionKind.Catch, 41 ControlFlowRegionKind.Filter => RegionKind.Filter, 42 ControlFlowRegionKind.Finally => RegionKind.Finally, 125 while (region != null && region.Kind != ControlFlowRegionKind.Root) { 126 if (region.Kind is ControlFlowRegionKind.Try or ControlFlowRegionKind.Catch or ControlFlowRegionKind.Filter) { 141 while (region != null && region.Kind != ControlFlowRegionKind.Root) { 142 if (region.Kind == ControlFlowRegionKind.Finally) { 153 if (catchOrFilterOrFinallyRegion.Region.Kind is not (ControlFlowRegionKind.Catch or ControlFlowRegionKind.Filter or ControlFlowRegionKind.Finally)) 161 if (enclosingRegion.Kind == ControlFlowRegionKind.FilterAndHandler) { 163 Debug.Assert (enclosingRegion.Kind == ControlFlowRegionKind.TryAndCatch); 171 if (nested.Kind == ControlFlowRegionKind.Try) 180 if (region.Kind is not (ControlFlowRegionKind.Catch or ControlFlowRegionKind.Filter)) 184 if (region.Kind is ControlFlowRegionKind.Catch && region.EnclosingRegion!.Kind is ControlFlowRegionKind.FilterAndHandler) 193 case ControlFlowRegionKind.Catch: 196 case ControlFlowRegionKind.FilterAndHandler: 199 if (filter.Kind == ControlFlowRegionKind.Filter) { 217 if (catchOrFilter.Kind == ControlFlowRegionKind.Filter) 225 if (catchRegion.Region.Kind is not ControlFlowRegionKind.Catch) 228 return catchRegion.Region.EnclosingRegion!.Kind == ControlFlowRegionKind.FilterAndHandler;
Microsoft.CodeAnalysis (152)
Operations\ControlFlowBranch.cs (4)
88Debug.Assert(source.Kind != ControlFlowRegionKind.Root); 142if (leavingRegions[i].Kind == ControlFlowRegionKind.Try && leavingRegions[i + 1].Kind == ControlFlowRegionKind.TryAndFinally) 150Debug.Assert(builder.Last().Kind == ControlFlowRegionKind.Finally);
Operations\ControlFlowGraph.cs (2)
46Debug.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"/>. 116var root = new RegionBuilder(ControlFlowRegionKind.Root); 122builder.EnterRegion(new RegionBuilder(ControlFlowRegionKind.LocalLifetime)); 349Debug.Assert(region.Kind != ControlFlowRegionKind.Root); 352if (region.Kind == ControlFlowRegionKind.Try && enclosing.Kind == ControlFlowRegionKind.TryAndFinally) 355Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 372Debug.Assert(@finally.Kind == ControlFlowRegionKind.Finally); 407ControlFlowRegion? enclosing = fromRegion.Kind == ControlFlowRegionKind.Root ? null : fromRegion.EnclosingRegion; 408if (fromRegion.Kind == ControlFlowRegionKind.Try) 412case ControlFlowRegionKind.TryAndFinally: 414Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 422case ControlFlowRegionKind.TryAndCatch: 431else if (fromRegion.Kind == ControlFlowRegionKind.Filter) 434Debug.Assert(enclosing!.Kind == ControlFlowRegionKind.FilterAndHandler); 437Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 461Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 471case ControlFlowRegionKind.Catch: 475case ControlFlowRegionKind.FilterAndHandler: 477Debug.Assert(@catch.NestedRegions[0].Kind == ControlFlowRegionKind.Filter); 530if (r.Kind == ControlFlowRegionKind.LocalLifetime && 541case ControlFlowRegionKind.Root: 542case ControlFlowRegionKind.Filter: 543case ControlFlowRegionKind.Try: 544case ControlFlowRegionKind.Catch: 545case ControlFlowRegionKind.Finally: 546case ControlFlowRegionKind.LocalLifetime: 547case ControlFlowRegionKind.StaticLocalInitializer: 548case ControlFlowRegionKind.ErroneousBody: 553if (subRegion.Kind == ControlFlowRegionKind.LocalLifetime && subRegion.FirstBlock == region.FirstBlock && subRegion.LastBlock == region.LastBlock) 555Debug.Assert(region.Kind != ControlFlowRegionKind.Root); 573if (subRegion.Kind == ControlFlowRegionKind.LocalLifetime && !subRegion.HasLocalFunctions && 599case ControlFlowRegionKind.TryAndCatch: 600case ControlFlowRegionKind.TryAndFinally: 601case ControlFlowRegionKind.FilterAndHandler: 616Debug.Assert(subRegion.Kind != ControlFlowRegionKind.Root); 730Debug.Assert(currentRegion.Kind == ControlFlowRegionKind.Filter || 731currentRegion.Kind == ControlFlowRegionKind.Finally); 752if (currentRegion.Kind == ControlFlowRegionKind.Finally && 759Debug.Assert(tryAndFinally.Kind == ControlFlowRegionKind.TryAndFinally); 763Debug.Assert(@try.Kind == ControlFlowRegionKind.Try); 775@try.Kind = ControlFlowRegionKind.LocalLifetime; 1025case ControlFlowRegionKind.Filter: 1026case ControlFlowRegionKind.Catch: 1027case ControlFlowRegionKind.Finally: 1386EnterRegion(new RegionBuilder(ControlFlowRegionKind.LocalLifetime, locals: operation.Locals)); 1484EnterRegion(new RegionBuilder(ControlFlowRegionKind.LocalLifetime, locals: operation.Locals)); 1524EnterRegion(new RegionBuilder(ControlFlowRegionKind.ErroneousBody)); 1645var resultCaptureRegion = new RegionBuilder(ControlFlowRegionKind.LocalLifetime, isStackSpillRegion: true); 1841frameOpt.RegionBuilderOpt = new RegionBuilder(ControlFlowRegionKind.LocalLifetime, isStackSpillRegion: true); 3576var locals = new RegionBuilder(ControlFlowRegionKind.LocalLifetime, locals: operation.Locals); 3666tryAndFinallyRegion = new RegionBuilder(ControlFlowRegionKind.TryAndFinally); 3668EnterRegion(new RegionBuilder(ControlFlowRegionKind.Try)); 3674EnterRegion(new RegionBuilder(ControlFlowRegionKind.TryAndCatch)); 3675EnterRegion(new RegionBuilder(ControlFlowRegionKind.Try)); 3678Debug.Assert(CurrentRegionRequired.Kind == ControlFlowRegionKind.Try); 3697filterAndHandlerRegion = new RegionBuilder(ControlFlowRegionKind.FilterAndHandler, catchClause.ExceptionType, catchClause.Locals); 3700var filterRegion = new RegionBuilder(ControlFlowRegionKind.Filter, catchClause.ExceptionType); 3716var handlerRegion = new RegionBuilder(ControlFlowRegionKind.Catch, catchClause.ExceptionType, 3755Debug.Assert(CurrentRegionRequired.Kind == ControlFlowRegionKind.TryAndCatch); 3761Debug.Assert(CurrentRegionRequired.Kind == ControlFlowRegionKind.Try); 3764var finallyRegion = new RegionBuilder(ControlFlowRegionKind.Finally); 3958var usingRegion = new RegionBuilder(ControlFlowRegionKind.LocalLifetime, locals: locals); 4077resourceRegion = new RegionBuilder(ControlFlowRegionKind.LocalLifetime); 4087EnterRegion(new RegionBuilder(ControlFlowRegionKind.TryAndFinally)); 4088EnterRegion(new RegionBuilder(ControlFlowRegionKind.Try)); 4092Debug.Assert(CurrentRegionRequired.Kind == ControlFlowRegionKind.Try); 4099Debug.Assert(CurrentRegionRequired.Kind == ControlFlowRegionKind.TryAndFinally); 4114Debug.Assert(CurrentRegionRequired.Kind == ControlFlowRegionKind.TryAndFinally); 4120var finallyRegion = new RegionBuilder(ControlFlowRegionKind.Finally); 4308var lockRegion = new RegionBuilder(ControlFlowRegionKind.LocalLifetime, 4359EnterRegion(new RegionBuilder(ControlFlowRegionKind.TryAndFinally)); 4360EnterRegion(new RegionBuilder(ControlFlowRegionKind.Try)); 4394Debug.Assert(CurrentRegionRequired.Kind == ControlFlowRegionKind.Try); 4402EnterRegion(new RegionBuilder(ControlFlowRegionKind.Finally)); 4442Debug.Assert(CurrentRegionRequired.Kind == ControlFlowRegionKind.TryAndFinally); 4457var enumeratorCaptureRegion = new RegionBuilder(ControlFlowRegionKind.LocalLifetime); 4482regionForCollection = new RegionBuilder(ControlFlowRegionKind.LocalLifetime, locals: ImmutableArray.Create(local)); 4499EnterRegion(new RegionBuilder(ControlFlowRegionKind.TryAndFinally)); 4500EnterRegion(new RegionBuilder(ControlFlowRegionKind.Try)); 4513var localsRegion = new RegionBuilder(ControlFlowRegionKind.LocalLifetime, locals: operation.Locals); 4531Debug.Assert(_currentRegion.Kind == ControlFlowRegionKind.Try); 4548Debug.Assert(_currentRegion.Kind == ControlFlowRegionKind.TryAndFinally); 4748var loopRegion = new RegionBuilder(ControlFlowRegionKind.LocalLifetime, locals: locals); 5470var switchRegion = new RegionBuilder(ControlFlowRegionKind.LocalLifetime, locals: locals); 5735EnterRegion(new RegionBuilder(ControlFlowRegionKind.LocalLifetime, locals: operation.Locals)); 5751EnterRegion(new RegionBuilder(ControlFlowRegionKind.LocalLifetime, locals: operation.ConditionLocals)); 5779EnterRegion(new RegionBuilder(ControlFlowRegionKind.LocalLifetime, locals: operation.Locals)); 5837EnterRegion(new RegionBuilder(ControlFlowRegionKind.StaticLocalInitializer)); 6795var constructorRegion = new RegionBuilder(ControlFlowRegionKind.LocalLifetime); 6855EnterRegion(new RegionBuilder(ControlFlowRegionKind.LocalLifetime)); 7276EnterRegion(new RegionBuilder(ControlFlowRegionKind.LocalLifetime, locals: initializer.Locals)); 7750var armScopeRegion = new RegionBuilder(ControlFlowRegionKind.LocalLifetime, locals: arm.Locals); 7951var innerCaptureRegion = new RegionBuilder(ControlFlowRegionKind.LocalLifetime);
Operations\ControlFlowGraphBuilder.RegionBuilder.cs (25)
17public ControlFlowRegionKind Kind; 31public RegionBuilder(ControlFlowRegionKind kind, ITypeSymbol? exceptionType = null, ImmutableArray<ILocalSymbol> locals = default, bool isStackSpillRegion = false) 33Debug.Assert(!isStackSpillRegion || (kind == ControlFlowRegionKind.LocalLifetime && locals.IsDefaultOrEmpty)); 66Debug.Assert(Kind != ControlFlowRegionKind.Root); 78Debug.Assert(Kind != ControlFlowRegionKind.Root); 97Debug.Assert(Kind != ControlFlowRegionKind.Root); 110Debug.Assert(Kind != ControlFlowRegionKind.Root); 142ControlFlowRegionKind lastKind = Regions.Last().Kind; 145case ControlFlowRegionKind.FilterAndHandler: 147Debug.Assert(lastKind == (Regions.Count < 2 ? ControlFlowRegionKind.Filter : ControlFlowRegionKind.Catch)); 150case ControlFlowRegionKind.TryAndCatch: 153Debug.Assert(lastKind == ControlFlowRegionKind.Try); 157Debug.Assert(lastKind == ControlFlowRegionKind.Catch || lastKind == ControlFlowRegionKind.FilterAndHandler); 161case ControlFlowRegionKind.TryAndFinally: 165Debug.Assert(lastKind == ControlFlowRegionKind.Try); 169Debug.Assert(lastKind == ControlFlowRegionKind.Finally); 174Debug.Assert(lastKind != ControlFlowRegionKind.Filter); 175Debug.Assert(lastKind != ControlFlowRegionKind.Catch); 176Debug.Assert(lastKind != ControlFlowRegionKind.Finally); 177Debug.Assert(lastKind != ControlFlowRegionKind.Try); 251Debug.Assert((Kind != ControlFlowRegionKind.FilterAndHandler && 252Kind != ControlFlowRegionKind.TryAndCatch && 253Kind != ControlFlowRegionKind.TryAndFinally) ||
Operations\ControlFlowRegion.cs (27)
20public 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 "/> 63internal ControlFlowRegion(ControlFlowRegionKind kind, int firstBlockOrdinal, int lastBlockOrdinal, 86Debug.Assert(r.EnclosingRegion == null && r.Kind != ControlFlowRegionKind.Root); 94case ControlFlowRegionKind.TryAndFinally: 95case ControlFlowRegionKind.FilterAndHandler: 97Debug.Assert(NestedRegions[0].Kind == (kind == ControlFlowRegionKind.TryAndFinally ? ControlFlowRegionKind.Try : ControlFlowRegionKind.Filter)); 98Debug.Assert(NestedRegions[1].Kind == (kind == ControlFlowRegionKind.TryAndFinally ? ControlFlowRegionKind.Finally : ControlFlowRegionKind.Catch)); 104case ControlFlowRegionKind.TryAndCatch: 106Debug.Assert(NestedRegions[0].Kind == ControlFlowRegionKind.Try); 116Debug.Assert(r.Kind == ControlFlowRegionKind.FilterAndHandler || r.Kind == ControlFlowRegionKind.Catch); 122case ControlFlowRegionKind.Root: 123case ControlFlowRegionKind.LocalLifetime: 124case ControlFlowRegionKind.Try: 125case ControlFlowRegionKind.Filter: 126case ControlFlowRegionKind.Catch: 127case ControlFlowRegionKind.Finally: 128case ControlFlowRegionKind.StaticLocalInitializer: 129case ControlFlowRegionKind.ErroneousBody:
Microsoft.CodeAnalysis.CodeStyle (27)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (1)
315case ControlFlowRegionKind.Catch:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\CustomDataFlowAnalysis.cs (18)
176if (current.EnclosingRegion.Kind == ControlFlowRegionKind.Finally && 258Debug.Assert(region.Kind != ControlFlowRegionKind.Root); 260if (region.Kind == ControlFlowRegionKind.Try && enclosing.Kind == ControlFlowRegionKind.TryAndFinally) 263Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 280Debug.Assert(@finally.Kind == ControlFlowRegionKind.Finally); 319var enclosing = fromRegion.Kind == ControlFlowRegionKind.Root ? null : fromRegion.EnclosingRegion; 320if (fromRegion.Kind == ControlFlowRegionKind.Try) 324case ControlFlowRegionKind.TryAndFinally: 326Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 336case ControlFlowRegionKind.TryAndCatch: 345else if (fromRegion.Kind == ControlFlowRegionKind.Filter) 348Debug.Assert(enclosing.Kind == ControlFlowRegionKind.FilterAndHandler); 350Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 374Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 384case ControlFlowRegionKind.Catch: 388case ControlFlowRegionKind.FilterAndHandler: 390Debug.Assert(@catch.NestedRegions[0].Kind == ControlFlowRegionKind.Filter);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.cs (2)
169if (basicBlock.EnclosingRegion.Kind == ControlFlowRegionKind.Catch && 189if (region.Kind == ControlFlowRegionKind.TryAndFinally)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (6)
370case ControlFlowRegionKind.Catch: 371case ControlFlowRegionKind.Filter: 372case ControlFlowRegionKind.FilterAndHandler: 373case ControlFlowRegionKind.Finally: 387case ControlFlowRegionKind.TryAndCatch: 388case ControlFlowRegionKind.TryAndFinally:
Microsoft.CodeAnalysis.Test.Utilities (50)
Compilation\ControlFlowGraphVerifier.cs (32)
151Assert.Equal(ControlFlowRegionKind.Root, currentRegion.Kind); 297Assert.True(block.EnclosingRegion.Kind == ControlFlowRegionKind.Filter || block.EnclosingRegion.Kind == ControlFlowRegionKind.Finally); 734while (region.Kind != ControlFlowRegionKind.Root) 736if (region.Kind == ControlFlowRegionKind.Try && region.EnclosingRegion.Kind == ControlFlowRegionKind.TryAndFinally) 738Debug.Assert(region.EnclosingRegion.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 1433case ControlFlowRegionKind.Filter: 1440case ControlFlowRegionKind.Try: 1445case ControlFlowRegionKind.FilterAndHandler: 1448case ControlFlowRegionKind.Finally: 1452case ControlFlowRegionKind.Catch: 1455case ControlFlowRegionKind.FilterAndHandler: 1459case ControlFlowRegionKind.TryAndCatch: 1467case ControlFlowRegionKind.LocalLifetime: 1473case ControlFlowRegionKind.TryAndCatch: 1474case ControlFlowRegionKind.TryAndFinally: 1481case ControlFlowRegionKind.StaticLocalInitializer: 1487case ControlFlowRegionKind.ErroneousBody: 1531case ControlFlowRegionKind.LocalLifetime: 1532case ControlFlowRegionKind.Filter: 1533case ControlFlowRegionKind.Try: 1534case ControlFlowRegionKind.Finally: 1535case ControlFlowRegionKind.FilterAndHandler: 1536case ControlFlowRegionKind.StaticLocalInitializer: 1537case ControlFlowRegionKind.ErroneousBody: 1541case ControlFlowRegionKind.Catch: 1544case ControlFlowRegionKind.FilterAndHandler: 1545case ControlFlowRegionKind.TryAndCatch: 1556goto case ControlFlowRegionKind.Filter; 1558case ControlFlowRegionKind.TryAndCatch: 1559case ControlFlowRegionKind.TryAndFinally:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\CustomDataFlowAnalysis.cs (18)
176if (current.EnclosingRegion.Kind == ControlFlowRegionKind.Finally && 258Debug.Assert(region.Kind != ControlFlowRegionKind.Root); 260if (region.Kind == ControlFlowRegionKind.Try && enclosing.Kind == ControlFlowRegionKind.TryAndFinally) 263Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 280Debug.Assert(@finally.Kind == ControlFlowRegionKind.Finally); 319var enclosing = fromRegion.Kind == ControlFlowRegionKind.Root ? null : fromRegion.EnclosingRegion; 320if (fromRegion.Kind == ControlFlowRegionKind.Try) 324case ControlFlowRegionKind.TryAndFinally: 326Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 336case ControlFlowRegionKind.TryAndCatch: 345else if (fromRegion.Kind == ControlFlowRegionKind.Filter) 348Debug.Assert(enclosing.Kind == ControlFlowRegionKind.FilterAndHandler); 350Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 374Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 384case ControlFlowRegionKind.Catch: 388case ControlFlowRegionKind.FilterAndHandler: 390Debug.Assert(@catch.NestedRegions[0].Kind == ControlFlowRegionKind.Filter);
Microsoft.CodeAnalysis.Workspaces (27)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (1)
315case ControlFlowRegionKind.Catch:
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\CustomDataFlowAnalysis.cs (18)
176if (current.EnclosingRegion.Kind == ControlFlowRegionKind.Finally && 258Debug.Assert(region.Kind != ControlFlowRegionKind.Root); 260if (region.Kind == ControlFlowRegionKind.Try && enclosing.Kind == ControlFlowRegionKind.TryAndFinally) 263Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 280Debug.Assert(@finally.Kind == ControlFlowRegionKind.Finally); 319var enclosing = fromRegion.Kind == ControlFlowRegionKind.Root ? null : fromRegion.EnclosingRegion; 320if (fromRegion.Kind == ControlFlowRegionKind.Try) 324case ControlFlowRegionKind.TryAndFinally: 326Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 336case ControlFlowRegionKind.TryAndCatch: 345else if (fromRegion.Kind == ControlFlowRegionKind.Filter) 348Debug.Assert(enclosing.Kind == ControlFlowRegionKind.FilterAndHandler); 350Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 374Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 384case ControlFlowRegionKind.Catch: 388case ControlFlowRegionKind.FilterAndHandler: 390Debug.Assert(@catch.NestedRegions[0].Kind == ControlFlowRegionKind.Filter);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.cs (2)
169if (basicBlock.EnclosingRegion.Kind == ControlFlowRegionKind.Catch && 189if (region.Kind == ControlFlowRegionKind.TryAndFinally)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (6)
370case ControlFlowRegionKind.Catch: 371case ControlFlowRegionKind.Filter: 372case ControlFlowRegionKind.FilterAndHandler: 373case ControlFlowRegionKind.Finally: 387case ControlFlowRegionKind.TryAndCatch: 388case ControlFlowRegionKind.TryAndFinally: