1 instantiation of ControlFlowRegion
Microsoft.CodeAnalysis (1)
275 references to ControlFlowRegion
GenerateDocumentationAndConfigFiles (18)
ILLink.RoslynAnalyzer (10)
Microsoft.CodeAnalysis (73)
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.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);
236var continueDispatchAfterFinally = PooledDictionary<ControlFlowRegion, bool>.GetInstance();
237var dispatchedExceptionsFromRegions = PooledHashSet<ControlFlowRegion>.GetInstance();
252PooledDictionary<ControlFlowRegion, bool> continueDispatchAfterFinally,
253PooledHashSet<ControlFlowRegion> dispatchedExceptionsFromRegions,
352bool stepThroughFinally(ControlFlowRegion region, BasicBlockBuilder destination)
359ControlFlowRegion enclosing = region.EnclosingRegion;
378bool stepThroughSingleFinally(ControlFlowRegion @finally)
406void dispatchException([DisallowNull] ControlFlowRegion? fromRegion)
415ControlFlowRegion? enclosing = fromRegion.Kind == ControlFlowRegionKind.Root ? null : fromRegion.EnclosingRegion;
444ControlFlowRegion tryAndCatch = enclosing.EnclosingRegion;
464void dispatchExceptionThroughCatches(ControlFlowRegion tryAndCatch, int startAt)
475ControlFlowRegion @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)
Microsoft.CodeAnalysis.Analyzers (18)
Microsoft.CodeAnalysis.AnalyzerUtilities (84)
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\BranchWithInfo.cs (20)
17private static readonly Func<ControlFlowRegion, IEnumerable<ControlFlowRegion>> s_getTransitiveNestedRegions = GetTransitiveNestedRegions;
30enteringRegions: ImmutableArray<ControlFlowRegion>.Empty,
31leavingRegions: ImmutableArray<ControlFlowRegion>.Empty,
32finallyRegions: ImmutableArray<ControlFlowRegion>.Empty,
43ImmutableArray<ControlFlowRegion> enteringRegions,
44ImmutableArray<ControlFlowRegion> leavingRegions,
45ImmutableArray<ControlFlowRegion> finallyRegions,
65public ImmutableArray<ControlFlowRegion> EnteringRegions { get; }
66public ImmutableArray<ControlFlowRegion> FinallyRegions { get; }
67public ImmutableArray<ControlFlowRegion> LeavingRegions { get; }
79enteringRegions: ImmutableArray<ControlFlowRegion>.Empty,
80leavingRegions: ImmutableArray<ControlFlowRegion>.Empty,
81finallyRegions: ImmutableArray<ControlFlowRegion>.Empty,
98private static IEnumerable<ControlFlowRegion> GetTransitiveNestedRegions(ControlFlowRegion region)
102foreach (var nestedRegion in region.NestedRegions)
104foreach (var transitiveNestedRegion in GetTransitiveNestedRegions(nestedRegion))
111private static IEnumerable<ILocalSymbol> ComputeLeavingRegionLocals(ImmutableArray<ControlFlowRegion> leavingRegions)
116private static IEnumerable<CaptureId> ComputeLeavingRegionFlowCaptures(ImmutableArray<ControlFlowRegion> leavingRegions)
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\Extensions\BasicBlockExtensions.cs (13)
23var lastFinally = predecessorBranch.FinallyRegions[^1];
35var region = basicBlock.EnclosingRegion;
58public static ControlFlowRegion? GetContainingRegionOfKind(this BasicBlock basicBlock, ControlFlowRegionKind regionKind)
60var enclosingRegion = basicBlock.EnclosingRegion;
77public static bool IsFirstBlockOfFinally(this BasicBlock basicBlock, [NotNullWhen(returnValue: true)] out ControlFlowRegion? finallyRegion)
83public static bool IsLastBlockOfFinally(this BasicBlock basicBlock, [NotNullWhen(returnValue: true)] out ControlFlowRegion? finallyRegion)
89public static bool IsFirstBlockOfRegionKind(this BasicBlock basicBlock, ControlFlowRegionKind regionKind, [NotNullWhen(returnValue: true)] out ControlFlowRegion? region)
95public static bool IsLastBlockOfRegionKind(this BasicBlock basicBlock, ControlFlowRegionKind regionKind, [NotNullWhen(returnValue: true)] out ControlFlowRegion? region)
98private static bool IsFirstOrLastBlockOfRegionKind(this BasicBlock basicBlock, ControlFlowRegionKind regionKind, bool first, [NotNullWhen(returnValue: true)] out ControlFlowRegion? foundRegion)
102var enclosingRegion = basicBlock.EnclosingRegion;
128if (!basicBlock.IsFirstBlockOfRegionKind(ControlFlowRegionKind.Finally, out var finallyRegion))
144internal static ControlFlowRegion? GetInnermostRegionStartedByBlock(this BasicBlock basicBlock, ControlFlowRegionKind regionKind)
151var enclosingRegion = basicBlock.EnclosingRegion;
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\DataFlowAnalysis.cs (21)
66var catchBlockInputDataMap = PooledDictionary<ControlFlowRegion, TAnalysisData>.GetInstance();
190PooledDictionary<ControlFlowRegion, TAnalysisData> catchBlockInputDataMap,
228var finallyRegion = block.GetInnermostRegionStartedByBlock(ControlFlowRegionKind.Finally);
232var tryRegion = finallyRegion.EnclosingRegion.NestedRegions[0];
274ControlFlowRegion? enclosingTryAndCatchRegion = GetEnclosingTryAndCatchRegionIfStartsHandler(block);
349if (successorBlock.IsFirstBlockOfRegionKind(ControlFlowRegionKind.TryAndFinally, out var tryAndFinally))
351var finallyRegion = tryAndFinally.NestedRegions[1];
490static ControlFlowRegion? TryGetReachableCatchRegionStartingHandler(ControlFlowRegion tryAndCatchRegion, BasicBlock sourceBlock)
497var catchRegion = tryAndCatchRegion.NestedRegions.FirstOrDefault(region => region.Kind is ControlFlowRegionKind.Catch or ControlFlowRegionKind.FilterAndHandler);
506ControlFlowRegion? MergeIntoCatchInputData(ControlFlowRegion tryAndCatchRegion, TAnalysisData dataToMerge, BasicBlock sourceBlock)
508var catchRegion = TryGetReachableCatchRegionStartingHandler(tryAndCatchRegion, sourceBlock);
592static ControlFlowRegion? GetEnclosingTryAndCatchRegionIfStartsHandler(BasicBlock block)
654var firstFinally = branch.FinallyRegions[0];
674ControlFlowRegion finallyRegion = branch.FinallyRegions[i];
683foreach (var region in branch.LeavingRegions)
694var catchRegion = TryGetReachableCatchRegionStartingHandler(region, sourceBlock);
699ControlFlowRegion finallyRegion = branch.FinallyRegions[i];
715var catchRegion = MergeIntoCatchInputData(region, branchData, sourceBlock);
727void AddFinallySuccessor(ControlFlowRegion finallyRegion, BranchWithInfo successor)
Microsoft.CodeAnalysis.CodeStyle (18)
Microsoft.CodeAnalysis.ResxSourceGenerator (18)
Microsoft.CodeAnalysis.Workspaces (18)
Roslyn.Diagnostics.Analyzers (18)