@@ -5,11 +5,16 @@ DEBUG_METADATA_VERSION()
5
5
Context () do ctx
6
6
if LLVM. version () < v " 8.0"
7
7
mod = parse (LLVM. Module, """
8
- define void @fun () !dbg !5 {
8
+ define void @foo () !dbg !5 {
9
9
top:
10
10
ret void, !dbg !7
11
11
}
12
12
13
+ define void @bar() {
14
+ top:
15
+ ret void
16
+ }
17
+
13
18
!llvm.module.flags = !{!0, !1}
14
19
!llvm.dbg.cu = !{!2}
15
20
@@ -18,16 +23,21 @@ Context() do ctx
18
23
!2 = distinct !DICompileUnit(language: DW_LANG_C89, file: !3, producer: "julia", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4)
19
24
!3 = !DIFile(filename: "REPL[1]", directory: ".")
20
25
!4 = !{}
21
- !5 = distinct !DISubprogram(name: "foo", linkageName: "fun ", scope: null, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !2, variables: !4)
26
+ !5 = distinct !DISubprogram(name: "foo", linkageName: "foo ", scope: null, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !2, variables: !4)
22
27
!6 = !DISubroutineType(types: !4)
23
28
!7 = !DILocation(line: 1, scope: !5)""" , ctx)
24
29
else
25
30
mod = parse (LLVM. Module, """
26
- define void @fun () !dbg !5 {
31
+ define void @foo () !dbg !5 {
27
32
top:
28
33
ret void, !dbg !7
29
34
}
30
35
36
+ define void @bar() {
37
+ top:
38
+ ret void
39
+ }
40
+
31
41
!llvm.module.flags = !{!0, !1}
32
42
!llvm.dbg.cu = !{!2}
33
43
@@ -36,13 +46,24 @@ Context() do ctx
36
46
!2 = distinct !DICompileUnit(language: DW_LANG_C89, file: !3, producer: "julia", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4)
37
47
!3 = !DIFile(filename: "REPL[1]", directory: ".")
38
48
!4 = !{}
39
- !5 = distinct !DISubprogram(name: "foo", linkageName: "fun ", scope: null, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !2)
49
+ !5 = distinct !DISubprogram(name: "foo", linkageName: "foo ", scope: null, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !2)
40
50
!6 = !DISubroutineType(types: !4)
41
51
!7 = !DILocation(line: 1, scope: !5)""" , ctx)
42
52
end
43
53
44
- fun = functions (mod)[" fun" ]
45
- bb = entry (fun)
54
+ foo = functions (mod)[" foo" ]
55
+
56
+ if LLVM. version () >= v " 8.0"
57
+ sp = LLVM. get_subprogram (foo)
58
+ @test sp != = nothing
59
+
60
+ bar = functions (mod)[" bar" ]
61
+ @test LLVM. get_subprogram (bar) === nothing
62
+ LLVM. set_subprogram! (bar, sp)
63
+ @test LLVM. get_subprogram (bar) == sp
64
+ end
65
+
66
+ bb = entry (foo)
46
67
inst = first (instructions (bb))
47
68
48
69
@test ! isempty (metadata (inst))
0 commit comments