[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:
+109
-102
@@ -5,94 +5,99 @@ digraph overridenOpenVal_kt {
|
||||
|
||||
subgraph cluster_0 {
|
||||
color=red
|
||||
0 [label="Enter class A" style="filled" fillcolor=red];
|
||||
subgraph cluster_1 {
|
||||
color=blue
|
||||
1 [label="Enter property" style="filled" fillcolor=red];
|
||||
2 [label="Access variable R|<local>/x|"];
|
||||
3 [label="Exit property" style="filled" fillcolor=red];
|
||||
}
|
||||
subgraph cluster_2 {
|
||||
color=blue
|
||||
4 [label="Enter function <init>" style="filled" fillcolor=red];
|
||||
5 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
|
||||
6 [label="Exit function <init>" style="filled" fillcolor=red];
|
||||
}
|
||||
7 [label="Exit class A" style="filled" fillcolor=red];
|
||||
0 [label="Enter file overridenOpenVal.kt" style="filled" fillcolor=red];
|
||||
1 [label="Exit file overridenOpenVal.kt" style="filled" fillcolor=red];
|
||||
}
|
||||
0 -> {1} [color=green];
|
||||
0 -> {7} [style=dotted];
|
||||
0 -> {1 4} [style=dashed];
|
||||
1 -> {2};
|
||||
2 -> {3};
|
||||
3 -> {4} [color=green];
|
||||
4 -> {5};
|
||||
5 -> {6};
|
||||
6 -> {7} [color=green];
|
||||
|
||||
subgraph cluster_3 {
|
||||
subgraph cluster_1 {
|
||||
color=red
|
||||
8 [label="Enter class B" style="filled" fillcolor=red];
|
||||
subgraph cluster_4 {
|
||||
2 [label="Enter class A" style="filled" fillcolor=red];
|
||||
subgraph cluster_2 {
|
||||
color=blue
|
||||
9 [label="Enter function <init>" style="filled" fillcolor=red];
|
||||
10 [label="Access variable R|<local>/x|"];
|
||||
11 [label="Delegated constructor call: super<R|A|>(...)" style="filled" fillcolor=yellow];
|
||||
12 [label="Exit function <init>" style="filled" fillcolor=red];
|
||||
3 [label="Enter property" style="filled" fillcolor=red];
|
||||
4 [label="Access variable R|<local>/x|"];
|
||||
5 [label="Exit property" style="filled" fillcolor=red];
|
||||
}
|
||||
13 [label="Exit class B" style="filled" fillcolor=red];
|
||||
}
|
||||
8 -> {9} [color=green];
|
||||
8 -> {13} [style=dotted];
|
||||
8 -> {9} [style=dashed];
|
||||
9 -> {10};
|
||||
10 -> {11};
|
||||
11 -> {12};
|
||||
12 -> {13} [color=green];
|
||||
|
||||
subgraph cluster_5 {
|
||||
color=red
|
||||
14 [label="Enter function test_1" style="filled" fillcolor=red];
|
||||
subgraph cluster_6 {
|
||||
subgraph cluster_3 {
|
||||
color=blue
|
||||
15 [label="Enter block"];
|
||||
subgraph cluster_7 {
|
||||
6 [label="Enter function <init>" style="filled" fillcolor=red];
|
||||
7 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
|
||||
8 [label="Exit function <init>" style="filled" fillcolor=red];
|
||||
}
|
||||
9 [label="Exit class A" style="filled" fillcolor=red];
|
||||
}
|
||||
2 -> {3} [color=green];
|
||||
2 -> {9} [style=dotted];
|
||||
2 -> {3 6} [style=dashed];
|
||||
3 -> {4};
|
||||
4 -> {5};
|
||||
5 -> {6} [color=green];
|
||||
6 -> {7};
|
||||
7 -> {8};
|
||||
8 -> {9} [color=green];
|
||||
|
||||
subgraph cluster_4 {
|
||||
color=red
|
||||
10 [label="Enter class B" style="filled" fillcolor=red];
|
||||
subgraph cluster_5 {
|
||||
color=blue
|
||||
11 [label="Enter function <init>" style="filled" fillcolor=red];
|
||||
12 [label="Access variable R|<local>/x|"];
|
||||
13 [label="Delegated constructor call: super<R|A|>(...)" style="filled" fillcolor=yellow];
|
||||
14 [label="Exit function <init>" style="filled" fillcolor=red];
|
||||
}
|
||||
15 [label="Exit class B" style="filled" fillcolor=red];
|
||||
}
|
||||
10 -> {11} [color=green];
|
||||
10 -> {15} [style=dotted];
|
||||
10 -> {11} [style=dashed];
|
||||
11 -> {12};
|
||||
12 -> {13};
|
||||
13 -> {14};
|
||||
14 -> {15} [color=green];
|
||||
|
||||
subgraph cluster_6 {
|
||||
color=red
|
||||
16 [label="Enter function test_1" style="filled" fillcolor=red];
|
||||
subgraph cluster_7 {
|
||||
color=blue
|
||||
17 [label="Enter block"];
|
||||
subgraph cluster_8 {
|
||||
color=blue
|
||||
16 [label="Enter when"];
|
||||
subgraph cluster_8 {
|
||||
color=blue
|
||||
17 [label="Enter when branch condition "];
|
||||
18 [label="Access variable R|/A.x|"];
|
||||
19 [label="Type operator: (this@R|/B|.R|/A.x| is R|kotlin/String|)"];
|
||||
20 [label="Exit when branch condition"];
|
||||
}
|
||||
21 [label="Synthetic else branch"];
|
||||
22 [label="Enter when branch result"];
|
||||
18 [label="Enter when"];
|
||||
subgraph cluster_9 {
|
||||
color=blue
|
||||
23 [label="Enter block"];
|
||||
24 [label="Access variable R|/A.x|"];
|
||||
25 [label="Smart cast: this@R|/B|.R|/A.x|"];
|
||||
26 [label="Access variable R|kotlin/String.length|"];
|
||||
27 [label="Exit block"];
|
||||
19 [label="Enter when branch condition "];
|
||||
20 [label="Access variable R|/A.x|"];
|
||||
21 [label="Type operator: (this@R|/B|.R|/A.x| is R|kotlin/String|)"];
|
||||
22 [label="Exit when branch condition"];
|
||||
}
|
||||
28 [label="Exit when branch result"];
|
||||
29 [label="Exit when"];
|
||||
23 [label="Synthetic else branch"];
|
||||
24 [label="Enter when branch result"];
|
||||
subgraph cluster_10 {
|
||||
color=blue
|
||||
25 [label="Enter block"];
|
||||
26 [label="Access variable R|/A.x|"];
|
||||
27 [label="Smart cast: this@R|/B|.R|/A.x|"];
|
||||
28 [label="Access variable R|kotlin/String.length|"];
|
||||
29 [label="Exit block"];
|
||||
}
|
||||
30 [label="Exit when branch result"];
|
||||
31 [label="Exit when"];
|
||||
}
|
||||
30 [label="Exit block"];
|
||||
32 [label="Exit block"];
|
||||
}
|
||||
31 [label="Exit function test_1" style="filled" fillcolor=red];
|
||||
33 [label="Exit function test_1" style="filled" fillcolor=red];
|
||||
}
|
||||
14 -> {15};
|
||||
15 -> {16};
|
||||
16 -> {17};
|
||||
17 -> {18};
|
||||
18 -> {19};
|
||||
19 -> {20};
|
||||
20 -> {21 22};
|
||||
21 -> {29};
|
||||
22 -> {23};
|
||||
23 -> {24};
|
||||
20 -> {21};
|
||||
21 -> {22};
|
||||
22 -> {23 24};
|
||||
23 -> {31};
|
||||
24 -> {25};
|
||||
25 -> {26};
|
||||
26 -> {27};
|
||||
@@ -100,53 +105,53 @@ digraph overridenOpenVal_kt {
|
||||
28 -> {29};
|
||||
29 -> {30};
|
||||
30 -> {31};
|
||||
31 -> {32};
|
||||
32 -> {33};
|
||||
|
||||
subgraph cluster_10 {
|
||||
subgraph cluster_11 {
|
||||
color=red
|
||||
32 [label="Enter function test_2" style="filled" fillcolor=red];
|
||||
subgraph cluster_11 {
|
||||
34 [label="Enter function test_2" style="filled" fillcolor=red];
|
||||
subgraph cluster_12 {
|
||||
color=blue
|
||||
33 [label="Enter block"];
|
||||
subgraph cluster_12 {
|
||||
35 [label="Enter block"];
|
||||
subgraph cluster_13 {
|
||||
color=blue
|
||||
34 [label="Enter when"];
|
||||
subgraph cluster_13 {
|
||||
color=blue
|
||||
35 [label="Enter when branch condition "];
|
||||
36 [label="Access variable R|<local>/b|"];
|
||||
37 [label="Access variable R|/A.x|"];
|
||||
38 [label="Type operator: (R|<local>/b|.R|/A.x| is R|kotlin/String|)"];
|
||||
39 [label="Exit when branch condition"];
|
||||
}
|
||||
40 [label="Synthetic else branch"];
|
||||
41 [label="Enter when branch result"];
|
||||
36 [label="Enter when"];
|
||||
subgraph cluster_14 {
|
||||
color=blue
|
||||
42 [label="Enter block"];
|
||||
43 [label="Access variable R|<local>/b|"];
|
||||
44 [label="Access variable R|/A.x|"];
|
||||
45 [label="Smart cast: R|<local>/b|.R|/A.x|"];
|
||||
46 [label="Access variable R|kotlin/String.length|"];
|
||||
47 [label="Exit block"];
|
||||
37 [label="Enter when branch condition "];
|
||||
38 [label="Access variable R|<local>/b|"];
|
||||
39 [label="Access variable R|/A.x|"];
|
||||
40 [label="Type operator: (R|<local>/b|.R|/A.x| is R|kotlin/String|)"];
|
||||
41 [label="Exit when branch condition"];
|
||||
}
|
||||
48 [label="Exit when branch result"];
|
||||
49 [label="Exit when"];
|
||||
42 [label="Synthetic else branch"];
|
||||
43 [label="Enter when branch result"];
|
||||
subgraph cluster_15 {
|
||||
color=blue
|
||||
44 [label="Enter block"];
|
||||
45 [label="Access variable R|<local>/b|"];
|
||||
46 [label="Access variable R|/A.x|"];
|
||||
47 [label="Smart cast: R|<local>/b|.R|/A.x|"];
|
||||
48 [label="Access variable R|kotlin/String.length|"];
|
||||
49 [label="Exit block"];
|
||||
}
|
||||
50 [label="Exit when branch result"];
|
||||
51 [label="Exit when"];
|
||||
}
|
||||
50 [label="Exit block"];
|
||||
52 [label="Exit block"];
|
||||
}
|
||||
51 [label="Exit function test_2" style="filled" fillcolor=red];
|
||||
53 [label="Exit function test_2" style="filled" fillcolor=red];
|
||||
}
|
||||
32 -> {33};
|
||||
33 -> {34};
|
||||
34 -> {35};
|
||||
35 -> {36};
|
||||
36 -> {37};
|
||||
37 -> {38};
|
||||
38 -> {39};
|
||||
39 -> {40 41};
|
||||
40 -> {49};
|
||||
41 -> {42};
|
||||
42 -> {43};
|
||||
39 -> {40};
|
||||
40 -> {41};
|
||||
41 -> {42 43};
|
||||
42 -> {51};
|
||||
43 -> {44};
|
||||
44 -> {45};
|
||||
45 -> {46};
|
||||
@@ -155,5 +160,7 @@ digraph overridenOpenVal_kt {
|
||||
48 -> {49};
|
||||
49 -> {50};
|
||||
50 -> {51};
|
||||
51 -> {52};
|
||||
52 -> {53};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user