[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:
+192
-185
@@ -5,235 +5,240 @@ digraph lambdaInWhenBranch_kt {
|
||||
|
||||
subgraph cluster_0 {
|
||||
color=red
|
||||
0 [label="Enter class Sealed" style="filled" fillcolor=red];
|
||||
subgraph cluster_1 {
|
||||
color=blue
|
||||
1 [label="Enter function <init>" style="filled" fillcolor=red];
|
||||
2 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
|
||||
3 [label="Exit function <init>" style="filled" fillcolor=red];
|
||||
}
|
||||
4 [label="Exit class Sealed" style="filled" fillcolor=red];
|
||||
0 [label="Enter file lambdaInWhenBranch.kt" style="filled" fillcolor=red];
|
||||
1 [label="Exit file lambdaInWhenBranch.kt" style="filled" fillcolor=red];
|
||||
}
|
||||
0 -> {1} [color=green];
|
||||
0 -> {4} [style=dotted];
|
||||
0 -> {1} [style=dashed];
|
||||
1 -> {2};
|
||||
2 -> {3};
|
||||
3 -> {4} [color=green];
|
||||
|
||||
subgraph cluster_2 {
|
||||
subgraph cluster_1 {
|
||||
color=red
|
||||
5 [label="Enter class SubClass1" style="filled" fillcolor=red];
|
||||
subgraph cluster_3 {
|
||||
2 [label="Enter class Sealed" style="filled" fillcolor=red];
|
||||
subgraph cluster_2 {
|
||||
color=blue
|
||||
6 [label="Enter property" style="filled" fillcolor=red];
|
||||
7 [label="Access variable R|<local>/t|"];
|
||||
8 [label="Exit property" style="filled" fillcolor=red];
|
||||
3 [label="Enter function <init>" style="filled" fillcolor=red];
|
||||
4 [label="Delegated constructor call: super<R|kotlin/Any|>()" style="filled" fillcolor=yellow];
|
||||
5 [label="Exit function <init>" style="filled" fillcolor=red];
|
||||
}
|
||||
6 [label="Exit class Sealed" style="filled" fillcolor=red];
|
||||
}
|
||||
2 -> {3} [color=green];
|
||||
2 -> {6} [style=dotted];
|
||||
2 -> {3} [style=dashed];
|
||||
3 -> {4};
|
||||
4 -> {5};
|
||||
5 -> {6} [color=green];
|
||||
|
||||
subgraph cluster_3 {
|
||||
color=red
|
||||
7 [label="Enter class SubClass1" style="filled" fillcolor=red];
|
||||
subgraph cluster_4 {
|
||||
color=blue
|
||||
9 [label="Enter function <init>" style="filled" fillcolor=red];
|
||||
10 [label="Delegated constructor call: super<R|Sealed|>()" style="filled" fillcolor=yellow];
|
||||
11 [label="Exit function <init>" style="filled" fillcolor=red];
|
||||
8 [label="Enter property" style="filled" fillcolor=red];
|
||||
9 [label="Access variable R|<local>/t|"];
|
||||
10 [label="Exit property" style="filled" fillcolor=red];
|
||||
}
|
||||
12 [label="Exit class SubClass1" style="filled" fillcolor=red];
|
||||
subgraph cluster_5 {
|
||||
color=blue
|
||||
11 [label="Enter function <init>" style="filled" fillcolor=red];
|
||||
12 [label="Delegated constructor call: super<R|Sealed|>()" style="filled" fillcolor=yellow];
|
||||
13 [label="Exit function <init>" style="filled" fillcolor=red];
|
||||
}
|
||||
14 [label="Exit class SubClass1" style="filled" fillcolor=red];
|
||||
}
|
||||
5 -> {6} [color=green];
|
||||
5 -> {12} [style=dotted];
|
||||
5 -> {6 9} [style=dashed];
|
||||
6 -> {7};
|
||||
7 -> {8};
|
||||
8 -> {9} [color=green];
|
||||
7 -> {8} [color=green];
|
||||
7 -> {14} [style=dotted];
|
||||
7 -> {8 11} [style=dashed];
|
||||
8 -> {9};
|
||||
9 -> {10};
|
||||
10 -> {11};
|
||||
11 -> {12} [color=green];
|
||||
|
||||
subgraph cluster_5 {
|
||||
color=red
|
||||
13 [label="Enter function component1" style="filled" fillcolor=red];
|
||||
14 [label="Exit function component1" style="filled" fillcolor=red];
|
||||
}
|
||||
13 -> {14};
|
||||
10 -> {11} [color=green];
|
||||
11 -> {12};
|
||||
12 -> {13};
|
||||
13 -> {14} [color=green];
|
||||
|
||||
subgraph cluster_6 {
|
||||
color=red
|
||||
15 [label="Enter function copy" style="filled" fillcolor=red];
|
||||
16 [label="Enter default value of t"];
|
||||
subgraph cluster_7 {
|
||||
color=blue
|
||||
17 [label="Enter default value of t" style="filled" fillcolor=red];
|
||||
18 [label="Access variable R|/SubClass1.t|"];
|
||||
19 [label="Exit default value of t" style="filled" fillcolor=red];
|
||||
}
|
||||
20 [label="Exit default value of t"];
|
||||
21 [label="Exit function copy" style="filled" fillcolor=red];
|
||||
15 [label="Enter function component1" style="filled" fillcolor=red];
|
||||
16 [label="Exit function component1" style="filled" fillcolor=red];
|
||||
}
|
||||
15 -> {16};
|
||||
16 -> {17 20};
|
||||
16 -> {17} [style=dashed];
|
||||
|
||||
subgraph cluster_7 {
|
||||
color=red
|
||||
17 [label="Enter function copy" style="filled" fillcolor=red];
|
||||
18 [label="Enter default value of t"];
|
||||
subgraph cluster_8 {
|
||||
color=blue
|
||||
19 [label="Enter default value of t" style="filled" fillcolor=red];
|
||||
20 [label="Access variable R|/SubClass1.t|"];
|
||||
21 [label="Exit default value of t" style="filled" fillcolor=red];
|
||||
}
|
||||
22 [label="Exit default value of t"];
|
||||
23 [label="Exit function copy" style="filled" fillcolor=red];
|
||||
}
|
||||
17 -> {18};
|
||||
18 -> {19};
|
||||
18 -> {19 22};
|
||||
18 -> {19} [style=dashed];
|
||||
19 -> {20};
|
||||
20 -> {21};
|
||||
21 -> {22};
|
||||
22 -> {23};
|
||||
|
||||
subgraph cluster_8 {
|
||||
subgraph cluster_9 {
|
||||
color=red
|
||||
22 [label="Enter class SubClass2" style="filled" fillcolor=red];
|
||||
subgraph cluster_9 {
|
||||
24 [label="Enter class SubClass2" style="filled" fillcolor=red];
|
||||
subgraph cluster_10 {
|
||||
color=blue
|
||||
23 [label="Enter function <init>" style="filled" fillcolor=red];
|
||||
24 [label="Delegated constructor call: super<R|Sealed|>()" style="filled" fillcolor=yellow];
|
||||
25 [label="Exit function <init>" style="filled" fillcolor=red];
|
||||
25 [label="Enter function <init>" style="filled" fillcolor=red];
|
||||
26 [label="Delegated constructor call: super<R|Sealed|>()" style="filled" fillcolor=yellow];
|
||||
27 [label="Exit function <init>" style="filled" fillcolor=red];
|
||||
}
|
||||
26 [label="Exit class SubClass2" style="filled" fillcolor=red];
|
||||
28 [label="Exit class SubClass2" style="filled" fillcolor=red];
|
||||
}
|
||||
22 -> {23} [color=green];
|
||||
22 -> {26} [style=dotted];
|
||||
22 -> {23} [style=dashed];
|
||||
23 -> {24};
|
||||
24 -> {25};
|
||||
25 -> {26} [color=green];
|
||||
|
||||
subgraph cluster_10 {
|
||||
color=red
|
||||
27 [label="Enter function copy" style="filled" fillcolor=red];
|
||||
28 [label="Exit function copy" style="filled" fillcolor=red];
|
||||
}
|
||||
27 -> {28};
|
||||
24 -> {25} [color=green];
|
||||
24 -> {28} [style=dotted];
|
||||
24 -> {25} [style=dashed];
|
||||
25 -> {26};
|
||||
26 -> {27};
|
||||
27 -> {28} [color=green];
|
||||
|
||||
subgraph cluster_11 {
|
||||
color=red
|
||||
29 [label="Enter function foo" style="filled" fillcolor=red];
|
||||
subgraph cluster_12 {
|
||||
color=blue
|
||||
30 [label="Enter block"];
|
||||
subgraph cluster_13 {
|
||||
color=blue
|
||||
31 [label="Enter when"];
|
||||
32 [label="Access variable R|<local>/p|"];
|
||||
subgraph cluster_14 {
|
||||
color=blue
|
||||
33 [label="Enter when branch condition "];
|
||||
34 [label="Exit $subj"];
|
||||
35 [label="Type operator: ($subj$ is R|SubClass1|)"];
|
||||
36 [label="Exit when branch condition"];
|
||||
}
|
||||
subgraph cluster_15 {
|
||||
color=blue
|
||||
37 [label="Enter when branch condition "];
|
||||
38 [label="Exit $subj"];
|
||||
39 [label="Type operator: ($subj$ is R|SubClass2|)"];
|
||||
40 [label="Exit when branch condition"];
|
||||
}
|
||||
41 [label="Enter when branch result"];
|
||||
subgraph cluster_16 {
|
||||
color=blue
|
||||
42 [label="Enter block"];
|
||||
43 [label="Const: String()"];
|
||||
44 [label="Exit block"];
|
||||
}
|
||||
45 [label="Exit when branch result"];
|
||||
46 [label="Enter when branch result"];
|
||||
subgraph cluster_17 {
|
||||
color=blue
|
||||
47 [label="Enter block"];
|
||||
48 [label="Const: String()"];
|
||||
49 [label="Postponed enter to lambda"];
|
||||
subgraph cluster_18 {
|
||||
color=blue
|
||||
50 [label="Enter function <anonymous>" style="filled" fillcolor=red];
|
||||
subgraph cluster_19 {
|
||||
color=blue
|
||||
51 [label="Enter block"];
|
||||
52 [label="Access variable R|<local>/it|"];
|
||||
53 [label="Exit block"];
|
||||
}
|
||||
54 [label="Exit function <anonymous>" style="filled" fillcolor=red];
|
||||
}
|
||||
55 [label="Postponed exit from lambda"];
|
||||
56 [label="Function call: String().R|kotlin/let|<R|kotlin/String|, R|kotlin/String|>(...)" style="filled" fillcolor=yellow];
|
||||
57 [label="Exit block"];
|
||||
}
|
||||
58 [label="Exit when branch result"];
|
||||
59 [label="Exit when"];
|
||||
}
|
||||
60 [label="Access variable R|<local>/p|"];
|
||||
61 [label="Access variable <Unresolved name: t>#"];
|
||||
subgraph cluster_20 {
|
||||
color=blue
|
||||
62 [label="Enter when"];
|
||||
63 [label="Access variable R|<local>/p|"];
|
||||
subgraph cluster_21 {
|
||||
color=blue
|
||||
64 [label="Enter when branch condition "];
|
||||
65 [label="Exit $subj"];
|
||||
66 [label="Type operator: ($subj$ is R|SubClass1|)"];
|
||||
67 [label="Exit when branch condition"];
|
||||
}
|
||||
subgraph cluster_22 {
|
||||
color=blue
|
||||
68 [label="Enter when branch condition "];
|
||||
69 [label="Exit $subj"];
|
||||
70 [label="Type operator: ($subj$ is R|SubClass2|)"];
|
||||
71 [label="Exit when branch condition"];
|
||||
}
|
||||
72 [label="Enter when branch result"];
|
||||
subgraph cluster_23 {
|
||||
color=blue
|
||||
73 [label="Enter block"];
|
||||
74 [label="Const: String(2)"];
|
||||
75 [label="Exit block"];
|
||||
}
|
||||
76 [label="Exit when branch result"];
|
||||
77 [label="Enter when branch result"];
|
||||
subgraph cluster_24 {
|
||||
color=blue
|
||||
78 [label="Enter block"];
|
||||
79 [label="Access variable R|<local>/p|"];
|
||||
80 [label="Smart cast: R|<local>/p|"];
|
||||
81 [label="Access variable R|/SubClass1.t|"];
|
||||
82 [label="Exit block"];
|
||||
}
|
||||
83 [label="Exit when branch result"];
|
||||
84 [label="Exit when"];
|
||||
}
|
||||
85 [label="Access variable R|kotlin/String.length|"];
|
||||
86 [label="Exit block"];
|
||||
}
|
||||
87 [label="Exit function foo" style="filled" fillcolor=red];
|
||||
29 [label="Enter function copy" style="filled" fillcolor=red];
|
||||
30 [label="Exit function copy" style="filled" fillcolor=red];
|
||||
}
|
||||
29 -> {30};
|
||||
30 -> {31};
|
||||
|
||||
subgraph cluster_12 {
|
||||
color=red
|
||||
31 [label="Enter function foo" style="filled" fillcolor=red];
|
||||
subgraph cluster_13 {
|
||||
color=blue
|
||||
32 [label="Enter block"];
|
||||
subgraph cluster_14 {
|
||||
color=blue
|
||||
33 [label="Enter when"];
|
||||
34 [label="Access variable R|<local>/p|"];
|
||||
subgraph cluster_15 {
|
||||
color=blue
|
||||
35 [label="Enter when branch condition "];
|
||||
36 [label="Exit $subj"];
|
||||
37 [label="Type operator: ($subj$ is R|SubClass1|)"];
|
||||
38 [label="Exit when branch condition"];
|
||||
}
|
||||
subgraph cluster_16 {
|
||||
color=blue
|
||||
39 [label="Enter when branch condition "];
|
||||
40 [label="Exit $subj"];
|
||||
41 [label="Type operator: ($subj$ is R|SubClass2|)"];
|
||||
42 [label="Exit when branch condition"];
|
||||
}
|
||||
43 [label="Enter when branch result"];
|
||||
subgraph cluster_17 {
|
||||
color=blue
|
||||
44 [label="Enter block"];
|
||||
45 [label="Const: String()"];
|
||||
46 [label="Exit block"];
|
||||
}
|
||||
47 [label="Exit when branch result"];
|
||||
48 [label="Enter when branch result"];
|
||||
subgraph cluster_18 {
|
||||
color=blue
|
||||
49 [label="Enter block"];
|
||||
50 [label="Const: String()"];
|
||||
51 [label="Postponed enter to lambda"];
|
||||
subgraph cluster_19 {
|
||||
color=blue
|
||||
52 [label="Enter function <anonymous>" style="filled" fillcolor=red];
|
||||
subgraph cluster_20 {
|
||||
color=blue
|
||||
53 [label="Enter block"];
|
||||
54 [label="Access variable R|<local>/it|"];
|
||||
55 [label="Exit block"];
|
||||
}
|
||||
56 [label="Exit function <anonymous>" style="filled" fillcolor=red];
|
||||
}
|
||||
57 [label="Postponed exit from lambda"];
|
||||
58 [label="Function call: String().R|kotlin/let|<R|kotlin/String|, R|kotlin/String|>(...)" style="filled" fillcolor=yellow];
|
||||
59 [label="Exit block"];
|
||||
}
|
||||
60 [label="Exit when branch result"];
|
||||
61 [label="Exit when"];
|
||||
}
|
||||
62 [label="Access variable R|<local>/p|"];
|
||||
63 [label="Access variable <Unresolved name: t>#"];
|
||||
subgraph cluster_21 {
|
||||
color=blue
|
||||
64 [label="Enter when"];
|
||||
65 [label="Access variable R|<local>/p|"];
|
||||
subgraph cluster_22 {
|
||||
color=blue
|
||||
66 [label="Enter when branch condition "];
|
||||
67 [label="Exit $subj"];
|
||||
68 [label="Type operator: ($subj$ is R|SubClass1|)"];
|
||||
69 [label="Exit when branch condition"];
|
||||
}
|
||||
subgraph cluster_23 {
|
||||
color=blue
|
||||
70 [label="Enter when branch condition "];
|
||||
71 [label="Exit $subj"];
|
||||
72 [label="Type operator: ($subj$ is R|SubClass2|)"];
|
||||
73 [label="Exit when branch condition"];
|
||||
}
|
||||
74 [label="Enter when branch result"];
|
||||
subgraph cluster_24 {
|
||||
color=blue
|
||||
75 [label="Enter block"];
|
||||
76 [label="Const: String(2)"];
|
||||
77 [label="Exit block"];
|
||||
}
|
||||
78 [label="Exit when branch result"];
|
||||
79 [label="Enter when branch result"];
|
||||
subgraph cluster_25 {
|
||||
color=blue
|
||||
80 [label="Enter block"];
|
||||
81 [label="Access variable R|<local>/p|"];
|
||||
82 [label="Smart cast: R|<local>/p|"];
|
||||
83 [label="Access variable R|/SubClass1.t|"];
|
||||
84 [label="Exit block"];
|
||||
}
|
||||
85 [label="Exit when branch result"];
|
||||
86 [label="Exit when"];
|
||||
}
|
||||
87 [label="Access variable R|kotlin/String.length|"];
|
||||
88 [label="Exit block"];
|
||||
}
|
||||
89 [label="Exit function foo" style="filled" fillcolor=red];
|
||||
}
|
||||
31 -> {32};
|
||||
32 -> {33};
|
||||
33 -> {34};
|
||||
34 -> {35};
|
||||
35 -> {36};
|
||||
36 -> {37 46};
|
||||
36 -> {37};
|
||||
37 -> {38};
|
||||
38 -> {39};
|
||||
38 -> {39 48};
|
||||
39 -> {40};
|
||||
40 -> {41};
|
||||
41 -> {42};
|
||||
42 -> {43};
|
||||
43 -> {44};
|
||||
44 -> {45};
|
||||
45 -> {59};
|
||||
45 -> {46};
|
||||
46 -> {47};
|
||||
47 -> {48};
|
||||
47 -> {61};
|
||||
48 -> {49};
|
||||
49 -> {50 56};
|
||||
49 -> {55} [style=dotted];
|
||||
49 -> {50} [style=dashed];
|
||||
49 -> {50};
|
||||
50 -> {51};
|
||||
51 -> {52};
|
||||
51 -> {52 58};
|
||||
51 -> {57} [style=dotted];
|
||||
51 -> {52} [style=dashed];
|
||||
52 -> {53};
|
||||
53 -> {54};
|
||||
54 -> {55};
|
||||
55 -> {56} [color=green];
|
||||
55 -> {59} [color=red];
|
||||
55 -> {56};
|
||||
56 -> {57};
|
||||
57 -> {58};
|
||||
57 -> {58} [color=green];
|
||||
57 -> {61} [color=red];
|
||||
58 -> {59};
|
||||
59 -> {60};
|
||||
60 -> {61};
|
||||
@@ -243,18 +248,18 @@ digraph lambdaInWhenBranch_kt {
|
||||
64 -> {65};
|
||||
65 -> {66};
|
||||
66 -> {67};
|
||||
67 -> {68 77};
|
||||
67 -> {68};
|
||||
68 -> {69};
|
||||
69 -> {70};
|
||||
69 -> {70 79};
|
||||
70 -> {71};
|
||||
71 -> {72};
|
||||
72 -> {73};
|
||||
73 -> {74};
|
||||
74 -> {75};
|
||||
75 -> {76};
|
||||
76 -> {84};
|
||||
76 -> {77};
|
||||
77 -> {78};
|
||||
78 -> {79};
|
||||
78 -> {86};
|
||||
79 -> {80};
|
||||
80 -> {81};
|
||||
81 -> {82};
|
||||
@@ -263,5 +268,7 @@ digraph lambdaInWhenBranch_kt {
|
||||
84 -> {85};
|
||||
85 -> {86};
|
||||
86 -> {87};
|
||||
87 -> {88};
|
||||
88 -> {89};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user