@@ -13,19 +13,20 @@ use debuginfo::{DIBuilderRef, DIDescriptor,
13
13
DIBasicType , DIDerivedType , DICompositeType , DIScope ,
14
14
DIVariable , DIGlobalVariable , DIArray , DISubrange ,
15
15
DITemplateTypeParameter , DIEnumerator , DINameSpace } ;
16
- use RustStringRef ;
17
16
18
- use libc:: { c_uint, c_ushort , c_int, size_t, c_char} ;
17
+ use libc:: { c_uint, c_int, size_t, c_char} ;
19
18
use libc:: { c_longlong, c_ulonglong, c_void} ;
20
19
20
+ use RustStringRef ;
21
+
21
22
pub type Opcode = u32 ;
22
23
pub type Bool = c_uint ;
23
24
24
25
pub const True : Bool = 1 as Bool ;
25
26
pub const False : Bool = 0 as Bool ;
26
27
27
- #[ repr( C ) ]
28
28
#[ derive( Copy , Clone , PartialEq ) ]
29
+ #[ repr( C ) ]
29
30
pub enum LLVMRustResult {
30
31
Success ,
31
32
Failure ,
@@ -68,23 +69,22 @@ pub enum Linkage {
68
69
}
69
70
70
71
/// LLVMDiagnosticSeverity
71
- #[ repr( C ) ]
72
72
#[ derive( Copy , Clone , Debug ) ]
73
+ #[ repr( C ) ]
73
74
pub enum DiagnosticSeverity {
74
75
Error = 0 ,
75
76
Warning = 1 ,
76
77
Remark = 2 ,
77
78
Note = 3 ,
78
79
}
79
80
80
- /// LLVMRustDLLStorageClassTypes
81
- #[ repr( C ) ]
81
+ /// LLVMDLLStorageClass
82
82
#[ derive( Copy , Clone ) ]
83
- pub enum DLLStorageClassTypes {
84
- Other ,
85
- Default ,
86
- DllImport ,
87
- DllExport ,
83
+ # [ repr ( C ) ]
84
+ pub enum DLLStorageClass {
85
+ Default = 0 ,
86
+ DllImport = 1 , /* Function to be imported from DLL. */
87
+ DllExport = 2 , /* Function to be accessible from DLL. */
88
88
}
89
89
90
90
bitflags ! {
@@ -144,6 +144,7 @@ bitflags! {
144
144
145
145
/// LLVMIntPredicate
146
146
#[ derive( Copy , Clone ) ]
147
+ #[ repr( C ) ]
147
148
pub enum IntPredicate {
148
149
IntEQ = 32 ,
149
150
IntNE = 33 ,
@@ -159,6 +160,7 @@ pub enum IntPredicate {
159
160
160
161
/// LLVMRealPredicate
161
162
#[ derive( Copy , Clone ) ]
163
+ #[ repr( C ) ]
162
164
pub enum RealPredicate {
163
165
RealPredicateFalse = 0 ,
164
166
RealOEQ = 1 ,
@@ -178,7 +180,7 @@ pub enum RealPredicate {
178
180
RealPredicateTrue = 15 ,
179
181
}
180
182
181
- /// LLVMTypeKind; FIXME: wrap
183
+ /// LLVMTypeKind
182
184
#[ derive( Copy , Clone , PartialEq , Debug ) ]
183
185
#[ repr( C ) ]
184
186
pub enum TypeKind {
@@ -198,11 +200,12 @@ pub enum TypeKind {
198
200
Vector = 13 ,
199
201
Metadata = 14 ,
200
202
X86_MMX = 15 ,
203
+ Token = 16 ,
201
204
}
202
205
203
206
/// LLVMAtomicRmwBinOp
204
- #[ repr( C ) ]
205
207
#[ derive( Copy , Clone ) ]
208
+ #[ repr( C ) ]
206
209
pub enum AtomicRmwBinOp {
207
210
AtomicXchg = 0 ,
208
211
AtomicAdd = 1 ,
@@ -218,8 +221,8 @@ pub enum AtomicRmwBinOp {
218
221
}
219
222
220
223
/// LLVMAtomicOrdering
221
- #[ repr( C ) ]
222
224
#[ derive( Copy , Clone ) ]
225
+ #[ repr( C ) ]
223
226
pub enum AtomicOrdering {
224
227
NotAtomic = 0 ,
225
228
Unordered = 1 ,
@@ -232,25 +235,27 @@ pub enum AtomicOrdering {
232
235
}
233
236
234
237
/// LLVMRustSynchronizationScope
235
- #[ repr( C ) ]
236
238
#[ derive( Copy , Clone ) ]
239
+ #[ repr( C ) ]
237
240
pub enum SynchronizationScope {
238
241
Other ,
239
242
SingleThread ,
240
243
CrossThread ,
241
244
}
242
245
243
246
/// LLVMRustFileType
244
- #[ repr( C ) ]
245
247
#[ derive( Copy , Clone ) ]
248
+ #[ repr( C ) ]
246
249
pub enum FileType {
247
250
Other ,
248
251
AssemblyFile ,
249
252
ObjectFile ,
250
253
}
251
254
252
- /// FIXME: ?
255
+ /// Enum pinned in LLVMContext, used in
256
+ /// LLVMSetMetadata so ABI-stable.
253
257
#[ derive( Copy , Clone ) ]
258
+ #[ repr( C ) ]
254
259
pub enum MetadataType {
255
260
MD_dbg = 0 ,
256
261
MD_tbaa = 1 ,
@@ -266,11 +271,13 @@ pub enum MetadataType {
266
271
MD_nonnull = 11 ,
267
272
}
268
273
269
- /// FIXME: ?
274
+ /// LLVMRustAsmDialect
270
275
#[ derive( Copy , Clone ) ]
276
+ #[ repr( C ) ]
271
277
pub enum AsmDialect {
272
- AD_ATT = 0 ,
273
- AD_Intel = 1
278
+ Other ,
279
+ Att ,
280
+ Intel ,
274
281
}
275
282
276
283
/// LLVMRustCodeGenOptLevel
@@ -295,8 +302,8 @@ pub enum RelocMode {
295
302
}
296
303
297
304
/// LLVMRustCodeModel
298
- #[ repr( C ) ]
299
305
#[ derive( Copy , Clone ) ]
306
+ #[ repr( C ) ]
300
307
pub enum CodeModel {
301
308
Other ,
302
309
Default ,
@@ -308,8 +315,8 @@ pub enum CodeModel {
308
315
}
309
316
310
317
/// LLVMRustDiagnosticKind
311
- #[ repr( C ) ]
312
318
#[ derive( Copy , Clone ) ]
319
+ #[ repr( C ) ]
313
320
pub enum DiagnosticKind {
314
321
Other ,
315
322
InlineAsm ,
@@ -326,15 +333,16 @@ pub enum DiagnosticKind {
326
333
}
327
334
328
335
/// LLVMRustArchiveKind
329
- #[ repr( C ) ]
330
336
#[ derive( Copy , Clone ) ]
337
+ #[ repr( C ) ]
331
338
pub enum ArchiveKind {
332
339
Other ,
333
340
K_GNU ,
334
341
K_MIPS64 ,
335
342
K_BSD ,
336
343
K_COFF ,
337
344
}
345
+
338
346
/// LLVMRustPassKind
339
347
#[ derive( Copy , Clone , PartialEq , Debug ) ]
340
348
#[ repr( C ) ]
@@ -519,7 +527,7 @@ extern {
519
527
pub fn LLVMSetModuleInlineAsm ( M : ModuleRef , Asm : * const c_char ) ;
520
528
521
529
/// See llvm::LLVMTypeKind::getTypeID.
522
- pub fn LLVMGetTypeKind ( Ty : TypeRef ) -> TypeKind ;
530
+ pub fn LLVMRustGetTypeKind ( Ty : TypeRef ) -> TypeKind ;
523
531
524
532
/// See llvm::LLVMType::getContext.
525
533
pub fn LLVMGetTypeContext ( Ty : TypeRef ) -> ContextRef ;
@@ -589,8 +597,6 @@ extern {
589
597
pub fn LLVMSetValueName ( Val : ValueRef , Name : * const c_char ) ;
590
598
pub fn LLVMDumpValue ( Val : ValueRef ) ;
591
599
pub fn LLVMReplaceAllUsesWith ( OldVal : ValueRef , NewVal : ValueRef ) ;
592
- pub fn LLVMHasMetadata ( Val : ValueRef ) -> c_int ;
593
- pub fn LLVMGetMetadata ( Val : ValueRef , KindID : c_uint ) -> ValueRef ;
594
600
pub fn LLVMSetMetadata ( Val : ValueRef , KindID : c_uint , Node : ValueRef ) ;
595
601
596
602
/* Operations on Uses */
@@ -608,9 +614,9 @@ extern {
608
614
pub fn LLVMConstNull ( Ty : TypeRef ) -> ValueRef ;
609
615
/* all zeroes */
610
616
pub fn LLVMConstAllOnes ( Ty : TypeRef ) -> ValueRef ;
611
- pub fn LLVMConstICmp ( Pred : c_ushort , V1 : ValueRef , V2 : ValueRef )
617
+ pub fn LLVMConstICmp ( Pred : IntPredicate , V1 : ValueRef , V2 : ValueRef )
612
618
-> ValueRef ;
613
- pub fn LLVMConstFCmp ( Pred : c_ushort , V1 : ValueRef , V2 : ValueRef )
619
+ pub fn LLVMConstFCmp ( Pred : RealPredicate , V1 : ValueRef , V2 : ValueRef )
614
620
-> ValueRef ;
615
621
/* only for isize/vector */
616
622
pub fn LLVMGetUndef ( Ty : TypeRef ) -> ValueRef ;
@@ -815,13 +821,15 @@ extern {
815
821
pub fn LLVMGetGlobalParent ( Global : ValueRef ) -> ModuleRef ;
816
822
pub fn LLVMIsDeclaration ( Global : ValueRef ) -> Bool ;
817
823
pub fn LLVMGetLinkage ( Global : ValueRef ) -> c_uint ;
818
- pub fn LLVMSetLinkage ( Global : ValueRef , Link : c_uint ) ;
824
+ pub fn LLVMSetLinkage ( Global : ValueRef , Link : Linkage ) ;
819
825
pub fn LLVMGetSection ( Global : ValueRef ) -> * const c_char ;
820
826
pub fn LLVMSetSection ( Global : ValueRef , Section : * const c_char ) ;
821
827
pub fn LLVMGetVisibility ( Global : ValueRef ) -> c_uint ;
822
828
pub fn LLVMSetVisibility ( Global : ValueRef , Viz : c_uint ) ;
823
829
pub fn LLVMGetAlignment ( Global : ValueRef ) -> c_uint ;
824
830
pub fn LLVMSetAlignment ( Global : ValueRef , Bytes : c_uint ) ;
831
+ pub fn LLVMSetDLLStorageClass ( V : ValueRef ,
832
+ C : DLLStorageClass ) ;
825
833
826
834
827
835
/* Operations on global variables */
@@ -1685,7 +1693,7 @@ extern {
1685
1693
Constraints : * const c_char ,
1686
1694
SideEffects : Bool ,
1687
1695
AlignStack : Bool ,
1688
- Dialect : c_uint )
1696
+ Dialect : AsmDialect )
1689
1697
-> ValueRef ;
1690
1698
1691
1699
pub fn LLVMRustDebugMetadataVersion ( ) -> u32 ;
@@ -1990,9 +1998,6 @@ extern {
1990
1998
pub fn LLVMRustArchiveIteratorFree ( AIR : ArchiveIteratorRef ) ;
1991
1999
pub fn LLVMRustDestroyArchive ( AR : ArchiveRef ) ;
1992
2000
1993
- pub fn LLVMRustSetDLLStorageClass ( V : ValueRef ,
1994
- C : DLLStorageClassTypes ) ;
1995
-
1996
2001
pub fn LLVMRustGetSectionName ( SI : SectionIteratorRef ,
1997
2002
data : * mut * const c_char ) -> size_t ;
1998
2003
0 commit comments