[FIR] Create CFG for files to track top-level property initialization

In order to properly analyze top-level property initialization, a
control-flow graph must be created for FirFiles. This change adds the
foundation for the file CFG and updates body resolve to create the CFG.
Checking the CFG for proper initialization is separated into a following
change to ease code review.

KT-56683
This commit is contained in:
Brian Norman
2023-07-25 10:23:22 -05:00
committed by Space Team
parent 0b7eb32064
commit b55fda0c55
127 changed files with 19565 additions and 18746 deletions
@@ -5,56 +5,63 @@ digraph postponedLambdas_kt {
subgraph cluster_0 {
color=red
0 [label="Enter function foo" style="filled" fillcolor=red];
subgraph cluster_1 {
color=blue
1 [label="Enter block"];
2 [label="Exit block"];
}
3 [label="Exit function foo" style="filled" fillcolor=red];
0 [label="Enter file postponedLambdas.kt" style="filled" fillcolor=red];
1 [label="Exit file postponedLambdas.kt" style="filled" fillcolor=red];
}
0 -> {1};
1 -> {2};
2 -> {3};
0 -> {1} [color=green];
subgraph cluster_2 {
subgraph cluster_1 {
color=red
4 [label="Enter function test" style="filled" fillcolor=red];
subgraph cluster_3 {
2 [label="Enter function foo" style="filled" fillcolor=red];
subgraph cluster_2 {
color=blue
5 [label="Enter block"];
6 [label="Access variable R|<local>/a|"];
7 [label="Access variable R|<local>/b|"];
8 [label="Postponed enter to lambda"];
subgraph cluster_4 {
color=blue
9 [label="Enter function <anonymous>" style="filled" fillcolor=red];
subgraph cluster_5 {
color=blue
10 [label="Enter block"];
11 [label="Const: String()"];
12 [label="Exit block"];
}
13 [label="Exit function <anonymous>" style="filled" fillcolor=red];
}
14 [label="Postponed exit from lambda"];
15 [label="Function call: R|/foo|(...)" style="filled" fillcolor=yellow];
16 [label="Exit block"];
3 [label="Enter block"];
4 [label="Exit block"];
}
17 [label="Exit function test" style="filled" fillcolor=red];
5 [label="Exit function foo" style="filled" fillcolor=red];
}
2 -> {3};
3 -> {4};
4 -> {5};
5 -> {6};
subgraph cluster_3 {
color=red
6 [label="Enter function test" style="filled" fillcolor=red];
subgraph cluster_4 {
color=blue
7 [label="Enter block"];
8 [label="Access variable R|<local>/a|"];
9 [label="Access variable R|<local>/b|"];
10 [label="Postponed enter to lambda"];
subgraph cluster_5 {
color=blue
11 [label="Enter function <anonymous>" style="filled" fillcolor=red];
subgraph cluster_6 {
color=blue
12 [label="Enter block"];
13 [label="Const: String()"];
14 [label="Exit block"];
}
15 [label="Exit function <anonymous>" style="filled" fillcolor=red];
}
16 [label="Postponed exit from lambda"];
17 [label="Function call: R|/foo|(...)" style="filled" fillcolor=yellow];
18 [label="Exit block"];
}
19 [label="Exit function test" style="filled" fillcolor=red];
}
6 -> {7};
7 -> {8};
8 -> {9 14 15};
8 -> {9} [style=dashed];
8 -> {9};
9 -> {10};
10 -> {11};
10 -> {11 16 17};
10 -> {11} [style=dashed];
11 -> {12};
12 -> {13};
13 -> {14};
14 -> {15};
15 -> {16};
16 -> {17};
17 -> {18};
18 -> {19};
}