[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:
Vendored
+71
-64
@@ -5,97 +5,102 @@ digraph smartcastFromArgument_kt {
|
||||
|
||||
subgraph cluster_0 {
|
||||
color=red
|
||||
0 [label="Enter class A" style="filled" fillcolor=red];
|
||||
1 [label="Exit class A" style="filled" fillcolor=red];
|
||||
0 [label="Enter file smartcastFromArgument.kt" style="filled" fillcolor=red];
|
||||
1 [label="Exit file smartcastFromArgument.kt" style="filled" fillcolor=red];
|
||||
}
|
||||
0 -> {1} [color=green];
|
||||
|
||||
subgraph cluster_1 {
|
||||
color=red
|
||||
2 [label="Enter function foo" style="filled" fillcolor=red];
|
||||
3 [label="Exit function foo" style="filled" fillcolor=red];
|
||||
2 [label="Enter class A" style="filled" fillcolor=red];
|
||||
3 [label="Exit class A" style="filled" fillcolor=red];
|
||||
}
|
||||
2 -> {3};
|
||||
2 -> {3} [color=green];
|
||||
|
||||
subgraph cluster_2 {
|
||||
color=red
|
||||
4 [label="Enter function takeA" style="filled" fillcolor=red];
|
||||
subgraph cluster_3 {
|
||||
color=blue
|
||||
5 [label="Enter block"];
|
||||
6 [label="Const: Boolean(true)"];
|
||||
7 [label="Jump: ^takeA Boolean(true)"];
|
||||
8 [label="Stub" style="filled" fillcolor=gray];
|
||||
9 [label="Exit block" style="filled" fillcolor=gray];
|
||||
}
|
||||
10 [label="Exit function takeA" style="filled" fillcolor=red];
|
||||
4 [label="Enter function foo" style="filled" fillcolor=red];
|
||||
5 [label="Exit function foo" style="filled" fillcolor=red];
|
||||
}
|
||||
4 -> {5};
|
||||
5 -> {6};
|
||||
6 -> {7};
|
||||
7 -> {10};
|
||||
7 -> {8} [style=dotted];
|
||||
8 -> {9} [style=dotted];
|
||||
9 -> {10} [style=dotted];
|
||||
|
||||
subgraph cluster_4 {
|
||||
subgraph cluster_3 {
|
||||
color=red
|
||||
11 [label="Enter function test" style="filled" fillcolor=red];
|
||||
subgraph cluster_5 {
|
||||
6 [label="Enter function takeA" style="filled" fillcolor=red];
|
||||
subgraph cluster_4 {
|
||||
color=blue
|
||||
12 [label="Enter block"];
|
||||
subgraph cluster_6 {
|
||||
7 [label="Enter block"];
|
||||
8 [label="Const: Boolean(true)"];
|
||||
9 [label="Jump: ^takeA Boolean(true)"];
|
||||
10 [label="Stub" style="filled" fillcolor=gray];
|
||||
11 [label="Exit block" style="filled" fillcolor=gray];
|
||||
}
|
||||
12 [label="Exit function takeA" style="filled" fillcolor=red];
|
||||
}
|
||||
6 -> {7};
|
||||
7 -> {8};
|
||||
8 -> {9};
|
||||
9 -> {12};
|
||||
9 -> {10} [style=dotted];
|
||||
10 -> {11} [style=dotted];
|
||||
11 -> {12} [style=dotted];
|
||||
|
||||
subgraph cluster_5 {
|
||||
color=red
|
||||
13 [label="Enter function test" style="filled" fillcolor=red];
|
||||
subgraph cluster_6 {
|
||||
color=blue
|
||||
14 [label="Enter block"];
|
||||
subgraph cluster_7 {
|
||||
color=blue
|
||||
13 [label="Enter when"];
|
||||
subgraph cluster_7 {
|
||||
color=blue
|
||||
14 [label="Enter when branch condition "];
|
||||
15 [label="Access variable R|<local>/a|"];
|
||||
16 [label="Type operator: (R|<local>/a| as? R|A|)"];
|
||||
17 [label="Exit lhs of ?:"];
|
||||
18 [label="Enter rhs of ?:"];
|
||||
19 [label="Jump: ^test Unit"];
|
||||
20 [label="Stub" style="filled" fillcolor=gray];
|
||||
21 [label="Lhs of ?: is not null"];
|
||||
22 [label="Exit ?:"];
|
||||
23 [label="Function call: R|/takeA|(...)" style="filled" fillcolor=yellow];
|
||||
24 [label="Exit when branch condition"];
|
||||
}
|
||||
25 [label="Synthetic else branch"];
|
||||
26 [label="Enter when branch result"];
|
||||
15 [label="Enter when"];
|
||||
subgraph cluster_8 {
|
||||
color=blue
|
||||
27 [label="Enter block"];
|
||||
28 [label="Access variable R|<local>/a|"];
|
||||
29 [label="Smart cast: R|<local>/a|"];
|
||||
30 [label="Function call: R|<local>/a|.R|/A.foo|()" style="filled" fillcolor=yellow];
|
||||
31 [label="Exit block"];
|
||||
16 [label="Enter when branch condition "];
|
||||
17 [label="Access variable R|<local>/a|"];
|
||||
18 [label="Type operator: (R|<local>/a| as? R|A|)"];
|
||||
19 [label="Exit lhs of ?:"];
|
||||
20 [label="Enter rhs of ?:"];
|
||||
21 [label="Jump: ^test Unit"];
|
||||
22 [label="Stub" style="filled" fillcolor=gray];
|
||||
23 [label="Lhs of ?: is not null"];
|
||||
24 [label="Exit ?:"];
|
||||
25 [label="Function call: R|/takeA|(...)" style="filled" fillcolor=yellow];
|
||||
26 [label="Exit when branch condition"];
|
||||
}
|
||||
32 [label="Exit when branch result"];
|
||||
33 [label="Exit when"];
|
||||
27 [label="Synthetic else branch"];
|
||||
28 [label="Enter when branch result"];
|
||||
subgraph cluster_9 {
|
||||
color=blue
|
||||
29 [label="Enter block"];
|
||||
30 [label="Access variable R|<local>/a|"];
|
||||
31 [label="Smart cast: R|<local>/a|"];
|
||||
32 [label="Function call: R|<local>/a|.R|/A.foo|()" style="filled" fillcolor=yellow];
|
||||
33 [label="Exit block"];
|
||||
}
|
||||
34 [label="Exit when branch result"];
|
||||
35 [label="Exit when"];
|
||||
}
|
||||
34 [label="Exit block"];
|
||||
36 [label="Exit block"];
|
||||
}
|
||||
35 [label="Exit function test" style="filled" fillcolor=red];
|
||||
37 [label="Exit function test" style="filled" fillcolor=red];
|
||||
}
|
||||
11 -> {12};
|
||||
12 -> {13};
|
||||
13 -> {14};
|
||||
14 -> {15};
|
||||
15 -> {16};
|
||||
16 -> {17};
|
||||
17 -> {18 21};
|
||||
17 -> {18};
|
||||
18 -> {19};
|
||||
19 -> {35};
|
||||
19 -> {20} [style=dotted];
|
||||
20 -> {22} [style=dotted];
|
||||
21 -> {22};
|
||||
22 -> {23};
|
||||
19 -> {20 23};
|
||||
20 -> {21};
|
||||
21 -> {37};
|
||||
21 -> {22} [style=dotted];
|
||||
22 -> {24} [style=dotted];
|
||||
23 -> {24};
|
||||
24 -> {25 26};
|
||||
25 -> {33};
|
||||
26 -> {27};
|
||||
27 -> {28};
|
||||
24 -> {25};
|
||||
25 -> {26};
|
||||
26 -> {27 28};
|
||||
27 -> {35};
|
||||
28 -> {29};
|
||||
29 -> {30};
|
||||
30 -> {31};
|
||||
@@ -103,5 +108,7 @@ digraph smartcastFromArgument_kt {
|
||||
32 -> {33};
|
||||
33 -> {34};
|
||||
34 -> {35};
|
||||
35 -> {36};
|
||||
36 -> {37};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user