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