[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
+31 -24
View File
@@ -5,37 +5,42 @@ digraph simple_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 simple.kt" style="filled" fillcolor=red];
1 [label="Exit file simple.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="Const: Int(1)"];
7 [label="Variable declaration: lval x: R|kotlin/Int|"];
8 [label="Access variable R|<local>/x|"];
9 [label="Const: Int(1)"];
10 [label="Function call: R|<local>/x|.R|kotlin/Int.plus|(...)" style="filled" fillcolor=yellow];
11 [label="Variable declaration: lval y: R|kotlin/Int|"];
12 [label="Function call: R|/foo|()" style="filled" fillcolor=yellow];
13 [label="Exit block"];
3 [label="Enter block"];
4 [label="Exit block"];
}
14 [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="Const: Int(1)"];
9 [label="Variable declaration: lval x: R|kotlin/Int|"];
10 [label="Access variable R|<local>/x|"];
11 [label="Const: Int(1)"];
12 [label="Function call: R|<local>/x|.R|kotlin/Int.plus|(...)" style="filled" fillcolor=yellow];
13 [label="Variable declaration: lval y: R|kotlin/Int|"];
14 [label="Function call: R|/foo|()" style="filled" fillcolor=yellow];
15 [label="Exit block"];
}
16 [label="Exit function test" style="filled" fillcolor=red];
}
6 -> {7};
7 -> {8};
8 -> {9};
@@ -44,5 +49,7 @@ digraph simple_kt {
11 -> {12};
12 -> {13};
13 -> {14};
14 -> {15};
15 -> {16};
}