Files
kotlin-fork/compiler/fir/analysis-tests/testData/resolve/cfg/loops.dot
T
Brian Norman b55fda0c55 [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
2023-08-31 12:50:52 +00:00

567 lines
20 KiB
Plaintext
Vendored

digraph loops_kt {
graph [nodesep=3]
node [shape=box penwidth=2]
edge [penwidth=2]
subgraph cluster_0 {
color=red
0 [label="Enter file loops.kt" style="filled" fillcolor=red];
1 [label="Exit file loops.kt" style="filled" fillcolor=red];
}
0 -> {1} [color=green];
subgraph cluster_1 {
color=red
2 [label="Enter function testWhile" style="filled" fillcolor=red];
subgraph cluster_2 {
color=blue
3 [label="Enter block"];
subgraph cluster_3 {
color=blue
4 [label="Enter while loop"];
subgraph cluster_4 {
color=blue
5 [label="Enter loop condition"];
6 [label="Access variable R|<local>/b|"];
7 [label="Exit loop condition"];
}
subgraph cluster_5 {
color=blue
8 [label="Enter loop block"];
subgraph cluster_6 {
color=blue
9 [label="Enter block"];
10 [label="Access variable R|<local>/x|"];
11 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"];
12 [label="Variable declaration: lval y: R|kotlin/Boolean|"];
13 [label="Exit block"];
}
14 [label="Exit loop block"];
}
15 [label="Exit while loop"];
}
16 [label="Access variable R|<local>/x|"];
17 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"];
18 [label="Exit block"];
}
19 [label="Exit function testWhile" style="filled" fillcolor=red];
}
2 -> {3};
3 -> {4};
4 -> {5};
5 -> {6};
6 -> {7};
7 -> {8 15};
8 -> {9};
9 -> {10};
10 -> {11};
11 -> {12};
12 -> {13};
13 -> {14};
14 -> {5} [color=green style=dashed];
15 -> {16};
16 -> {17};
17 -> {18};
18 -> {19};
subgraph cluster_7 {
color=red
20 [label="Enter function testDoWhile" style="filled" fillcolor=red];
subgraph cluster_8 {
color=blue
21 [label="Enter block"];
subgraph cluster_9 {
color=blue
22 [label="Enter do-while loop"];
subgraph cluster_10 {
color=blue
23 [label="Enter loop block"];
subgraph cluster_11 {
color=blue
24 [label="Enter block"];
25 [label="Access variable R|<local>/x|"];
26 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"];
27 [label="Variable declaration: lval y: R|kotlin/Boolean|"];
28 [label="Exit block"];
}
29 [label="Exit loop block"];
}
subgraph cluster_12 {
color=blue
30 [label="Enter loop condition"];
31 [label="Access variable R|<local>/b|"];
32 [label="Exit loop condition"];
}
33 [label="Exit do-while loop"];
}
34 [label="Access variable R|<local>/x|"];
35 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"];
36 [label="Exit block"];
}
37 [label="Exit function testDoWhile" style="filled" fillcolor=red];
}
20 -> {21};
21 -> {22};
22 -> {23};
23 -> {24};
24 -> {25};
25 -> {26};
26 -> {27};
27 -> {28};
28 -> {29};
29 -> {30};
30 -> {31};
31 -> {32};
32 -> {33};
32 -> {23} [color=green style=dashed];
33 -> {34};
34 -> {35};
35 -> {36};
36 -> {37};
subgraph cluster_13 {
color=red
38 [label="Enter function testFor" style="filled" fillcolor=red];
subgraph cluster_14 {
color=blue
39 [label="Enter block"];
subgraph cluster_15 {
color=blue
40 [label="Enter block"];
41 [label="Const: Int(0)"];
42 [label="Const: Int(5)"];
43 [label="Function call: Int(0).R|kotlin/Int.rangeTo|(...)" style="filled" fillcolor=yellow];
44 [label="Function call: Int(0).R|kotlin/Int.rangeTo|(...).R|kotlin/ranges/IntProgression.iterator|()" style="filled" fillcolor=yellow];
45 [label="Variable declaration: lval <iterator>: R|kotlin/collections/IntIterator|"];
subgraph cluster_16 {
color=blue
46 [label="Enter while loop"];
subgraph cluster_17 {
color=blue
47 [label="Enter loop condition"];
48 [label="Access variable R|<local>/<iterator>|"];
49 [label="Function call: R|<local>/<iterator>|.R|SubstitutionOverride<kotlin/collections/IntIterator.hasNext: R|kotlin/Boolean|>|()" style="filled" fillcolor=yellow];
50 [label="Exit loop condition"];
}
subgraph cluster_18 {
color=blue
51 [label="Enter loop block"];
subgraph cluster_19 {
color=blue
52 [label="Enter block"];
53 [label="Access variable R|<local>/<iterator>|"];
54 [label="Function call: R|<local>/<iterator>|.R|kotlin/collections/IntIterator.next|()" style="filled" fillcolor=yellow];
55 [label="Variable declaration: lval i: R|kotlin/Int|"];
subgraph cluster_20 {
color=blue
56 [label="Enter block"];
57 [label="Access variable R|<local>/x|"];
58 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"];
59 [label="Variable declaration: lval y: R|kotlin/Boolean|"];
60 [label="Exit block"];
}
61 [label="Exit block"];
}
62 [label="Exit loop block"];
}
63 [label="Exit while loop"];
}
64 [label="Exit block"];
}
65 [label="Access variable R|<local>/x|"];
66 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"];
67 [label="Exit block"];
}
68 [label="Exit function testFor" style="filled" fillcolor=red];
}
38 -> {39};
39 -> {40};
40 -> {41};
41 -> {42};
42 -> {43};
43 -> {44};
44 -> {45};
45 -> {46};
46 -> {47};
47 -> {48};
48 -> {49};
49 -> {50};
50 -> {51 63};
51 -> {52};
52 -> {53};
53 -> {54};
54 -> {55};
55 -> {56};
56 -> {57};
57 -> {58};
58 -> {59};
59 -> {60};
60 -> {61};
61 -> {62};
62 -> {47} [color=green style=dashed];
63 -> {64};
64 -> {65};
65 -> {66};
66 -> {67};
67 -> {68};
subgraph cluster_21 {
color=red
69 [label="Enter function testWhileTrue" style="filled" fillcolor=red];
subgraph cluster_22 {
color=blue
70 [label="Enter block"];
subgraph cluster_23 {
color=blue
71 [label="Enter while loop"];
subgraph cluster_24 {
color=blue
72 [label="Enter loop condition"];
73 [label="Const: Boolean(true)"];
74 [label="Exit loop condition"];
}
subgraph cluster_25 {
color=blue
75 [label="Enter loop block"];
subgraph cluster_26 {
color=blue
76 [label="Enter block"];
77 [label="Const: Int(1)"];
78 [label="Exit block"];
}
79 [label="Exit loop block"];
}
80 [label="Exit while loop" style="filled" fillcolor=gray];
}
81 [label="Const: Int(1)" style="filled" fillcolor=gray];
82 [label="Exit block" style="filled" fillcolor=gray];
}
83 [label="Exit function testWhileTrue" style="filled" fillcolor=gray];
}
69 -> {70};
70 -> {71};
71 -> {72};
72 -> {73};
73 -> {74};
74 -> {75};
74 -> {80} [style=dotted];
75 -> {76};
76 -> {77};
77 -> {78};
78 -> {79};
79 -> {72} [color=green style=dashed];
80 -> {81} [style=dotted];
81 -> {82} [style=dotted];
82 -> {83} [style=dotted];
subgraph cluster_27 {
color=red
84 [label="Enter function testWhileTrueWithBreak" style="filled" fillcolor=red];
subgraph cluster_28 {
color=blue
85 [label="Enter block"];
subgraph cluster_29 {
color=blue
86 [label="Enter while loop"];
subgraph cluster_30 {
color=blue
87 [label="Enter loop condition"];
88 [label="Const: Boolean(true)"];
89 [label="Exit loop condition"];
}
subgraph cluster_31 {
color=blue
90 [label="Enter loop block"];
subgraph cluster_32 {
color=blue
91 [label="Enter block"];
subgraph cluster_33 {
color=blue
92 [label="Enter when"];
subgraph cluster_34 {
color=blue
93 [label="Enter when branch condition "];
94 [label="Access variable R|<local>/b|"];
95 [label="Exit when branch condition"];
}
96 [label="Synthetic else branch"];
97 [label="Enter when branch result"];
subgraph cluster_35 {
color=blue
98 [label="Enter block"];
99 [label="Jump: break@@@[Boolean(true)] "];
100 [label="Stub" style="filled" fillcolor=gray];
101 [label="Exit block" style="filled" fillcolor=gray];
}
102 [label="Exit when branch result" style="filled" fillcolor=gray];
103 [label="Exit when"];
}
104 [label="Exit block"];
}
105 [label="Exit loop block"];
}
106 [label="Exit while loop"];
}
107 [label="Const: Int(1)"];
108 [label="Exit block"];
}
109 [label="Exit function testWhileTrueWithBreak" style="filled" fillcolor=red];
}
84 -> {85};
85 -> {86};
86 -> {87};
87 -> {88};
88 -> {89};
89 -> {90};
89 -> {106} [style=dotted];
90 -> {91};
91 -> {92};
92 -> {93};
93 -> {94};
94 -> {95};
95 -> {96 97};
96 -> {103};
97 -> {98};
98 -> {99};
99 -> {106};
99 -> {100} [style=dotted];
100 -> {101} [style=dotted];
101 -> {102} [style=dotted];
102 -> {103} [style=dotted];
103 -> {104};
104 -> {105};
105 -> {87} [color=green style=dashed];
106 -> {107};
107 -> {108};
108 -> {109};
subgraph cluster_36 {
color=red
110 [label="Enter function testWhileFalse" style="filled" fillcolor=red];
subgraph cluster_37 {
color=blue
111 [label="Enter block"];
subgraph cluster_38 {
color=blue
112 [label="Enter while loop"];
subgraph cluster_39 {
color=blue
113 [label="Enter loop condition"];
114 [label="Const: Boolean(false)"];
115 [label="Exit loop condition"];
}
subgraph cluster_40 {
color=blue
116 [label="Enter loop block" style="filled" fillcolor=gray];
subgraph cluster_41 {
color=blue
117 [label="Enter block" style="filled" fillcolor=gray];
118 [label="Const: Int(1)" style="filled" fillcolor=gray];
119 [label="Exit block" style="filled" fillcolor=gray];
}
120 [label="Exit loop block" style="filled" fillcolor=gray];
}
121 [label="Exit while loop"];
}
122 [label="Const: Int(1)"];
123 [label="Exit block"];
}
124 [label="Exit function testWhileFalse" style="filled" fillcolor=red];
}
110 -> {111};
111 -> {112};
112 -> {113};
113 -> {114};
114 -> {115};
115 -> {121};
115 -> {116} [style=dotted];
116 -> {117} [style=dotted];
117 -> {118} [style=dotted];
118 -> {119} [style=dotted];
119 -> {120} [style=dotted];
120 -> {113} [color=green style=dotted];
121 -> {122};
122 -> {123};
123 -> {124};
subgraph cluster_42 {
color=red
125 [label="Enter function testDoWhileTrue" style="filled" fillcolor=red];
subgraph cluster_43 {
color=blue
126 [label="Enter block"];
subgraph cluster_44 {
color=blue
127 [label="Enter do-while loop"];
subgraph cluster_45 {
color=blue
128 [label="Enter loop block"];
subgraph cluster_46 {
color=blue
129 [label="Enter block"];
130 [label="Const: Int(1)"];
131 [label="Exit block"];
}
132 [label="Exit loop block"];
}
subgraph cluster_47 {
color=blue
133 [label="Enter loop condition"];
134 [label="Const: Boolean(true)"];
135 [label="Exit loop condition"];
}
136 [label="Exit do-while loop" style="filled" fillcolor=gray];
}
137 [label="Const: Int(1)" style="filled" fillcolor=gray];
138 [label="Exit block" style="filled" fillcolor=gray];
}
139 [label="Exit function testDoWhileTrue" style="filled" fillcolor=gray];
}
125 -> {126};
126 -> {127};
127 -> {128};
128 -> {129};
129 -> {130};
130 -> {131};
131 -> {132};
132 -> {133};
133 -> {134};
134 -> {135};
135 -> {128} [color=green style=dashed];
135 -> {136} [style=dotted];
136 -> {137} [style=dotted];
137 -> {138} [style=dotted];
138 -> {139} [style=dotted];
subgraph cluster_48 {
color=red
140 [label="Enter function testDoWhileTrueWithBreak" style="filled" fillcolor=red];
subgraph cluster_49 {
color=blue
141 [label="Enter block"];
subgraph cluster_50 {
color=blue
142 [label="Enter do-while loop"];
subgraph cluster_51 {
color=blue
143 [label="Enter loop block"];
subgraph cluster_52 {
color=blue
144 [label="Enter block"];
subgraph cluster_53 {
color=blue
145 [label="Enter when"];
subgraph cluster_54 {
color=blue
146 [label="Enter when branch condition "];
147 [label="Access variable R|<local>/b|"];
148 [label="Exit when branch condition"];
}
149 [label="Synthetic else branch"];
150 [label="Enter when branch result"];
subgraph cluster_55 {
color=blue
151 [label="Enter block"];
152 [label="Jump: break@@@[Boolean(true)] "];
153 [label="Stub" style="filled" fillcolor=gray];
154 [label="Exit block" style="filled" fillcolor=gray];
}
155 [label="Exit when branch result" style="filled" fillcolor=gray];
156 [label="Exit when"];
}
157 [label="Exit block"];
}
158 [label="Exit loop block"];
}
subgraph cluster_56 {
color=blue
159 [label="Enter loop condition"];
160 [label="Const: Boolean(true)"];
161 [label="Exit loop condition"];
}
162 [label="Exit do-while loop"];
}
163 [label="Const: Int(1)"];
164 [label="Exit block"];
}
165 [label="Exit function testDoWhileTrueWithBreak" style="filled" fillcolor=red];
}
140 -> {141};
141 -> {142};
142 -> {143};
143 -> {144};
144 -> {145};
145 -> {146};
146 -> {147};
147 -> {148};
148 -> {149 150};
149 -> {156};
150 -> {151};
151 -> {152};
152 -> {162};
152 -> {153} [style=dotted];
153 -> {154} [style=dotted];
154 -> {155} [style=dotted];
155 -> {156} [style=dotted];
156 -> {157};
157 -> {158};
158 -> {159};
159 -> {160};
160 -> {161};
161 -> {143} [color=green style=dashed];
161 -> {162} [style=dotted];
162 -> {163};
163 -> {164};
164 -> {165};
subgraph cluster_57 {
color=red
166 [label="Enter function testDoWhileFalse" style="filled" fillcolor=red];
subgraph cluster_58 {
color=blue
167 [label="Enter block"];
subgraph cluster_59 {
color=blue
168 [label="Enter do-while loop"];
subgraph cluster_60 {
color=blue
169 [label="Enter loop block"];
subgraph cluster_61 {
color=blue
170 [label="Enter block"];
171 [label="Const: Int(1)"];
172 [label="Exit block"];
}
173 [label="Exit loop block"];
}
subgraph cluster_62 {
color=blue
174 [label="Enter loop condition"];
175 [label="Const: Boolean(false)"];
176 [label="Exit loop condition"];
}
177 [label="Exit do-while loop"];
}
178 [label="Const: Int(1)"];
179 [label="Exit block"];
}
180 [label="Exit function testDoWhileFalse" style="filled" fillcolor=red];
}
166 -> {167};
167 -> {168};
168 -> {169};
169 -> {170};
170 -> {171};
171 -> {172};
172 -> {173};
173 -> {174};
174 -> {175};
175 -> {176};
176 -> {177};
176 -> {169} [color=green style=dotted];
177 -> {178};
178 -> {179};
179 -> {180};
}