1 instantiation of ControlFlowRegion
Microsoft.CodeAnalysis (1)
Operations\ControlFlowGraphBuilder.RegionBuilder.cs (1)
337var result = new ControlFlowRegion(Kind, FirstBlock.Ordinal, LastBlock.Ordinal, subRegions,
170 references to ControlFlowRegion
ILLink.RoslynAnalyzer (10)
DataFlow\ControlFlowGraphProxy.cs (10)
36 public readonly record struct RegionProxy (ControlFlowRegion Region) : IRegion<RegionProxy> 61 foreach (var region in branch.FinallyRegions) { 120 static bool TryGetTryOrCatchOrFilter (ControlFlowRegion? region, out RegionProxy tryOrCatchOrFilterRegion) 138 ControlFlowRegion? region = block.Block.EnclosingRegion; 159 var enclosingRegion = catchOrFilterOrFinallyRegion.Region.EnclosingRegion!; 167 foreach (var nested in enclosingRegion.NestedRegions) { 179 var region = catchOrFilterRegion.Region; 190 foreach (var nested in tryRegion.Region.EnclosingRegion!.NestedRegions) { 191 ControlFlowRegion? catchOrFilter = null; 198 foreach (var filter in nested.NestedRegions) {
Microsoft.CodeAnalysis (73)
Operations\BasicBlock.cs (2)
35ControlFlowRegion region) 132public ControlFlowRegion EnclosingRegion { get; }
Operations\ControlFlowBranch.cs (18)
18private ImmutableArray<ControlFlowRegion> _lazyLeavingRegions; 19private ImmutableArray<ControlFlowRegion> _lazyFinallyRegions; 20private ImmutableArray<ControlFlowRegion> _lazyEnteringRegions; 58public ImmutableArray<ControlFlowRegion> LeavingRegions 64ImmutableArray<ControlFlowRegion> result; 68result = ImmutableArray<ControlFlowRegion>.Empty; 82private static ArrayBuilder<ControlFlowRegion> CollectRegions(int destinationOrdinal, ControlFlowRegion source) 84var builder = ArrayBuilder<ControlFlowRegion>.GetInstance(); 101public ImmutableArray<ControlFlowRegion> EnteringRegions 107ImmutableArray<ControlFlowRegion> result; 111result = ImmutableArray<ControlFlowRegion>.Empty; 115ArrayBuilder<ControlFlowRegion> builder = CollectRegions(Source.Ordinal, Destination.EnclosingRegion); 131public ImmutableArray<ControlFlowRegion> FinallyRegions 137ArrayBuilder<ControlFlowRegion>? builder = null; 138ImmutableArray<ControlFlowRegion> leavingRegions = LeavingRegions; 146builder = ArrayBuilder<ControlFlowRegion>.GetInstance(); 154var result = builder == null ? ImmutableArray<ControlFlowRegion>.Empty : builder.ToImmutableAndFree();
Operations\ControlFlowGraph.cs (8)
27private readonly ImmutableDictionary<IMethodSymbol, (ControlFlowRegion region, ILocalFunctionOperation operation, int ordinal)> _localFunctionsMap; 29private readonly ImmutableDictionary<IFlowAnonymousFunctionOperation, (ControlFlowRegion region, int ordinal)> _anonymousFunctionsMap; 35ImmutableArray<BasicBlock> blocks, ControlFlowRegion root, 37ImmutableDictionary<IMethodSymbol, (ControlFlowRegion region, ILocalFunctionOperation operation, int ordinal)> localFunctionsMap, 38ImmutableDictionary<IFlowAnonymousFunctionOperation, (ControlFlowRegion region, int ordinal)> anonymousFunctionsMap) 217public ControlFlowRegion Root { get; } 246if (!_localFunctionsMap.TryGetValue(localFunction, out (ControlFlowRegion enclosing, ILocalFunctionOperation operation, int ordinal) info)) 295if (!_anonymousFunctionsMap.TryGetValue(anonymousFunction, out (ControlFlowRegion enclosing, int ordinal) info))
Operations\ControlFlowGraphBuilder.BasicBlockBuilder.cs (1)
33public ControlFlowRegion? Region;
Operations\ControlFlowGraphBuilder.cs (18)
87public static ControlFlowGraph Create(IOperation body, ControlFlowGraph? parent = null, ControlFlowRegion? enclosing = null, CaptureIdDispenser? captureIdDispenser = null, in Context context = default) 150var localFunctionsMap = ImmutableDictionary.CreateBuilder<IMethodSymbol, (ControlFlowRegion, ILocalFunctionOperation, int)>(); 151ImmutableDictionary<IFlowAnonymousFunctionOperation, (ControlFlowRegion, int)>.Builder? anonymousFunctionsMapOpt = null; 155anonymousFunctionsMapOpt = ImmutableDictionary.CreateBuilder<IFlowAnonymousFunctionOperation, (ControlFlowRegion, int)>(); 158ControlFlowRegion region = root.ToImmutableRegionAndFree(blocks, localFunctions, localFunctionsMap, anonymousFunctionsMapOpt, enclosing); 169anonymousFunctionsMapOpt?.ToImmutable() ?? ImmutableDictionary<IFlowAnonymousFunctionOperation, (ControlFlowRegion, int)>.Empty); 228var continueDispatchAfterFinally = PooledDictionary<ControlFlowRegion, bool>.GetInstance(); 229var dispatchedExceptionsFromRegions = PooledHashSet<ControlFlowRegion>.GetInstance(); 244PooledDictionary<ControlFlowRegion, bool> continueDispatchAfterFinally, 245PooledHashSet<ControlFlowRegion> dispatchedExceptionsFromRegions, 344bool stepThroughFinally(ControlFlowRegion region, BasicBlockBuilder destination) 351ControlFlowRegion enclosing = region.EnclosingRegion; 370bool stepThroughSingleFinally(ControlFlowRegion @finally) 398void dispatchException([DisallowNull] ControlFlowRegion? fromRegion) 407ControlFlowRegion? enclosing = fromRegion.Kind == ControlFlowRegionKind.Root ? null : fromRegion.EnclosingRegion; 436ControlFlowRegion tryAndCatch = enclosing.EnclosingRegion; 456void dispatchExceptionThroughCatches(ControlFlowRegion tryAndCatch, int startAt) 467ControlFlowRegion @catch = tryAndCatch.NestedRegions[i];
Operations\ControlFlowGraphBuilder.RegionBuilder.cs (19)
296public ControlFlowRegion ToImmutableRegionAndFree(ArrayBuilder<BasicBlockBuilder> blocks, 298ImmutableDictionary<IMethodSymbol, (ControlFlowRegion region, ILocalFunctionOperation operation, int ordinal)>.Builder localFunctionsMap, 299ImmutableDictionary<IFlowAnonymousFunctionOperation, (ControlFlowRegion region, int ordinal)>.Builder? anonymousFunctionsMapOpt, 300ControlFlowRegion? enclosing) 317ImmutableArray<ControlFlowRegion> subRegions; 321var builder = ArrayBuilder<ControlFlowRegion>.GetInstance(Regions.Count); 332subRegions = ImmutableArray<ControlFlowRegion>.Empty; 337var result = new ControlFlowRegion(Kind, FirstBlock.Ordinal, LastBlock.Ordinal, subRegions, 354foreach (ControlFlowRegion region in subRegions) 383(ImmutableDictionary<IFlowAnonymousFunctionOperation, (ControlFlowRegion region, int ordinal)>.Builder map, ControlFlowRegion region) argument = (anonymousFunctionsMapOpt, result); 399OperationVisitor<(ImmutableDictionary<IFlowAnonymousFunctionOperation, (ControlFlowRegion region, int ordinal)>.Builder map, ControlFlowRegion region), IOperation> 405(ImmutableDictionary<IFlowAnonymousFunctionOperation, (ControlFlowRegion region, int ordinal)>.Builder map, ControlFlowRegion region) argument) 411internal override IOperation? VisitNoneOperation(IOperation operation, (ImmutableDictionary<IFlowAnonymousFunctionOperation, (ControlFlowRegion region, int ordinal)>.Builder map, ControlFlowRegion region) argument) 418(ImmutableDictionary<IFlowAnonymousFunctionOperation, (ControlFlowRegion region, int ordinal)>.Builder map, ControlFlowRegion region) argument)
Operations\ControlFlowRegion.cs (7)
25public ControlFlowRegion? EnclosingRegion { get; private set; } 46public ImmutableArray<ControlFlowRegion> NestedRegions { get; } 64ImmutableArray<ControlFlowRegion> nestedRegions, 69ControlFlowRegion? enclosingRegion) 84foreach (ControlFlowRegion r in NestedRegions) 112ControlFlowRegion r = NestedRegions[i]; 132foreach (ControlFlowRegion r in NestedRegions)
Microsoft.CodeAnalysis.CodeStyle (18)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ControlFlowRegionExtensions.cs (1)
9internal static bool ContainsBlock(this ControlFlowRegion region, int destinationOrdinal)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (1)
310var currentRegion = block.EnclosingRegion;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\CustomDataFlowAnalysis.cs (12)
34var continueDispatchAfterFinally = PooledDictionary<ControlFlowRegion, bool>.GetInstance(); 35var dispatchedExceptionsFromRegions = PooledHashSet<ControlFlowRegion>.GetInstance(); 75PooledDictionary<ControlFlowRegion, bool> continueDispatchAfterFinally, 76PooledHashSet<ControlFlowRegion> dispatchedExceptionsFromRegions, 254bool StepThroughFinally(ControlFlowRegion region, int destinationOrdinal, ref TBlockAnalysisData currentAnalysisData) 259var enclosing = region.EnclosingRegion; 278bool StepThroughSingleFinally(ControlFlowRegion @finally, ref TBlockAnalysisData currentAnalysisData) 310void DispatchException(ControlFlowRegion fromRegion) 319var enclosing = fromRegion.Kind == ControlFlowRegionKind.Root ? null : fromRegion.EnclosingRegion; 349var tryAndCatch = enclosing.EnclosingRegion; 369void DispatchExceptionThroughCatches(ControlFlowRegion tryAndCatch, int startAt) 380var @catch = tryAndCatch.NestedRegions[i];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.cs (1)
177foreach (var region in branch.LeavingRegions)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (3)
361var outermostEnclosingRegionStartingBlock = basicBlock.EnclosingRegion; 381ControlFlowRegion containingTryCatchFinallyRegion = null; 382var currentRegion = outermostEnclosingRegionStartingBlock;
Microsoft.CodeAnalysis.Test.Utilities (51)
Compilation\ControlFlowGraphVerifier.cs (38)
109ControlFlowRegion enclosing, string idSuffix, int indent, ISymbol associatedSymbol) 114ControlFlowRegion currentRegion = graph.Root; 116PooledDictionary<ControlFlowRegion, int> regionMap = buildRegionMap(); 385var regions = ArrayBuilder<ControlFlowRegion>.GetInstance(); 397foreach (ControlFlowRegion region in predecessor.EnteringRegions) 457void verifyLeftRegions(BasicBlock block, PooledHashSet<CaptureId> longLivedIds, PooledHashSet<CaptureId> referencedIds, ArrayBuilder<ControlFlowRegion> regions, Func<string> finalGraph) 462ControlFlowRegion region = block.EnclosingRegion; 501foreach (ControlFlowRegion region in regions) 534bool isWithStatementTargetCapture(ControlFlowRegion region, BasicBlock block, CaptureId id) 561bool isConditionalXMLAccessReceiverCapture(ControlFlowRegion region, BasicBlock block, CaptureId id) 600bool isSwitchTargetCapture(ControlFlowRegion region, BasicBlock block, CaptureId id) 643bool isForEachEnumeratorCapture(ControlFlowRegion region, BasicBlock block, CaptureId id) 681bool isAggregateGroupCapture(IOperation operation, ControlFlowRegion region, BasicBlock block, CaptureId id) 721foreach (ControlFlowRegion region in branch.LeavingRegions) 732ControlFlowRegion region = branch.Source.EnclosingRegion; 746foreach (ControlFlowRegion @finally in branch.FinallyRegions) 1011bool isLongLivedCaptureReference(IFlowCaptureReferenceOperation reference, ControlFlowRegion region) 1023ControlFlowRegion region = graph.Root.EnclosingRegion; 1038bool isConditionalAccessCaptureUsedAfterNullCheck(IOperation operation, ControlFlowRegion region, BasicBlock block, CaptureId id) 1303IEnumerable<IFlowCaptureOperation> getFlowCaptureOperationsFromBlocksInRegion(ControlFlowRegion region, int lastBlockOrdinal) 1318IEnumerable<IFlowCaptureReferenceOperation> getFlowCaptureReferenceOperationsInRegion(ControlFlowRegion region, int firstBlockOrdinal) 1347PooledObjects.PooledDictionary<ControlFlowRegion, int> buildRegionMap() 1349var result = PooledObjects.PooledDictionary<ControlFlowRegion, int>.GetInstance(); 1353void visit(ControlFlowRegion region) 1357foreach (ControlFlowRegion r in region.NestedRegions) 1377void printLocals(ControlFlowRegion region) 1413void enterRegions(ControlFlowRegion region, int firstBlockOrdinal) 1506void leaveRegions(ControlFlowRegion region, int lastBlockOrdinal) 1590ControlFlowRegion remainedIn1 = fromBlock.EnclosingRegion; 1594foreach (ControlFlowRegion r in branch.LeavingRegions) 1601ControlFlowRegion remainedIn2 = branch.Destination.EnclosingRegion; 1607ControlFlowRegion r = branch.EnteringRegions[j]; 1615string buildList(ImmutableArray<ControlFlowRegion> list) 1619foreach (ControlFlowRegion r in list) 1661ControlFlowRegion region = block.EnclosingRegion; 1774string getRegionId(ControlFlowRegion region) 1798private readonly ControlFlowRegion _region; 1803public OperationTreeSerializer(ControlFlowGraph graph, ControlFlowRegion region, string idSuffix,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ControlFlowRegionExtensions.cs (1)
9internal static bool ContainsBlock(this ControlFlowRegion region, int destinationOrdinal)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\CustomDataFlowAnalysis.cs (12)
34var continueDispatchAfterFinally = PooledDictionary<ControlFlowRegion, bool>.GetInstance(); 35var dispatchedExceptionsFromRegions = PooledHashSet<ControlFlowRegion>.GetInstance(); 75PooledDictionary<ControlFlowRegion, bool> continueDispatchAfterFinally, 76PooledHashSet<ControlFlowRegion> dispatchedExceptionsFromRegions, 254bool StepThroughFinally(ControlFlowRegion region, int destinationOrdinal, ref TBlockAnalysisData currentAnalysisData) 259var enclosing = region.EnclosingRegion; 278bool StepThroughSingleFinally(ControlFlowRegion @finally, ref TBlockAnalysisData currentAnalysisData) 310void DispatchException(ControlFlowRegion fromRegion) 319var enclosing = fromRegion.Kind == ControlFlowRegionKind.Root ? null : fromRegion.EnclosingRegion; 349var tryAndCatch = enclosing.EnclosingRegion; 369void DispatchExceptionThroughCatches(ControlFlowRegion tryAndCatch, int startAt) 380var @catch = tryAndCatch.NestedRegions[i];
Microsoft.CodeAnalysis.Workspaces (18)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ControlFlowRegionExtensions.cs (1)
9internal static bool ContainsBlock(this ControlFlowRegion region, int destinationOrdinal)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (1)
310var currentRegion = block.EnclosingRegion;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\CustomDataFlowAnalysis.cs (12)
34var continueDispatchAfterFinally = PooledDictionary<ControlFlowRegion, bool>.GetInstance(); 35var dispatchedExceptionsFromRegions = PooledHashSet<ControlFlowRegion>.GetInstance(); 75PooledDictionary<ControlFlowRegion, bool> continueDispatchAfterFinally, 76PooledHashSet<ControlFlowRegion> dispatchedExceptionsFromRegions, 254bool StepThroughFinally(ControlFlowRegion region, int destinationOrdinal, ref TBlockAnalysisData currentAnalysisData) 259var enclosing = region.EnclosingRegion; 278bool StepThroughSingleFinally(ControlFlowRegion @finally, ref TBlockAnalysisData currentAnalysisData) 310void DispatchException(ControlFlowRegion fromRegion) 319var enclosing = fromRegion.Kind == ControlFlowRegionKind.Root ? null : fromRegion.EnclosingRegion; 349var tryAndCatch = enclosing.EnclosingRegion; 369void DispatchExceptionThroughCatches(ControlFlowRegion tryAndCatch, int startAt) 380var @catch = tryAndCatch.NestedRegions[i];
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.cs (1)
177foreach (var region in branch.LeavingRegions)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (3)
361var outermostEnclosingRegionStartingBlock = basicBlock.EnclosingRegion; 381ControlFlowRegion containingTryCatchFinallyRegion = null; 382var currentRegion = outermostEnclosingRegionStartingBlock;