Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
950bbfe3
K
kotlin
项目概览
硅谷海盗
/
kotlin
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kotlin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
950bbfe3
编写于
6月 04, 2020
作者:
D
Dmitriy Novozhilov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[FIR] Add kind for back edges in CFG
上级
34be9e35
变更
20
隐藏空白更改
内联
并排
Showing
20 changed file
with
84 addition
and
63 deletion
+84
-63
compiler/fir/analysis-tests/testData/resolve/cfg/complex.dot
compiler/fir/analysis-tests/testData/resolve/cfg/complex.dot
+1
-1
compiler/fir/analysis-tests/testData/resolve/cfg/jumps.dot
compiler/fir/analysis-tests/testData/resolve/cfg/jumps.dot
+6
-5
compiler/fir/analysis-tests/testData/resolve/cfg/lambdas.dot
compiler/fir/analysis-tests/testData/resolve/cfg/lambdas.dot
+3
-3
compiler/fir/analysis-tests/testData/resolve/cfg/localClassesWithImplicit.dot
...s-tests/testData/resolve/cfg/localClassesWithImplicit.dot
+4
-4
compiler/fir/analysis-tests/testData/resolve/cfg/loops.dot
compiler/fir/analysis-tests/testData/resolve/cfg/loops.dot
+10
-9
compiler/fir/analysis-tests/testData/resolve/cfg/postponedLambdas.dot
.../analysis-tests/testData/resolve/cfg/postponedLambdas.dot
+1
-1
compiler/fir/analysis-tests/testData/resolve/cfg/propertiesAndInitBlocks.dot
...is-tests/testData/resolve/cfg/propertiesAndInitBlocks.dot
+1
-1
compiler/fir/analysis-tests/testData/resolve/cfg/tryCatch.dot
...iler/fir/analysis-tests/testData/resolve/cfg/tryCatch.dot
+2
-2
compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.dot
.../smartcasts/boundSmartcasts/boundSmartcastsInBranches.dot
+2
-2
compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/dataFlowInfoFromWhileCondition.dot
...solve/smartcasts/loops/dataFlowInfoFromWhileCondition.dot
+1
-1
compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/endlessLoops.dot
...-tests/testData/resolve/smartcasts/loops/endlessLoops.dot
+7
-7
compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastToNothing.dot
...-tests/testData/resolve/smartcasts/smartcastToNothing.dot
+1
-1
compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromLibrary/callsInPlace.dot
.../resolveWithStdlib/contracts/fromLibrary/callsInPlace.dot
+6
-6
compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/good/callsInPlace/atLeastOnce.dot
...ib/contracts/fromSource/good/callsInPlace/atLeastOnce.dot
+2
-2
compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/good/callsInPlace/unknown.dot
...Stdlib/contracts/fromSource/good/callsInPlace/unknown.dot
+2
-2
compiler/fir/analysis-tests/testData/resolveWithStdlib/smartcasts/tryWithLambdaInside.dot
...Data/resolveWithStdlib/smartcasts/tryWithLambdaInside.dot
+1
-1
compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraph.kt
.../jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraph.kt
+7
-5
compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphBuilder.kt
...ins/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphBuilder.kt
+24
-9
compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphRenderer.kt
...ns/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphRenderer.kt
+2
-0
compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticTest.kt
...sts/org/jetbrains/kotlin/fir/AbstractFirDiagnosticTest.kt
+1
-1
未找到文件。
compiler/fir/analysis-tests/testData/resolve/cfg/complex.dot
浏览文件 @
950bbfe3
...
...
@@ -260,7 +260,7 @@ digraph complex_kt {
79
->
{
68
}
[
style
=
dotted
]
;
80
->
{
68
};
81
->
{
82
};
82
->
{
58
};
82
->
{
58
}
[
color
=
green
style
=
dashed
]
;
83
->
{
84
};
84
->
{
52
};
84
->
{
85
}
[
style
=
dotted
]
;
...
...
compiler/fir/analysis-tests/testData/resolve/cfg/jumps.dot
浏览文件 @
950bbfe3
...
...
@@ -191,7 +191,7 @@ digraph jumps_kt {
63
->
{
64
}
[
style
=
dotted
]
;
64
->
{
65
}
[
style
=
dotted
]
;
65
->
{
66
}
[
style
=
dotted
]
;
66
->
{
56
}
[
style
=
dotted
]
;
66
->
{
56
}
[
color
=
green
style
=
dotted
]
;
67
->
{
68
};
68
->
{
53
};
...
...
@@ -241,7 +241,8 @@ digraph jumps_kt {
80
->
{
81
}
[
style
=
dotted
]
;
81
->
{
82
}
[
style
=
dotted
]
;
82
->
{
83
}
[
style
=
dotted
]
;
83
->
{
73
72
}
[
style
=
dotted
]
;
83
->
{
72
}
[
style
=
dotted
]
;
83
->
{
73
}
[
color
=
green
style
=
dotted
]
;
84
->
{
85
};
85
->
{
70
};
...
...
@@ -307,14 +308,14 @@ digraph jumps_kt {
99
->
{
100
106
};
100
->
{
101
};
101
->
{
102
};
102
->
{
88
};
102
->
{
103
}
[
style
=
dotted
]
;
102
->
{
88
}
[
color
=
green
style
=
dashed
]
;
103
->
{
104
}
[
style
=
dotted
]
;
104
->
{
105
}
[
style
=
dotted
]
;
105
->
{
96
}
[
style
=
dotted
]
;
106
->
{
96
};
107
->
{
108
};
108
->
{
90
};
108
->
{
90
}
[
color
=
green
style
=
dashed
]
;
subgraph
cluster_30
{
color
=
red
...
...
@@ -346,8 +347,8 @@ digraph jumps_kt {
115
->
{
116
};
116
->
{
113
};
117
->
{
118
119
};
118
->
{
117
};
118
->
{
115
}
[
color
=
green
]
;
118
->
{
117
}
[
color
=
green
style
=
dashed
]
;
119
->
{
118
};
119
->
{
120
}
[
style
=
dotted
]
;
120
->
{
118
}
[
style
=
dotted
]
;
...
...
compiler/fir/analysis-tests/testData/resolve/cfg/lambdas.dot
浏览文件 @
950bbfe3
...
...
@@ -64,8 +64,8 @@ digraph lambdas_kt {
17
->
{
6
};
18
->
{
6
};
19
->
{
20
21
};
20
->
{
19
};
20
->
{
14
}
[
color
=
green
]
;
20
->
{
19
}
[
color
=
green
style
=
dashed
]
;
21
->
{
22
};
22
->
{
20
};
...
...
@@ -166,8 +166,8 @@ digraph lambdas_kt {
52
->
{
53
}
[
style
=
dotted
]
;
53
->
{
48
}
[
style
=
dotted
]
;
54
->
{
55
56
};
55
->
{
54
};
55
->
{
50
}
[
color
=
green
]
;
55
->
{
54
}
[
color
=
green
style
=
dashed
]
;
56
->
{
57
};
57
->
{
48
};
57
->
{
58
}
[
style
=
dotted
]
;
...
...
@@ -203,8 +203,8 @@ digraph lambdas_kt {
64
->
{
65
}
[
style
=
dotted
]
;
65
->
{
60
}
[
style
=
dotted
]
;
66
->
{
67
68
};
67
->
{
66
};
67
->
{
62
}
[
color
=
green
]
;
67
->
{
66
}
[
color
=
green
style
=
dashed
]
;
68
->
{
69
};
69
->
{
60
};
69
->
{
70
}
[
style
=
dotted
]
;
...
...
compiler/fir/analysis-tests/testData/resolve/cfg/localClassesWithImplicit.dot
浏览文件 @
950bbfe3
...
...
@@ -184,8 +184,8 @@ digraph localClassesWithImplicit_kt {
31
->
{
32
}
[
style
=
dotted
]
;
32
->
{
27
}
[
style
=
dotted
]
;
33
->
{
34
35
};
34
->
{
33
};
34
->
{
29
}
[
color
=
green
]
;
34
->
{
33
}
[
color
=
green
style
=
dashed
]
;
35
->
{
36
};
36
->
{
37
};
37
->
{
39
};
...
...
@@ -217,8 +217,8 @@ digraph localClassesWithImplicit_kt {
62
->
{
63
}
[
style
=
dotted
]
;
63
->
{
58
}
[
style
=
dotted
]
;
64
->
{
65
66
};
65
->
{
64
};
65
->
{
60
}
[
color
=
green
]
;
65
->
{
64
}
[
color
=
green
style
=
dashed
]
;
66
->
{
67
};
67
->
{
68
};
68
->
{
69
};
...
...
@@ -320,8 +320,8 @@ digraph localClassesWithImplicit_kt {
86
->
{
87
}
[
style
=
dotted
]
;
87
->
{
82
}
[
style
=
dotted
]
;
88
->
{
89
90
};
89
->
{
88
};
89
->
{
84
}
[
color
=
green
]
;
89
->
{
88
}
[
color
=
green
style
=
dashed
]
;
90
->
{
91
};
91
->
{
92
};
92
->
{
94
};
...
...
@@ -379,8 +379,8 @@ digraph localClassesWithImplicit_kt {
117
->
{
118
}
[
style
=
dotted
]
;
118
->
{
113
}
[
style
=
dotted
]
;
119
->
{
120
121
};
120
->
{
119
};
120
->
{
115
}
[
color
=
green
]
;
120
->
{
119
}
[
color
=
green
style
=
dashed
]
;
121
->
{
122
};
122
->
{
123
};
123
->
{
124
};
...
...
compiler/fir/analysis-tests/testData/resolve/cfg/loops.dot
浏览文件 @
950bbfe3
...
...
@@ -46,7 +46,7 @@ digraph loops_kt {
10
->
{
11
};
11
->
{
12
};
12
->
{
13
};
13
->
{
4
};
13
->
{
4
}
[
color
=
green
style
=
dashed
]
;
14
->
{
15
};
15
->
{
1
};
...
...
@@ -93,7 +93,8 @@ digraph loops_kt {
26
->
{
27
};
27
->
{
28
};
28
->
{
29
};
29
->
{
20
19
};
29
->
{
19
};
29
->
{
20
}
[
color
=
green
style
=
dashed
]
;
30
->
{
31
};
31
->
{
17
};
...
...
@@ -158,7 +159,7 @@ digraph loops_kt {
51
->
{
52
};
52
->
{
53
};
53
->
{
54
};
54
->
{
41
};
54
->
{
41
}
[
color
=
green
style
=
dashed
]
;
55
->
{
56
};
56
->
{
33
};
...
...
@@ -201,7 +202,7 @@ digraph loops_kt {
65
->
{
66
};
66
->
{
67
};
67
->
{
68
};
68
->
{
61
};
68
->
{
61
}
[
color
=
green
style
=
dashed
]
;
69
->
{
58
}
[
style
=
dotted
]
;
subgraph
cluster_20
{
...
...
@@ -275,7 +276,7 @@ digraph loops_kt {
89
->
{
80
}
[
style
=
dotted
]
;
90
->
{
80
};
91
->
{
92
};
92
->
{
74
};
92
->
{
74
}
[
color
=
green
style
=
dashed
]
;
93
->
{
71
};
subgraph
cluster_28
{
...
...
@@ -317,7 +318,7 @@ digraph loops_kt {
102
->
{
103
}
[
style
=
dotted
]
;
103
->
{
104
}
[
style
=
dotted
]
;
104
->
{
105
}
[
style
=
dotted
]
;
105
->
{
98
}
[
style
=
dotted
]
;
105
->
{
98
}
[
color
=
green
style
=
dotted
]
;
106
->
{
95
};
subgraph
cluster_33
{
...
...
@@ -358,8 +359,8 @@ digraph loops_kt {
115
->
{
116
};
116
->
{
117
};
117
->
{
118
};
118
->
{
111
};
118
->
{
110
}
[
style
=
dotted
]
;
118
->
{
111
}
[
color
=
green
style
=
dashed
]
;
119
->
{
108
}
[
style
=
dotted
]
;
subgraph
cluster_38
{
...
...
@@ -432,8 +433,8 @@ digraph loops_kt {
139
->
{
140
};
140
->
{
141
};
141
->
{
142
};
142
->
{
124
};
142
->
{
123
}
[
style
=
dotted
]
;
142
->
{
124
}
[
color
=
green
style
=
dashed
]
;
143
->
{
121
};
subgraph
cluster_46
{
...
...
@@ -475,7 +476,7 @@ digraph loops_kt {
153
->
{
154
};
154
->
{
155
};
155
->
{
147
};
155
->
{
148
}
[
style
=
dotted
]
;
155
->
{
148
}
[
color
=
green
style
=
dotted
]
;
156
->
{
145
};
}
compiler/fir/analysis-tests/testData/resolve/cfg/postponedLambdas.dot
浏览文件 @
950bbfe3
...
...
@@ -34,8 +34,8 @@ digraph postponedLambdas_kt {
7
->
{
8
};
8
->
{
3
};
9
->
{
10
11
};
10
->
{
9
};
10
->
{
6
}
[
color
=
green
]
;
10
->
{
9
}
[
color
=
green
style
=
dashed
]
;
11
->
{
10
};
}
compiler/fir/analysis-tests/testData/resolve/cfg/propertiesAndInitBlocks.dot
浏览文件 @
950bbfe3
...
...
@@ -177,8 +177,8 @@ digraph propertiesAndInitBlocks_kt {
67
->
{
64
};
20
->
{
21
22
};
20
->
{
26
35
38
}
[
color
=
red
]
;
21
->
{
20
};
21
->
{
66
}
[
color
=
green
]
;
21
->
{
20
}
[
color
=
green
style
=
dashed
]
;
22
->
{
23
};
23
->
{
24
};
24
->
{
64
};
...
...
compiler/fir/analysis-tests/testData/resolve/cfg/tryCatch.dot
浏览文件 @
950bbfe3
...
...
@@ -280,8 +280,8 @@ digraph tryCatch_kt {
79
->
{
80
};
80
->
{
47
};
81
->
{
82
};
82
->
{
39
};
82
->
{
83
}
[
style
=
dotted
]
;
82
->
{
39
}
[
color
=
green
style
=
dashed
]
;
83
->
{
84
}
[
style
=
dotted
]
;
84
->
{
85
}
[
style
=
dotted
]
;
85
->
{
47
}
[
style
=
dotted
]
;
...
...
@@ -294,7 +294,7 @@ digraph tryCatch_kt {
91
->
{
92
};
92
->
{
93
};
93
->
{
94
};
94
->
{
41
};
94
->
{
41
}
[
color
=
green
style
=
dashed
]
;
95
->
{
96
};
96
->
{
38
};
...
...
compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.dot
浏览文件 @
950bbfe3
...
...
@@ -124,8 +124,8 @@ digraph boundSmartcastsInBranches_kt {
36
->
{
37
};
37
->
{
38
};
38
->
{
39
};
39
->
{
17
};
39
->
{
40
}
[
style
=
dotted
]
;
39
->
{
17
}
[
color
=
green
style
=
dashed
]
;
40
->
{
41
}
[
style
=
dotted
]
;
41
->
{
42
}
[
style
=
dotted
]
;
42
->
{
29
}
[
style
=
dotted
]
;
...
...
@@ -133,7 +133,7 @@ digraph boundSmartcastsInBranches_kt {
44
->
{
45
};
45
->
{
46
};
46
->
{
47
};
47
->
{
19
};
47
->
{
19
}
[
color
=
green
style
=
dashed
]
;
subgraph
cluster_12
{
color
=
red
...
...
compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/dataFlowInfoFromWhileCondition.dot
浏览文件 @
950bbfe3
...
...
@@ -91,6 +91,6 @@ digraph dataFlowInfoFromWhileCondition_kt {
26
->
{
27
};
27
->
{
28
};
28
->
{
29
};
29
->
{
14
};
29
->
{
14
}
[
color
=
green
style
=
dashed
]
;
}
compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/endlessLoops.dot
浏览文件 @
950bbfe3
...
...
@@ -93,7 +93,7 @@ digraph endlessLoops_kt {
25
->
{
16
}
[
style
=
dotted
]
;
26
->
{
16
};
27
->
{
28
};
28
->
{
8
};
28
->
{
8
}
[
color
=
green
style
=
dashed
]
;
29
->
{
30
};
30
->
{
5
};
...
...
@@ -173,7 +173,7 @@ digraph endlessLoops_kt {
52
->
{
41
}
[
style
=
dotted
]
;
53
->
{
41
};
54
->
{
55
};
55
->
{
35
};
55
->
{
35
}
[
color
=
green
style
=
dashed
]
;
56
->
{
57
};
57
->
{
32
};
...
...
@@ -287,7 +287,7 @@ digraph endlessLoops_kt {
91
->
{
82
}
[
style
=
dotted
]
;
92
->
{
82
};
93
->
{
94
};
94
->
{
62
};
94
->
{
62
}
[
color
=
green
style
=
dashed
]
;
95
->
{
96
};
96
->
{
59
};
...
...
@@ -372,7 +372,7 @@ digraph endlessLoops_kt {
120
->
{
121
}
[
style
=
dotted
]
;
121
->
{
122
}
[
style
=
dotted
]
;
122
->
{
123
}
[
style
=
dotted
]
;
123
->
{
101
}
[
style
=
dotted
]
;
123
->
{
101
}
[
color
=
green
style
=
dotted
]
;
124
->
{
125
};
125
->
{
98
};
...
...
@@ -451,8 +451,8 @@ digraph endlessLoops_kt {
147
->
{
148
};
148
->
{
149
};
149
->
{
150
};
150
->
{
130
};
150
->
{
129
}
[
style
=
dotted
]
;
150
->
{
130
}
[
color
=
green
style
=
dashed
]
;
151
->
{
152
};
152
->
{
127
};
...
...
@@ -531,8 +531,8 @@ digraph endlessLoops_kt {
174
->
{
175
};
175
->
{
176
};
176
->
{
177
};
177
->
{
157
};
177
->
{
156
}
[
style
=
dotted
]
;
177
->
{
157
}
[
color
=
green
style
=
dashed
]
;
178
->
{
179
};
179
->
{
154
};
...
...
@@ -577,8 +577,8 @@ digraph endlessLoops_kt {
189
->
{
190
};
190
->
{
191
};
191
->
{
192
};
192
->
{
184
};
192
->
{
183
}
[
style
=
dotted
]
;
192
->
{
184
}
[
color
=
green
style
=
dashed
]
;
193
->
{
194
}
[
style
=
dotted
]
;
194
->
{
181
}
[
style
=
dotted
]
;
...
...
compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastToNothing.dot
浏览文件 @
950bbfe3
...
...
@@ -250,7 +250,7 @@ digraph smartcastToNothing_kt {
81
->
{
70
}
[
style
=
dotted
]
;
82
->
{
70
}
[
style
=
dotted
]
;
83
->
{
84
}
[
style
=
dotted
]
;
84
->
{
56
}
[
style
=
dotted
]
;
84
->
{
56
}
[
color
=
green
style
=
dotted
]
;
85
->
{
86
87
};
86
->
{
88
};
87
->
{
48
}
[
style
=
dotted
]
;
...
...
compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromLibrary/callsInPlace.dot
浏览文件 @
950bbfe3
...
...
@@ -59,8 +59,8 @@ digraph callsInPlace_kt {
17
->
{
18
};
18
->
{
14
};
19
->
{
20
21
};
20
->
{
19
};
20
->
{
17
}
[
color
=
green
]
;
20
->
{
19
}
[
color
=
green
style
=
dashed
]
;
21
->
{
20
};
subgraph
cluster_4
{
...
...
@@ -85,8 +85,8 @@ digraph callsInPlace_kt {
26
->
{
27
};
27
->
{
23
};
28
->
{
29
30
};
29
->
{
28
};
29
->
{
25
}
[
color
=
green
]
;
29
->
{
28
}
[
color
=
green
style
=
dashed
]
;
30
->
{
29
};
subgraph
cluster_6
{
...
...
@@ -203,12 +203,12 @@ digraph callsInPlace_kt {
68
->
{
69
};
69
->
{
64
};
70
->
{
71
72
};
71
->
{
70
};
71
->
{
66
}
[
color
=
green
]
;
71
->
{
70
}
[
color
=
green
style
=
dashed
]
;
72
->
{
71
};
73
->
{
74
75
};
74
->
{
73
};
74
->
{
68
}
[
color
=
green
]
;
74
->
{
73
}
[
color
=
green
style
=
dashed
]
;
75
->
{
74
};
subgraph
cluster_14
{
...
...
@@ -242,12 +242,12 @@ digraph callsInPlace_kt {
81
->
{
82
};
82
->
{
77
};
83
->
{
84
85
};
84
->
{
83
};
84
->
{
79
}
[
color
=
green
]
;
84
->
{
83
}
[
color
=
green
style
=
dashed
]
;
85
->
{
84
};
86
->
{
87
88
};
87
->
{
86
};
87
->
{
81
}
[
color
=
green
]
;
87
->
{
86
}
[
color
=
green
style
=
dashed
]
;
88
->
{
87
};
subgraph
cluster_17
{
...
...
compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/good/callsInPlace/atLeastOnce.dot
浏览文件 @
950bbfe3
...
...
@@ -48,8 +48,8 @@ digraph atLeastOnce_kt {
12
->
{
13
};
13
->
{
7
};
14
->
{
16
};
15
->
{
14
};
15
->
{
10
}
[
color
=
green
]
;
15
->
{
14
}
[
color
=
green
style
=
dashed
]
;
16
->
{
17
};
17
->
{
15
};
...
...
@@ -80,8 +80,8 @@ digraph atLeastOnce_kt {
24
->
{
25
};
25
->
{
19
};
26
->
{
28
};
27
->
{
26
};
27
->
{
22
}
[
color
=
green
]
;
27
->
{
26
}
[
color
=
green
style
=
dashed
]
;
28
->
{
29
};
29
->
{
27
};
...
...
compiler/fir/analysis-tests/testData/resolveWithStdlib/contracts/fromSource/good/callsInPlace/unknown.dot
浏览文件 @
950bbfe3
...
...
@@ -48,8 +48,8 @@ digraph unknown_kt {
12
->
{
13
};
13
->
{
7
};
14
->
{
15
16
};
15
->
{
14
};
15
->
{
10
}
[
color
=
green
]
;
15
->
{
14
}
[
color
=
green
style
=
dashed
]
;
16
->
{
17
};
17
->
{
15
};
...
...
@@ -80,8 +80,8 @@ digraph unknown_kt {
24
->
{
25
};
25
->
{
19
};
26
->
{
27
28
};
27
->
{
26
};
27
->
{
22
}
[
color
=
green
]
;
27
->
{
26
}
[
color
=
green
style
=
dashed
]
;
28
->
{
29
};
29
->
{
27
};
...
...
compiler/fir/analysis-tests/testData/resolveWithStdlib/smartcasts/tryWithLambdaInside.dot
浏览文件 @
950bbfe3
...
...
@@ -94,8 +94,8 @@ finally {
23
->
{
24
}
[
style
=
dotted
]
;
24
->
{
8
}
[
style
=
dotted
]
;
25
->
{
26
27
};
26
->
{
25
};
26
->
{
16
}
[
color
=
green
]
;
26
->
{
25
}
[
color
=
green
style
=
dashed
]
;
27
->
{
26
};
subgraph
cluster_9
{
...
...
compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraph.kt
浏览文件 @
950bbfe3
...
...
@@ -69,9 +69,11 @@ class ControlFlowGraph(val declaration: FirDeclaration?, val name: String, val k
}
}
enum
class
EdgeKind
(
val
usedInDfa
:
Boolean
)
{
Simple
(
usedInDfa
=
true
),
Dead
(
usedInDfa
=
false
),
Cfg
(
usedInDfa
=
false
),
Dfg
(
usedInDfa
=
true
)
enum
class
EdgeKind
(
val
usedInDfa
:
Boolean
,
val
isBack
:
Boolean
)
{
Simple
(
usedInDfa
=
true
,
isBack
=
false
),
Dead
(
usedInDfa
=
false
,
isBack
=
false
),
Cfg
(
usedInDfa
=
false
,
isBack
=
false
),
Dfg
(
usedInDfa
=
true
,
isBack
=
false
),
Back
(
usedInDfa
=
false
,
isBack
=
true
),
DeadBack
(
usedInDfa
=
false
,
isBack
=
true
)
}
compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphBuilder.kt
浏览文件 @
950bbfe3
...
...
@@ -151,7 +151,7 @@ class ControlFlowGraphBuilder {
val
enterNode
=
functionEnterNodes
.
pop
()
@Suppress
(
"NON_EXHAUSTIVE_WHEN"
)
when
(
invocationKind
)
{
InvocationKind
.
AT_LEAST_ONCE
,
InvocationKind
.
UNKNOWN
->
add
Edge
(
exitNode
,
enterNode
,
propagateDeadness
=
fals
e
)
InvocationKind
.
AT_LEAST_ONCE
,
InvocationKind
.
UNKNOWN
->
add
BackEdge
(
exitNode
,
enterNod
e
)
}
if
(
postponedExitNode
!=
null
)
{
CFGNode
.
addEdge
(
lastNodes
.
pop
(),
postponedExitNode
,
propagateDeadness
=
true
,
kind
=
EdgeKind
.
Cfg
)
...
...
@@ -399,7 +399,7 @@ class ControlFlowGraphBuilder {
is
FirBreakExpression
->
loopExitNodes
[
jump
.
target
.
labeledElement
]
else
->
throw
IllegalArgumentException
(
"Unknown jump type: ${jump.render()}"
)
}
addNodeWithJump
(
node
,
nextNode
)
addNodeWithJump
(
node
,
nextNode
,
isBack
=
jump
is
FirContinueExpression
)
return
node
}
...
...
@@ -502,7 +502,7 @@ class ControlFlowGraphBuilder {
if
(
lastNodes
.
isNotEmpty
)
{
val
conditionEnterNode
=
lastNodes
.
pop
()
require
(
conditionEnterNode
is
LoopConditionEnterNode
)
{
loop
.
render
()
}
add
Edge
(
loopBlockExitNode
,
conditionEnterNode
,
propagateDeadness
=
fals
e
)
add
BackEdge
(
loopBlockExitNode
,
conditionEnterNod
e
)
}
val
loopExitNode
=
loopExitNodes
.
pop
()
loopExitNode
.
updateDeadStatus
()
...
...
@@ -543,7 +543,7 @@ class ControlFlowGraphBuilder {
addEdge
(
lastNodes
.
pop
(),
conditionExitNode
)
val
blockEnterNode
=
lastNodes
.
pop
()
require
(
blockEnterNode
is
LoopBlockEnterNode
)
add
Edge
(
conditionExitNode
,
blockEnterNode
,
propagateDeadness
=
fals
e
,
isDead
=
conditionBooleanValue
==
false
)
add
BackEdge
(
conditionExitNode
,
blockEnterNod
e
,
isDead
=
conditionBooleanValue
==
false
)
val
loopExit
=
loopExitNodes
.
pop
()
addEdge
(
conditionExitNode
,
loopExit
,
propagateDeadness
=
false
,
isDead
=
conditionBooleanValue
==
true
)
loopExit
.
updateDeadStatus
()
...
...
@@ -903,13 +903,17 @@ class ControlFlowGraphBuilder {
* it will be replaced after correct implementation of CFG for class initialization
*/
val
exitNode
:
CFGNode
<
*
>
=
exitNodes
.
top
()
addNodeWithJump
(
node
,
exitNode
,
preferredKind
)
addNodeWithJump
(
node
,
exitNode
)
}
private
fun
addNodeWithJump
(
node
:
CFGNode
<
*
>,
targetNode
:
CFGNode
<
*
>?,
preferredKind
:
EdgeKind
=
EdgeKind
.
Simpl
e
)
{
private
fun
addNodeWithJump
(
node
:
CFGNode
<
*
>,
targetNode
:
CFGNode
<
*
>?,
isBack
:
Boolean
=
fals
e
)
{
addEdge
(
lastNodes
.
pop
(),
node
)
if
(
targetNode
!=
null
)
{
addEdge
(
node
,
targetNode
)
if
(
isBack
)
{
addBackEdge
(
node
,
targetNode
)
}
else
{
addEdge
(
node
,
targetNode
)
}
}
val
stub
=
createStubNode
()
addEdge
(
node
,
stub
)
...
...
@@ -933,12 +937,23 @@ class ControlFlowGraphBuilder {
to
:
CFGNode
<
*
>,
propagateDeadness
:
Boolean
=
true
,
isDead
:
Boolean
=
false
,
preferredKind
:
EdgeKind
=
EdgeKind
.
Simple
isBack
:
Boolean
=
false
,
preferredKind
:
EdgeKind
=
EdgeKind
.
Simple
,
)
{
val
kind
=
if
(
isDead
||
from
.
isDead
||
to
.
isDead
)
EdgeKind
.
Dead
else
preferredKind
val
kind
=
if
(
isDead
||
from
.
isDead
||
to
.
isDead
)
{
if
(
isBack
)
EdgeKind
.
DeadBack
else
EdgeKind
.
Dead
}
else
preferredKind
CFGNode
.
addEdge
(
from
,
to
,
kind
,
propagateDeadness
)
}
private
fun
addBackEdge
(
from
:
CFGNode
<
*
>,
to
:
CFGNode
<
*
>,
isDead
:
Boolean
=
false
)
{
addEdge
(
from
,
to
,
propagateDeadness
=
false
,
isDead
=
isDead
,
isBack
=
true
,
preferredKind
=
EdgeKind
.
Back
)
}
private
val
FirFunction
<*>.
invocationKind
:
InvocationKind
?
get
()
=
(
this
as
?
FirAnonymousFunction
)
?.
invocationKind
...
...
compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphRenderer.kt
浏览文件 @
950bbfe3
...
...
@@ -30,6 +30,8 @@ class FirControlFlowGraphRenderVisitor(
EdgeKind
.
Dead
to
"[style=dotted]"
,
EdgeKind
.
Cfg
to
"[color=green]"
,
EdgeKind
.
Dfg
to
"[color=red]"
,
EdgeKind
.
Back
to
"[color=green style=dashed]"
,
EdgeKind
.
DeadBack
to
"[color=green style=dotted]"
)
)
}
...
...
compiler/tests-common/tests/org/jetbrains/kotlin/fir/AbstractFirDiagnosticTest.kt
浏览文件 @
950bbfe3
...
...
@@ -308,7 +308,7 @@ abstract class AbstractFirDiagnosticsTest : AbstractFirBaseDiagnosticsTest() {
val
toKind
=
to
.
incomingEdges
.
getValue
(
from
)
TestCase
.
assertEquals
(
fromKind
,
toKind
)
if
(
from
.
isDead
||
to
.
isDead
)
{
KtUsefulTestCase
.
assertContainsElements
(
listOf
(
EdgeKind
.
Dead
,
EdgeKind
.
Cfg
),
toKind
)
KtUsefulTestCase
.
assertContainsElements
(
listOf
(
EdgeKind
.
Dead
,
EdgeKind
.
Cfg
,
EdgeKind
.
DeadBack
,
EdgeKind
.
Back
),
toKind
)
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录