@@ -13,19 +13,20 @@ use debuginfo::{DIBuilderRef, DIDescriptor,
1313 DIBasicType , DIDerivedType , DICompositeType , DIScope ,
1414 DIVariable , DIGlobalVariable , DIArray , DISubrange ,
1515 DITemplateTypeParameter , DIEnumerator , DINameSpace } ;
16- use RustStringRef ;
1716
18- use libc:: { c_uint, c_ushort , c_int, size_t, c_char} ;
17+ use libc:: { c_uint, c_int, size_t, c_char} ;
1918use libc:: { c_longlong, c_ulonglong, c_void} ;
2019
20+ use RustStringRef ;
21+
2122pub type Opcode = u32 ;
2223pub type Bool = c_uint ;
2324
2425pub const True : Bool = 1 as Bool ;
2526pub const False : Bool = 0 as Bool ;
2627
27- #[ repr( C ) ]
2828#[ derive( Copy , Clone , PartialEq ) ]
29+ #[ repr( C ) ]
2930pub enum LLVMRustResult {
3031 Success ,
3132 Failure ,
@@ -68,23 +69,22 @@ pub enum Linkage {
6869}
6970
7071/// LLVMDiagnosticSeverity
71- #[ repr( C ) ]
7272#[ derive( Copy , Clone , Debug ) ]
73+ #[ repr( C ) ]
7374pub enum DiagnosticSeverity {
7475 Error = 0 ,
7576 Warning = 1 ,
7677 Remark = 2 ,
7778 Note = 3 ,
7879}
7980
80- /// LLVMRustDLLStorageClassTypes
81- #[ repr( C ) ]
81+ /// LLVMDLLStorageClass
8282#[ 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. */
8888}
8989
9090bitflags ! {
@@ -144,6 +144,7 @@ bitflags! {
144144
145145/// LLVMIntPredicate
146146#[ derive( Copy , Clone ) ]
147+ #[ repr( C ) ]
147148pub enum IntPredicate {
148149 IntEQ = 32 ,
149150 IntNE = 33 ,
@@ -159,6 +160,7 @@ pub enum IntPredicate {
159160
160161/// LLVMRealPredicate
161162#[ derive( Copy , Clone ) ]
163+ #[ repr( C ) ]
162164pub enum RealPredicate {
163165 RealPredicateFalse = 0 ,
164166 RealOEQ = 1 ,
@@ -178,7 +180,7 @@ pub enum RealPredicate {
178180 RealPredicateTrue = 15 ,
179181}
180182
181- /// LLVMTypeKind; FIXME: wrap
183+ /// LLVMTypeKind
182184#[ derive( Copy , Clone , PartialEq , Debug ) ]
183185#[ repr( C ) ]
184186pub enum TypeKind {
@@ -198,11 +200,12 @@ pub enum TypeKind {
198200 Vector = 13 ,
199201 Metadata = 14 ,
200202 X86_MMX = 15 ,
203+ Token = 16 ,
201204}
202205
203206/// LLVMAtomicRmwBinOp
204- #[ repr( C ) ]
205207#[ derive( Copy , Clone ) ]
208+ #[ repr( C ) ]
206209pub enum AtomicRmwBinOp {
207210 AtomicXchg = 0 ,
208211 AtomicAdd = 1 ,
@@ -218,8 +221,8 @@ pub enum AtomicRmwBinOp {
218221}
219222
220223/// LLVMAtomicOrdering
221- #[ repr( C ) ]
222224#[ derive( Copy , Clone ) ]
225+ #[ repr( C ) ]
223226pub enum AtomicOrdering {
224227 NotAtomic = 0 ,
225228 Unordered = 1 ,
@@ -232,25 +235,27 @@ pub enum AtomicOrdering {
232235}
233236
234237/// LLVMRustSynchronizationScope
235- #[ repr( C ) ]
236238#[ derive( Copy , Clone ) ]
239+ #[ repr( C ) ]
237240pub enum SynchronizationScope {
238241 Other ,
239242 SingleThread ,
240243 CrossThread ,
241244}
242245
243246/// LLVMRustFileType
244- #[ repr( C ) ]
245247#[ derive( Copy , Clone ) ]
248+ #[ repr( C ) ]
246249pub enum FileType {
247250 Other ,
248251 AssemblyFile ,
249252 ObjectFile ,
250253}
251254
252- /// FIXME: ?
255+ /// Enum pinned in LLVMContext, used in
256+ /// LLVMSetMetadata so ABI-stable.
253257#[ derive( Copy , Clone ) ]
258+ #[ repr( C ) ]
254259pub enum MetadataType {
255260 MD_dbg = 0 ,
256261 MD_tbaa = 1 ,
@@ -266,11 +271,13 @@ pub enum MetadataType {
266271 MD_nonnull = 11 ,
267272}
268273
269- /// FIXME: ?
274+ /// LLVMRustAsmDialect
270275#[ derive( Copy , Clone ) ]
276+ #[ repr( C ) ]
271277pub enum AsmDialect {
272- AD_ATT = 0 ,
273- AD_Intel = 1
278+ Other ,
279+ Att ,
280+ Intel ,
274281}
275282
276283/// LLVMRustCodeGenOptLevel
@@ -295,8 +302,8 @@ pub enum RelocMode {
295302}
296303
297304/// LLVMRustCodeModel
298- #[ repr( C ) ]
299305#[ derive( Copy , Clone ) ]
306+ #[ repr( C ) ]
300307pub enum CodeModel {
301308 Other ,
302309 Default ,
@@ -308,8 +315,8 @@ pub enum CodeModel {
308315}
309316
310317/// LLVMRustDiagnosticKind
311- #[ repr( C ) ]
312318#[ derive( Copy , Clone ) ]
319+ #[ repr( C ) ]
313320pub enum DiagnosticKind {
314321 Other ,
315322 InlineAsm ,
@@ -326,15 +333,16 @@ pub enum DiagnosticKind {
326333}
327334
328335/// LLVMRustArchiveKind
329- #[ repr( C ) ]
330336#[ derive( Copy , Clone ) ]
337+ #[ repr( C ) ]
331338pub enum ArchiveKind {
332339 Other ,
333340 K_GNU ,
334341 K_MIPS64 ,
335342 K_BSD ,
336343 K_COFF ,
337344}
345+
338346/// LLVMRustPassKind
339347#[ derive( Copy , Clone , PartialEq , Debug ) ]
340348#[ repr( C ) ]
@@ -519,7 +527,7 @@ extern {
519527 pub fn LLVMSetModuleInlineAsm ( M : ModuleRef , Asm : * const c_char ) ;
520528
521529 /// See llvm::LLVMTypeKind::getTypeID.
522- pub fn LLVMGetTypeKind ( Ty : TypeRef ) -> TypeKind ;
530+ pub fn LLVMRustGetTypeKind ( Ty : TypeRef ) -> TypeKind ;
523531
524532 /// See llvm::LLVMType::getContext.
525533 pub fn LLVMGetTypeContext ( Ty : TypeRef ) -> ContextRef ;
@@ -589,8 +597,6 @@ extern {
589597 pub fn LLVMSetValueName ( Val : ValueRef , Name : * const c_char ) ;
590598 pub fn LLVMDumpValue ( Val : ValueRef ) ;
591599 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 ;
594600 pub fn LLVMSetMetadata ( Val : ValueRef , KindID : c_uint , Node : ValueRef ) ;
595601
596602 /* Operations on Uses */
@@ -608,9 +614,9 @@ extern {
608614 pub fn LLVMConstNull ( Ty : TypeRef ) -> ValueRef ;
609615 /* all zeroes */
610616 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 )
612618 -> ValueRef ;
613- pub fn LLVMConstFCmp ( Pred : c_ushort , V1 : ValueRef , V2 : ValueRef )
619+ pub fn LLVMConstFCmp ( Pred : RealPredicate , V1 : ValueRef , V2 : ValueRef )
614620 -> ValueRef ;
615621 /* only for isize/vector */
616622 pub fn LLVMGetUndef ( Ty : TypeRef ) -> ValueRef ;
@@ -815,13 +821,15 @@ extern {
815821 pub fn LLVMGetGlobalParent ( Global : ValueRef ) -> ModuleRef ;
816822 pub fn LLVMIsDeclaration ( Global : ValueRef ) -> Bool ;
817823 pub fn LLVMGetLinkage ( Global : ValueRef ) -> c_uint ;
818- pub fn LLVMSetLinkage ( Global : ValueRef , Link : c_uint ) ;
824+ pub fn LLVMSetLinkage ( Global : ValueRef , Link : Linkage ) ;
819825 pub fn LLVMGetSection ( Global : ValueRef ) -> * const c_char ;
820826 pub fn LLVMSetSection ( Global : ValueRef , Section : * const c_char ) ;
821827 pub fn LLVMGetVisibility ( Global : ValueRef ) -> c_uint ;
822828 pub fn LLVMSetVisibility ( Global : ValueRef , Viz : c_uint ) ;
823829 pub fn LLVMGetAlignment ( Global : ValueRef ) -> c_uint ;
824830 pub fn LLVMSetAlignment ( Global : ValueRef , Bytes : c_uint ) ;
831+ pub fn LLVMSetDLLStorageClass ( V : ValueRef ,
832+ C : DLLStorageClass ) ;
825833
826834
827835 /* Operations on global variables */
@@ -1685,7 +1693,7 @@ extern {
16851693 Constraints : * const c_char ,
16861694 SideEffects : Bool ,
16871695 AlignStack : Bool ,
1688- Dialect : c_uint )
1696+ Dialect : AsmDialect )
16891697 -> ValueRef ;
16901698
16911699 pub fn LLVMRustDebugMetadataVersion ( ) -> u32 ;
@@ -1990,9 +1998,6 @@ extern {
19901998 pub fn LLVMRustArchiveIteratorFree ( AIR : ArchiveIteratorRef ) ;
19911999 pub fn LLVMRustDestroyArchive ( AR : ArchiveRef ) ;
19922000
1993- pub fn LLVMRustSetDLLStorageClass ( V : ValueRef ,
1994- C : DLLStorageClassTypes ) ;
1995-
19962001 pub fn LLVMRustGetSectionName ( SI : SectionIteratorRef ,
19972002 data : * mut * const c_char ) -> size_t ;
19982003
0 commit comments