1- export DIBuilder, DICompileUnit, DILexicalBlock, DIFunction
1+ export DIBuilder, DIFile, DICompileUnit, DILexicalBlock, DIFunction
22
33@checked struct DIBuilder
44 ref:: API.LLVMDIBuilderRef
55end
6- reftype (:: Type{DIBuilder} ) = API. DILLVMDIBuilderRef
76
87# LLVMCreateDIBuilderDisallowUnresolved
9- DIBuilder (mod:: Module ) = DIBuilder (API. LLVMCreateDIBuilder (ref ( mod) ))
8+ DIBuilder (mod:: Module ) = DIBuilder (API. LLVMCreateDIBuilder (mod))
109
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)
1312
14- struct DICompileUnit
13+ Base. unsafe_convert (:: Type{API.LLVMDIBuilderRef} , builder:: DIBuilder ) = builder. ref
14+
15+ struct DIFile
1516 file:: String
1617 dir:: String
18+ end
19+
20+ struct DICompileUnit
21+ file:: Metadata
1722 language:: API.LLVMDWARFSourceLanguage
1823 producer:: String
24+ sysroot:: String
25+ sdk:: String
1926 flags:: String
2027 optimized:: Core.Bool
2128 version:: Int
2229end
2330
2431function compileunit! (builder:: DIBuilder , cu:: DICompileUnit )
25- file = file! (builder, cu. file, cu. dir)
2632 md = API. LLVMDIBuilderCreateCompileUnit (
27- ref ( builder) ,
33+ builder,
2834 cu. language,
29- ref ( file) ,
35+ cu . file,
3036 cu. producer, convert (Csize_t, length (cu. producer)),
3137 cu. optimized ? LLVM. True : LLVM. False,
3238 cu. flags, convert (Csize_t, length (cu. flags)),
@@ -36,15 +42,17 @@ function compileunit!(builder::DIBuilder, cu::DICompileUnit)
3642 #= DWOId=# 0 ,
3743 #= SplitDebugInlining=# LLVM. True,
3844 #= DebugInfoForProfiling=# LLVM. False,
45+ cu. sysroot, convert (Csize_t, length (cu. sysroot)),
46+ cu. sdk, convert (Csize_t, length (cu. sdk)),
3947 )
4048 return Metadata (md)
4149end
4250
43- function file! (builder:: DIBuilder , filename, directory )
51+ function file! (builder:: DIBuilder , file :: DIFile )
4452 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 ))
4856 )
4957 return Metadata (md)
5058end
@@ -56,10 +64,10 @@ struct DILexicalBlock
5664end
5765
5866function 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,
6371 convert (Cuint, block. line),
6472 convert (Cuint, block. column)
6573 )
6876
6977function lexicalblock! (builder:: DIBuilder , scope:: Metadata , file:: Metadata , discriminator)
7078 md = API. LLVMDIBuilderCreateLexicalBlockFile (
71- ref ( builder) ,
72- ref ( scope) ,
73- ref ( file) ,
79+ builder,
80+ scope,
81+ file,
7482 convert (Cuint, discriminator)
7583 )
7684 Metadata (md)
9199
92100function subprogram! (builder:: DIBuilder , scope:: Metadata , f:: DIFunction )
93101 md = API. LLVMDIBuilderCreateFunction (
94- ref ( builder) ,
95- ref ( scope) ,
102+ builder,
103+ scope,
96104 f. name, convert (Csize_t, length (f. name)),
97105 f. linkageName, convert (Csize_t, length (f. linkageName)),
98- ref ( f. file) ,
106+ f. file,
99107 f. line,
100- ref ( f. type) ,
108+ f. type,
101109 f. localToUnit ? LLVM. True : LLVM. False,
102110 f. isDefinition ? LLVM. True : LLVM. False,
103111 convert (Cuint, f. scopeLine),
111119
112120function basictype! (builder:: DIBuilder , name, size, encoding)
113121 md = LLVM. API. LLVMDIBuilderCreateBasicType (
114- ref ( builder) ,
122+ builder,
115123 name,
116124 convert (Csize_t, length (name)),
117125 convert (UInt64, size),
123131
124132function pointertype! (builder:: DIBuilder , pointee:: Metadata , size, as, align= 0 , name= " " )
125133 md = LLVM. API. LLVMDIBuilderCreatePointerType (
126- ref ( builder) ,
127- ref ( pointee) ,
134+ builder,
135+ pointee,
128136 convert (UInt64, size),
129137 convert (UInt32, align),
130138 convert (Cuint, as),
137145function subroutinetype! (builder:: DIBuilder , file:: Metadata , rettype, paramtypes... )
138146 params = collect (ref (x) for x in (rettype, paramtypes... ))
139147 md = LLVM. API. LLVMDIBuilderCreateSubroutineType (
140- ref ( builder) ,
141- ref ( file) ,
148+ builder,
149+ file,
142150 params,
143151 length (params),
144152 LLVM. API. LLVMDIFlagZero
0 commit comments