[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:
+62
-55
@@ -5,88 +5,95 @@ digraph secondaryConstructorCfg_kt {
|
||||
|
||||
subgraph cluster_0 {
|
||||
color=red
|
||||
0 [label="Enter class B" style="filled" fillcolor=red];
|
||||
subgraph cluster_1 {
|
||||
0 [label="Enter file secondaryConstructorCfg.kt" style="filled" fillcolor=red];
|
||||
1 [label="Exit file secondaryConstructorCfg.kt" style="filled" fillcolor=red];
|
||||
}
|
||||
0 -> {1} [color=green];
|
||||
|
||||
subgraph cluster_1 {
|
||||
color=red
|
||||
2 [label="Enter class B" style="filled" fillcolor=red];
|
||||
subgraph cluster_2 {
|
||||
color=blue
|
||||
1 [label="Enter function <init>" style="filled" fillcolor=red];
|
||||
2 [label="Access variable R|<local>/p0|"];
|
||||
3 [label="Delegated constructor call: this<R|B|>(...)" style="filled" fillcolor=yellow];
|
||||
subgraph cluster_2 {
|
||||
color=blue
|
||||
4 [label="Enter property" style="filled" fillcolor=red];
|
||||
5 [label="Access variable R|<local>/p0|"];
|
||||
6 [label="Exit property" style="filled" fillcolor=red];
|
||||
}
|
||||
3 [label="Enter function <init>" style="filled" fillcolor=red];
|
||||
4 [label="Access variable R|<local>/p0|"];
|
||||
5 [label="Delegated constructor call: this<R|B|>(...)" style="filled" fillcolor=yellow];
|
||||
subgraph cluster_3 {
|
||||
color=blue
|
||||
7 [label="Enter property" style="filled" fillcolor=red];
|
||||
8 [label="Access variable R|<local>/p0|"];
|
||||
9 [label="Access variable R|kotlin/String.length|"];
|
||||
10 [label="Exit property" style="filled" fillcolor=red];
|
||||
6 [label="Enter property" style="filled" fillcolor=red];
|
||||
7 [label="Access variable R|<local>/p0|"];
|
||||
8 [label="Exit property" style="filled" fillcolor=red];
|
||||
}
|
||||
subgraph cluster_4 {
|
||||
color=blue
|
||||
11 [label="Enter init block" style="filled" fillcolor=red];
|
||||
subgraph cluster_5 {
|
||||
color=blue
|
||||
12 [label="Enter block"];
|
||||
13 [label="Access variable R|<local>/p0|"];
|
||||
14 [label="Access variable R|kotlin/String.length|"];
|
||||
15 [label="Assignment: R|/B.p1|"];
|
||||
16 [label="Const: String()"];
|
||||
17 [label="Assignment: R|/B.p3|"];
|
||||
18 [label="Exit block"];
|
||||
}
|
||||
19 [label="Exit init block" style="filled" fillcolor=red];
|
||||
9 [label="Enter property" style="filled" fillcolor=red];
|
||||
10 [label="Access variable R|<local>/p0|"];
|
||||
11 [label="Access variable R|kotlin/String.length|"];
|
||||
12 [label="Exit property" style="filled" fillcolor=red];
|
||||
}
|
||||
subgraph cluster_6 {
|
||||
subgraph cluster_5 {
|
||||
color=blue
|
||||
20 [label="Enter function <init>" style="filled" fillcolor=red];
|
||||
21 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
|
||||
22 [label="Exit function <init>" style="filled" fillcolor=red];
|
||||
13 [label="Enter init block" style="filled" fillcolor=red];
|
||||
subgraph cluster_6 {
|
||||
color=blue
|
||||
14 [label="Enter block"];
|
||||
15 [label="Access variable R|<local>/p0|"];
|
||||
16 [label="Access variable R|kotlin/String.length|"];
|
||||
17 [label="Assignment: R|/B.p1|"];
|
||||
18 [label="Const: String()"];
|
||||
19 [label="Assignment: R|/B.p3|"];
|
||||
20 [label="Exit block"];
|
||||
}
|
||||
21 [label="Exit init block" style="filled" fillcolor=red];
|
||||
}
|
||||
subgraph cluster_7 {
|
||||
color=blue
|
||||
23 [label="Enter block"];
|
||||
24 [label="Access variable R|<local>/p1|"];
|
||||
25 [label="Assignment: R|/B.p3|"];
|
||||
26 [label="Exit block"];
|
||||
22 [label="Enter function <init>" style="filled" fillcolor=red];
|
||||
23 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
|
||||
24 [label="Exit function <init>" style="filled" fillcolor=red];
|
||||
}
|
||||
27 [label="Exit function <init>" style="filled" fillcolor=red];
|
||||
subgraph cluster_8 {
|
||||
color=blue
|
||||
25 [label="Enter block"];
|
||||
26 [label="Access variable R|<local>/p1|"];
|
||||
27 [label="Assignment: R|/B.p3|"];
|
||||
28 [label="Exit block"];
|
||||
}
|
||||
29 [label="Exit function <init>" style="filled" fillcolor=red];
|
||||
}
|
||||
28 [label="Exit class B" style="filled" fillcolor=red];
|
||||
30 [label="Exit class B" style="filled" fillcolor=red];
|
||||
}
|
||||
0 -> {1 4} [color=green];
|
||||
0 -> {28} [style=dotted];
|
||||
0 -> {1 4 7 11 20} [style=dashed];
|
||||
1 -> {2};
|
||||
2 -> {3};
|
||||
3 -> {4} [color=green label="return@/B.B"];
|
||||
3 -> {23} [color=red];
|
||||
2 -> {3 6} [color=green];
|
||||
2 -> {30} [style=dotted];
|
||||
2 -> {3 6 9 13 22} [style=dashed];
|
||||
3 -> {4};
|
||||
4 -> {5};
|
||||
5 -> {6};
|
||||
6 -> {7} [color=green];
|
||||
5 -> {6} [color=green label="return@/B.B"];
|
||||
5 -> {25} [color=red];
|
||||
6 -> {7};
|
||||
7 -> {8};
|
||||
8 -> {9};
|
||||
8 -> {9} [color=green];
|
||||
9 -> {10};
|
||||
10 -> {11} [color=green];
|
||||
10 -> {11};
|
||||
11 -> {12};
|
||||
12 -> {13};
|
||||
12 -> {13} [color=green];
|
||||
13 -> {14};
|
||||
14 -> {15};
|
||||
15 -> {16};
|
||||
16 -> {17};
|
||||
17 -> {18};
|
||||
18 -> {19};
|
||||
19 -> {20} [color=green];
|
||||
19 -> {20};
|
||||
20 -> {21};
|
||||
21 -> {22};
|
||||
22 -> {23} [color=green label="return@/B.B"];
|
||||
22 -> {28} [color=green];
|
||||
21 -> {22} [color=green];
|
||||
22 -> {23};
|
||||
23 -> {24};
|
||||
24 -> {25};
|
||||
24 -> {25} [color=green label="return@/B.B"];
|
||||
24 -> {30} [color=green];
|
||||
25 -> {26};
|
||||
26 -> {27};
|
||||
27 -> {28} [color=green];
|
||||
27 -> {28};
|
||||
28 -> {29};
|
||||
29 -> {30} [color=green];
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user