1
- export DIBuilder, DICompileUnit, DILexicalBlock, DIFunction
1
+ export DIBuilder, DIFile, DICompileUnit, DILexicalBlock, DIFunction
2
2
3
3
@checked struct DIBuilder
4
4
ref:: API.LLVMDIBuilderRef
5
5
end
6
- reftype (:: Type{DIBuilder} ) = API. DILLVMDIBuilderRef
7
6
8
7
# LLVMCreateDIBuilderDisallowUnresolved
9
- DIBuilder (mod:: Module ) = DIBuilder (API. LLVMCreateDIBuilder (ref ( mod) ))
8
+ DIBuilder (mod:: Module ) = DIBuilder (API. LLVMCreateDIBuilder (mod))
10
9
11
- dispose (builder:: DIBuilder ) = API. LLVMDisposeDIBuilder (ref ( builder) )
12
- finalize (builder:: DIBuilder ) = API. LLVMDIBuilderFinalize (ref ( builder) )
10
+ dispose (builder:: DIBuilder ) = API. LLVMDisposeDIBuilder (builder)
11
+ finalize (builder:: DIBuilder ) = API. LLVMDIBuilderFinalize (builder)
13
12
14
- struct DICompileUnit
13
+ Base. unsafe_convert (:: Type{API.LLVMDIBuilderRef} , builder:: DIBuilder ) = builder. ref
14
+
15
+ struct DIFile
15
16
file:: String
16
17
dir:: String
18
+ end
19
+
20
+ struct DICompileUnit
21
+ file:: Metadata
17
22
language:: API.LLVMDWARFSourceLanguage
18
23
producer:: String
24
+ sysroot:: String
25
+ sdk:: String
19
26
flags:: String
20
27
optimized:: Core.Bool
21
28
version:: Int
22
29
end
23
30
24
31
function compileunit! (builder:: DIBuilder , cu:: DICompileUnit )
25
- file = file! (builder, cu. file, cu. dir)
26
32
md = API. LLVMDIBuilderCreateCompileUnit (
27
- ref ( builder) ,
33
+ builder,
28
34
cu. language,
29
- ref ( file) ,
35
+ cu . file,
30
36
cu. producer, convert (Csize_t, length (cu. producer)),
31
37
cu. optimized ? LLVM. True : LLVM. False,
32
38
cu. flags, convert (Csize_t, length (cu. flags)),
@@ -36,15 +42,17 @@ function compileunit!(builder::DIBuilder, cu::DICompileUnit)
36
42
#= DWOId=# 0 ,
37
43
#= SplitDebugInlining=# LLVM. True,
38
44
#= DebugInfoForProfiling=# LLVM. False,
45
+ cu. sysroot, convert (Csize_t, length (cu. sysroot)),
46
+ cu. sdk, convert (Csize_t, length (cu. sdk)),
39
47
)
40
48
return Metadata (md)
41
49
end
42
50
43
- function file! (builder:: DIBuilder , filename, directory )
51
+ function file! (builder:: DIBuilder , file :: DIFile )
44
52
md = API. LLVMDIBuilderCreateFile (
45
- ref ( builder) ,
46
- filename , convert (Csize_t, length (filename )),
47
- directory , convert (Csize_t, length (directory ))
53
+ builder,
54
+ file . file , convert (Csize_t, length (file . file )),
55
+ file . dir , convert (Csize_t, length (file . dir ))
48
56
)
49
57
return Metadata (md)
50
58
end
@@ -56,10 +64,10 @@ struct DILexicalBlock
56
64
end
57
65
58
66
function lexicalblock! (builder:: DIBuilder , scope:: Metadata , block:: DILexicalBlock )
59
- md = API. LLVMDIBuilerCreateLexicalBlock (
60
- ref ( builder) ,
61
- ref ( scope) ,
62
- ref ( block. file) ,
67
+ md = API. LLVMDIBuilderCreateLexicalBlock (
68
+ builder,
69
+ scope,
70
+ block. file,
63
71
convert (Cuint, block. line),
64
72
convert (Cuint, block. column)
65
73
)
68
76
69
77
function lexicalblock! (builder:: DIBuilder , scope:: Metadata , file:: Metadata , discriminator)
70
78
md = API. LLVMDIBuilderCreateLexicalBlockFile (
71
- ref ( builder) ,
72
- ref ( scope) ,
73
- ref ( file) ,
79
+ builder,
80
+ scope,
81
+ file,
74
82
convert (Cuint, discriminator)
75
83
)
76
84
Metadata (md)
91
99
92
100
function subprogram! (builder:: DIBuilder , scope:: Metadata , f:: DIFunction )
93
101
md = API. LLVMDIBuilderCreateFunction (
94
- ref ( builder) ,
95
- ref ( scope) ,
102
+ builder,
103
+ scope,
96
104
f. name, convert (Csize_t, length (f. name)),
97
105
f. linkageName, convert (Csize_t, length (f. linkageName)),
98
- ref ( f. file) ,
106
+ f. file,
99
107
f. line,
100
- ref ( f. type) ,
108
+ f. type,
101
109
f. localToUnit ? LLVM. True : LLVM. False,
102
110
f. isDefinition ? LLVM. True : LLVM. False,
103
111
convert (Cuint, f. scopeLine),
111
119
112
120
function basictype! (builder:: DIBuilder , name, size, encoding)
113
121
md = LLVM. API. LLVMDIBuilderCreateBasicType (
114
- ref ( builder) ,
122
+ builder,
115
123
name,
116
124
convert (Csize_t, length (name)),
117
125
convert (UInt64, size),
123
131
124
132
function pointertype! (builder:: DIBuilder , pointee:: Metadata , size, as, align= 0 , name= " " )
125
133
md = LLVM. API. LLVMDIBuilderCreatePointerType (
126
- ref ( builder) ,
127
- ref ( pointee) ,
134
+ builder,
135
+ pointee,
128
136
convert (UInt64, size),
129
137
convert (UInt32, align),
130
138
convert (Cuint, as),
137
145
function subroutinetype! (builder:: DIBuilder , file:: Metadata , rettype, paramtypes... )
138
146
params = collect (ref (x) for x in (rettype, paramtypes... ))
139
147
md = LLVM. API. LLVMDIBuilderCreateSubroutineType (
140
- ref ( builder) ,
141
- ref ( file) ,
148
+ builder,
149
+ file,
142
150
params,
143
151
length (params),
144
152
LLVM. API. LLVMDIFlagZero
0 commit comments