llvm_sys/
debuginfo.rs

1//! Generation of DWARF debug info.
2use super::*;
3
4// Debug info flags.
5pub type LLVMDIFlags = ::libc::c_int;
6pub const LLVMDIFlagZero: LLVMDIFlags = 0;
7pub const LLVMDIFlagPrivate: LLVMDIFlags = 1;
8pub const LLVMDIFlagProtected: LLVMDIFlags = 2;
9pub const LLVMDIFlagPublic: LLVMDIFlags = 3;
10pub const LLVMDIFlagFwdDecl: LLVMDIFlags = 1 << 2;
11pub const LLVMDIFlagAppleBlock: LLVMDIFlags = 1 << 3;
12pub const LLVMDIFlagReservedBit4: LLVMDIFlags = 1 << 4;
13pub const LLVMDIFlagVirtual: LLVMDIFlags = 1 << 5;
14pub const LLVMDIFlagArtificial: LLVMDIFlags = 1 << 6;
15pub const LLVMDIFlagExplicit: LLVMDIFlags = 1 << 7;
16pub const LLVMDIFlagPrototyped: LLVMDIFlags = 1 << 8;
17pub const LLVMDIFlagObjcClassComplete: LLVMDIFlags = 1 << 9;
18pub const LLVMDIFlagObjectPointer: LLVMDIFlags = 1 << 10;
19pub const LLVMDIFlagVector: LLVMDIFlags = 1 << 11;
20pub const LLVMDIFlagStaticMember: LLVMDIFlags = 1 << 12;
21pub const LLVMDIFlagLValueReference: LLVMDIFlags = 1 << 13;
22pub const LLVMDIFlagRValueReference: LLVMDIFlags = 1 << 14;
23pub const LLVMDIFlagReserved: LLVMDIFlags = 1 << 15;
24pub const LLVMDIFlagSingleInheritance: LLVMDIFlags = 1 << 16;
25pub const LLVMDIFlagMultipleInheritance: LLVMDIFlags = 2 << 16;
26pub const LLVMDIFlagVirtualInheritance: LLVMDIFlags = 3 << 16;
27pub const LLVMDIFlagIntroducedVirtual: LLVMDIFlags = 1 << 18;
28pub const LLVMDIFlagBitField: LLVMDIFlags = 1 << 19;
29pub const LLVMDIFlagNoReturn: LLVMDIFlags = 1 << 20;
30pub const LLVMDIFlagTypePassByValue: LLVMDIFlags = 1 << 22;
31pub const LLVMDIFlagTypePassByReference: LLVMDIFlags = 1 << 23;
32pub const LLVMDIFlagEnumClass: LLVMDIFlags = 1 << 24;
33pub const LLVMDIFlagThunk: LLVMDIFlags = 1 << 25;
34pub const LLVMDIFlagNonTrivial: LLVMDIFlags = 1 << 26;
35pub const LLVMDIFlagBigendian: LLVMDIFlags = 1 << 27;
36pub const LLVMDIFlagLittleEndian: LLVMDIFlags = 1 << 28;
37pub const LLVMDIFlagIndirectVirtualBase: LLVMDIFlags = (1 << 2) | (1 << 5);
38pub const LLVMDIFlagAccessibility: LLVMDIFlags =
39    LLVMDIFlagProtected | LLVMDIFlagPrivate | LLVMDIFlagPublic;
40pub const LLVMDIFlagPtrToMemberRep: LLVMDIFlags =
41    LLVMDIFlagSingleInheritance | LLVMDIFlagMultipleInheritance | LLVMDIFlagVirtualInheritance;
42
43/// Source languages known by DWARF.
44#[repr(C)]
45#[derive(Debug)]
46pub enum LLVMDWARFSourceLanguage {
47    LLVMDWARFSourceLanguageC89,
48    LLVMDWARFSourceLanguageC,
49    LLVMDWARFSourceLanguageAda83,
50    LLVMDWARFSourceLanguageC_plus_plus,
51    LLVMDWARFSourceLanguageCobol74,
52    LLVMDWARFSourceLanguageCobol85,
53    LLVMDWARFSourceLanguageFortran77,
54    LLVMDWARFSourceLanguageFortran90,
55    LLVMDWARFSourceLanguagePascal83,
56    LLVMDWARFSourceLanguageModula2,
57    // New in DWARF v3:
58    LLVMDWARFSourceLanguageJava,
59    LLVMDWARFSourceLanguageC99,
60    LLVMDWARFSourceLanguageAda95,
61    LLVMDWARFSourceLanguageFortran95,
62    LLVMDWARFSourceLanguagePLI,
63    LLVMDWARFSourceLanguageObjC,
64    LLVMDWARFSourceLanguageObjC_plus_plus,
65    LLVMDWARFSourceLanguageUPC,
66    LLVMDWARFSourceLanguageD,
67    // New in DWARF v4:
68    LLVMDWARFSourceLanguagePython,
69    // New in DWARF v5:
70    LLVMDWARFSourceLanguageOpenCL,
71    LLVMDWARFSourceLanguageGo,
72    LLVMDWARFSourceLanguageModula3,
73    LLVMDWARFSourceLanguageHaskell,
74    LLVMDWARFSourceLanguageC_plus_plus_03,
75    LLVMDWARFSourceLanguageC_plus_plus_11,
76    LLVMDWARFSourceLanguageOCaml,
77    LLVMDWARFSourceLanguageRust,
78    LLVMDWARFSourceLanguageC11,
79    LLVMDWARFSourceLanguageSwift,
80    LLVMDWARFSourceLanguageJulia,
81    LLVMDWARFSourceLanguageDylan,
82    LLVMDWARFSourceLanguageC_plus_plus_14,
83    LLVMDWARFSourceLanguageFortran03,
84    LLVMDWARFSourceLanguageFortran08,
85    LLVMDWARFSourceLanguageRenderScript,
86    LLVMDWARFSourceLanguageBLISS,
87    LLVMDWARFSourceLanguageKotlin,
88    LLVMDWARFSourceLanguageZig,
89    LLVMDWARFSourceLanguageCrystal,
90    LLVMDWARFSourceLanguageC_plus_plus_17,
91    LLVMDWARFSourceLanguageC_plus_plus_20,
92    LLVMDWARFSourceLanguageC17,
93    LLVMDWARFSourceLanguageFortran18,
94    LLVMDWARFSourceLanguageAda2005,
95    LLVMDWARFSourceLanguageAda2012,
96    LLVMDWARFSourceLanguageMojo,
97    // Vendor extensions:
98    LLVMDWARFSourceLanguageMips_Assembler,
99    LLVMDWARFSourceLanguageGOOGLE_RenderScript,
100    LLVMDWARFSourceLanguageBORLAND_Delphi,
101}
102
103/// The amount of debug information to emit.
104#[repr(C)]
105#[derive(Debug)]
106pub enum LLVMDWARFEmissionKind {
107    LLVMDWARFEmissionKindNone = 0,
108    LLVMDWARFEmissionKindFull,
109    LLVMDWARFEmissionKindLineTablesOnly,
110}
111
112#[repr(C)]
113#[derive(Debug)]
114pub enum LLVMMetadataKind {
115    LLVMMDStringMetadataKind,
116    LLVMConstantAsMetadataMetadataKind,
117    LLVMLocalAsMetadataMetadataKind,
118    LLVMDistinctMDOperandPlaceholderMetadataKind,
119    LLVMMDTupleMetadataKind,
120    LLVMDILocationMetadataKind,
121    LLVMDIExpressionMetadataKind,
122    LLVMDIGlobalVariableExpressionMetadataKind,
123    LLVMGenericDINodeMetadataKind,
124    LLVMDISubrangeMetadataKind,
125    LLVMDIEnumeratorMetadataKind,
126    LLVMDIBasicTypeMetadataKind,
127    LLVMDIDerivedTypeMetadataKind,
128    LLVMDICompositeTypeMetadataKind,
129    LLVMDISubroutineTypeMetadataKind,
130    LLVMDIFileMetadataKind,
131    LLVMDICompileUnitMetadataKind,
132    LLVMDISubprogramMetadataKind,
133    LLVMDILexicalBlockMetadataKind,
134    LLVMDILexicalBlockFileMetadataKind,
135    LLVMDINamespaceMetadataKind,
136    LLVMDIModuleMetadataKind,
137    LLVMDITemplateTypeParameterMetadataKind,
138    LLVMDITemplateValueParameterMetadataKind,
139    LLVMDIGlobalVariableMetadataKind,
140    LLVMDILocalVariableMetadataKind,
141    LLVMDILabelMetadataKind,
142    LLVMDIObjCPropertyMetadataKind,
143    LLVMDIImportedEntityMetadataKind,
144    LLVMDIMacroMetadataKind,
145    LLVMDIMacroFileMetadataKind,
146    LLVMDICommonBlockMetadataKind,
147    LLVMDIStringTypeMetadataKind,
148    LLVMDIGenericSubrangeMetadataKind,
149    LLVMDIArgListMetadataKind,
150    LLVMDIAssignIDMetadataKind,
151}
152
153pub type LLVMDWARFTypeEncoding = ::libc::c_uint;
154
155#[repr(C)]
156#[derive(Debug)]
157pub enum LLVMDWARFMacinfoRecordType {
158    LLVMDWARFMacinfoRecordTypeDefine = 0x01,
159    LLVMDWARFMacinfoRecordTypeMacro = 0x02,
160    LLVMDWARFMacinfoRecordTypeStartFile = 0x03,
161    LLVMDWARFMacinfoRecordTypeEndFile = 0x04,
162    LLVMDWARFMacinfoRecordTypeVendorExt = 0xff,
163}
164
165extern "C" {
166    /// The current debug metadata version number.
167    pub fn LLVMDebugMetadataVersion() -> ::libc::c_uint;
168    /// The version of debug metadata that's present in the provided Module.
169    pub fn LLVMGetModuleDebugMetadataVersion(Module: LLVMModuleRef) -> ::libc::c_uint;
170    /// Strip debug info in the module if it exists.
171    pub fn LLVMStripModuleDebugInfo(Module: LLVMModuleRef) -> LLVMBool;
172    /// Construct a builder for a module, do not allow unresolved nodes.
173    pub fn LLVMCreateDIBuilderDisallowUnresolved(M: LLVMModuleRef) -> LLVMDIBuilderRef;
174    /// Construct a builder for a module and collect unresolved nodes.
175    pub fn LLVMCreateDIBuilder(M: LLVMModuleRef) -> LLVMDIBuilderRef;
176    /// Deallocate a builder and everything it owns.
177    ///
178    /// The builder must be finalized before this.
179    pub fn LLVMDisposeDIBuilder(Builder: LLVMDIBuilderRef);
180    /// Construct any deferred debug info descriptors.
181    pub fn LLVMDIBuilderFinalize(Builder: LLVMDIBuilderRef);
182    /// Finalize a specific subprogram.
183    /// No new variables may be added to this subprogram afterwards.
184    pub fn LLVMDIBuilderFinalizeSubprogram(Builder: LLVMDIBuilderRef, Subprogram: LLVMMetadataRef);
185    pub fn LLVMDIBuilderCreateCompileUnit(
186        Builder: LLVMDIBuilderRef,
187        Lang: LLVMDWARFSourceLanguage,
188        FileRef: LLVMMetadataRef,
189        Producer: *const ::libc::c_char,
190        ProducerLen: ::libc::size_t,
191        isOptimized: LLVMBool,
192        Flags: *const ::libc::c_char,
193        FlagsLen: ::libc::size_t,
194        RuntimeVer: ::libc::c_uint,
195        SplitName: *const ::libc::c_char,
196        SplitNameLen: ::libc::size_t,
197        Kind: LLVMDWARFEmissionKind,
198        DWOId: ::libc::c_uint,
199        SplitDebugInlining: LLVMBool,
200        DebugInfoForProfiling: LLVMBool,
201        SysRoot: *const ::libc::c_char,
202        SysRootLen: ::libc::size_t,
203        SDK: *const ::libc::c_char,
204        SDKLen: ::libc::size_t,
205    ) -> LLVMMetadataRef;
206    /// Create a file descriptor to hold debugging information for a file.
207    pub fn LLVMDIBuilderCreateFile(
208        Builder: LLVMDIBuilderRef,
209        Filename: *const ::libc::c_char,
210        FilenameLen: ::libc::size_t,
211        Directory: *const ::libc::c_char,
212        DirectoryLen: ::libc::size_t,
213    ) -> LLVMMetadataRef;
214
215    /// Creates a new descriptor for a module with the specified parent scope.
216    pub fn LLVMDIBuilderCreateModule(
217        Builder: LLVMDIBuilderRef,
218        ParentScope: LLVMMetadataRef,
219        Name: *const ::libc::c_char,
220        NameLen: ::libc::size_t,
221        ConfigMacros: *const ::libc::c_char,
222        ConfigMacrosLen: ::libc::size_t,
223        IncludePath: *const ::libc::c_char,
224        IncludePathLen: ::libc::size_t,
225        APINotesFile: *const ::libc::c_char,
226        APINotesFileLen: ::libc::size_t,
227    ) -> LLVMMetadataRef;
228
229    /// Creates a new descriptor for a namespace with the specified parent scope.
230    pub fn LLVMDIBuilderCreateNameSpace(
231        Builder: LLVMDIBuilderRef,
232        ParentScope: LLVMMetadataRef,
233        Name: *const ::libc::c_char,
234        NameLen: ::libc::size_t,
235        ExportSymbols: LLVMBool,
236    ) -> LLVMMetadataRef;
237
238    /// Create a new descriptor for the specified subprogram.
239    pub fn LLVMDIBuilderCreateFunction(
240        Builder: LLVMDIBuilderRef,
241        Scope: LLVMMetadataRef,
242        Name: *const ::libc::c_char,
243        NameLen: ::libc::size_t,
244        LinkageName: *const ::libc::c_char,
245        LinkageNameLen: ::libc::size_t,
246        File: LLVMMetadataRef,
247        LineNo: ::libc::c_uint,
248        Ty: LLVMMetadataRef,
249        IsLocalToUnit: LLVMBool,
250        IsDefinition: LLVMBool,
251        ScopeLine: ::libc::c_uint,
252        Flags: LLVMDIFlags,
253        IsOptimized: LLVMBool,
254    ) -> LLVMMetadataRef;
255
256    /// Create a descriptor for a lexical block with the specified parent context.
257    pub fn LLVMDIBuilderCreateLexicalBlock(
258        Builder: LLVMDIBuilderRef,
259        Scope: LLVMMetadataRef,
260        File: LLVMMetadataRef,
261        Line: ::libc::c_uint,
262        Column: ::libc::c_uint,
263    ) -> LLVMMetadataRef;
264
265    /// Create a descriptor for a lexical block with a new file attached.
266    pub fn LLVMDIBuilderCreateLexicalBlockFile(
267        Builder: LLVMDIBuilderRef,
268        Scope: LLVMMetadataRef,
269        File: LLVMMetadataRef,
270        Discriminator: ::libc::c_uint,
271    ) -> LLVMMetadataRef;
272
273    /// Create a descriptor for an imported namespace. Suitable for e.g. C++ using declarations.
274    pub fn LLVMDIBuilderCreateImportedModuleFromNamespace(
275        Builder: LLVMDIBuilderRef,
276        Scope: LLVMMetadataRef,
277        NS: LLVMMetadataRef,
278        File: LLVMMetadataRef,
279        Line: ::libc::c_uint,
280    ) -> LLVMMetadataRef;
281
282    /// Create a descriptor for an imported module that aliases another imported entity descriptor.
283    pub fn LLVMDIBuilderCreateImportedModuleFromAlias(
284        Builder: LLVMDIBuilderRef,
285        Scope: LLVMMetadataRef,
286        ImportedEntity: LLVMMetadataRef,
287        File: LLVMMetadataRef,
288        Line: ::libc::c_uint,
289        Elements: *mut LLVMMetadataRef,
290        NumElements: ::libc::c_uint,
291    ) -> LLVMMetadataRef;
292
293    /// Create a descriptor for an imported module.
294    pub fn LLVMDIBuilderCreateImportedModuleFromModule(
295        Builder: LLVMDIBuilderRef,
296        Scope: LLVMMetadataRef,
297        M: LLVMMetadataRef,
298        File: LLVMMetadataRef,
299        Line: ::libc::c_uint,
300        Elements: *mut LLVMMetadataRef,
301        NumElements: ::libc::c_uint,
302    ) -> LLVMMetadataRef;
303
304    /// Create a descriptor for an imported function, type, or variable.
305    ///
306    /// Suitable for e.g. FORTRAN-style USE declarations.
307    pub fn LLVMDIBuilderCreateImportedDeclaration(
308        Builder: LLVMDIBuilderRef,
309        Scope: LLVMMetadataRef,
310        Decl: LLVMMetadataRef,
311        File: LLVMMetadataRef,
312        Line: ::libc::c_uint,
313        Name: *const ::libc::c_char,
314        NameLen: ::libc::size_t,
315        Elements: *mut LLVMMetadataRef,
316        NumElements: ::libc::c_uint,
317    ) -> LLVMMetadataRef;
318
319    /// Creates a new DebugLocation that describes a source location.
320    pub fn LLVMDIBuilderCreateDebugLocation(
321        Ctx: LLVMContextRef,
322        Line: ::libc::c_uint,
323        Column: ::libc::c_uint,
324        Scope: LLVMMetadataRef,
325        InlinedAt: LLVMMetadataRef,
326    ) -> LLVMMetadataRef;
327
328    /// Get the line number of this debug location.
329    pub fn LLVMDILocationGetLine(Location: LLVMMetadataRef) -> ::libc::c_uint;
330
331    /// Get the column number of this debug location.
332    pub fn LLVMDILocationGetColumn(Location: LLVMMetadataRef) -> ::libc::c_uint;
333
334    /// Get the local scope associated with this debug location.
335    pub fn LLVMDILocationGetScope(Location: LLVMMetadataRef) -> LLVMMetadataRef;
336
337    /// Get the "inline at" location associated with this debug location.
338    pub fn LLVMDILocationGetInlinedAt(Location: LLVMMetadataRef) -> LLVMMetadataRef;
339
340    /// Get the metadata of the file associated with a given scope.
341    pub fn LLVMDIScopeGetFile(Scope: LLVMMetadataRef) -> LLVMMetadataRef;
342
343    /// Get the directory of a given file.
344    pub fn LLVMDIFileGetDirectory(
345        File: LLVMMetadataRef,
346        Len: *mut ::libc::c_uint,
347    ) -> *const ::libc::c_char;
348
349    /// Get the name of a given file.
350    pub fn LLVMDIFileGetFilename(
351        File: LLVMMetadataRef,
352        Len: *mut ::libc::c_uint,
353    ) -> *const ::libc::c_char;
354
355    /// Get the source of a given file.
356    pub fn LLVMDIFileGetSource(
357        File: LLVMMetadataRef,
358        Len: *mut ::libc::c_uint,
359    ) -> *const ::libc::c_char;
360
361    /// Create a type array.
362    pub fn LLVMDIBuilderGetOrCreateTypeArray(
363        Builder: LLVMDIBuilderRef,
364        Data: *mut LLVMMetadataRef,
365        NumElements: ::libc::size_t,
366    ) -> LLVMMetadataRef;
367
368    /// Create subroutine type.
369    pub fn LLVMDIBuilderCreateSubroutineType(
370        Builder: LLVMDIBuilderRef,
371        File: LLVMMetadataRef,
372        ParameterTypes: *mut LLVMMetadataRef,
373        NumParameterTypes: ::libc::c_uint,
374        Flags: LLVMDIFlags,
375    ) -> LLVMMetadataRef;
376
377    pub fn LLVMDIBuilderCreateMacro(
378        Builder: LLVMDIBuilderRef,
379        ParentMacroFile: LLVMMetadataRef,
380        Line: ::libc::c_uint,
381        RecordType: LLVMDWARFMacinfoRecordType,
382        Name: *const ::libc::c_char,
383        NameLen: usize,
384        Value: *const ::libc::c_char,
385        ValueLen: usize,
386    ) -> LLVMMetadataRef;
387
388    pub fn LLVMDIBuilderCreateTempMacroFile(
389        Builder: LLVMDIBuilderRef,
390        ParentMacroFile: LLVMMetadataRef,
391        Line: ::libc::c_uint,
392        File: LLVMMetadataRef,
393    ) -> LLVMMetadataRef;
394
395    /// Create debugging information entry for an enumerator.
396    pub fn LLVMDIBuilderCreateEnumerator(
397        Builder: LLVMDIBuilderRef,
398        Name: *const ::libc::c_char,
399        NameLen: ::libc::size_t,
400        Value: i64,
401        IsUnsigned: LLVMBool,
402    ) -> LLVMMetadataRef;
403
404    /// Create debugging information entry for an enumeration.
405    pub fn LLVMDIBuilderCreateEnumerationType(
406        Builder: LLVMDIBuilderRef,
407        Scope: LLVMMetadataRef,
408        Name: *const ::libc::c_char,
409        NameLen: ::libc::size_t,
410        File: LLVMMetadataRef,
411        LineNumber: ::libc::c_uint,
412        SizeInBits: u64,
413        AlignInBits: u32,
414        Elements: *mut LLVMMetadataRef,
415        NumElements: ::libc::c_uint,
416        ClassTy: LLVMMetadataRef,
417    ) -> LLVMMetadataRef;
418
419    /// Create debugging information entry for a union.
420    pub fn LLVMDIBuilderCreateUnionType(
421        Builder: LLVMDIBuilderRef,
422        Scope: LLVMMetadataRef,
423        Name: *const ::libc::c_char,
424        NameLen: ::libc::size_t,
425        File: LLVMMetadataRef,
426        LineNumber: ::libc::c_uint,
427        SizeInBits: u64,
428        AlignInBits: u32,
429        Flags: LLVMDIFlags,
430        Elements: *mut LLVMMetadataRef,
431        NumElements: ::libc::c_uint,
432        RunTimeLang: ::libc::c_uint,
433        UniqueId: *const ::libc::c_char,
434        UniqueIdLen: ::libc::size_t,
435    ) -> LLVMMetadataRef;
436
437    /// Create debugging information entry for an array.
438    pub fn LLVMDIBuilderCreateArrayType(
439        Builder: LLVMDIBuilderRef,
440        Size: u64,
441        AlignInBits: u32,
442        Ty: LLVMMetadataRef,
443        Subscripts: *mut LLVMMetadataRef,
444        NumSubscripts: ::libc::c_uint,
445    ) -> LLVMMetadataRef;
446
447    /// Create debugging information entry for a vector type.
448    pub fn LLVMDIBuilderCreateVectorType(
449        Builder: LLVMDIBuilderRef,
450        Size: u64,
451        AlignInBits: u32,
452        Ty: LLVMMetadataRef,
453        Subscripts: *mut LLVMMetadataRef,
454        NumSubscripts: ::libc::c_uint,
455    ) -> LLVMMetadataRef;
456
457    /// Create a DWARF unspecified type.
458    pub fn LLVMDIBuilderCreateUnspecifiedType(
459        Builder: LLVMDIBuilderRef,
460        Name: *const ::libc::c_char,
461        NameLen: ::libc::size_t,
462    ) -> LLVMMetadataRef;
463
464    /// Create debugging information entry for a basic type.
465    pub fn LLVMDIBuilderCreateBasicType(
466        Builder: LLVMDIBuilderRef,
467        Name: *const ::libc::c_char,
468        NameLen: ::libc::size_t,
469        SizeInBits: u64,
470        Encoding: LLVMDWARFTypeEncoding,
471        Flags: LLVMDIFlags,
472    ) -> LLVMMetadataRef;
473
474    /// Create debugging information entry for a pointer.
475    pub fn LLVMDIBuilderCreatePointerType(
476        Builder: LLVMDIBuilderRef,
477        PointeeTy: LLVMMetadataRef,
478        SizeInBits: u64,
479        AlignInBits: u32,
480        AddressSpace: ::libc::c_uint,
481        Name: *const ::libc::c_char,
482        NameLen: ::libc::size_t,
483    ) -> LLVMMetadataRef;
484
485    /// Create debugging information entry for a struct.
486    pub fn LLVMDIBuilderCreateStructType(
487        Builder: LLVMDIBuilderRef,
488        Scope: LLVMMetadataRef,
489        Name: *const ::libc::c_char,
490        NameLen: ::libc::size_t,
491        File: LLVMMetadataRef,
492        LineNumber: ::libc::c_uint,
493        SizeInBits: u64,
494        AlignInBits: u32,
495        Flags: LLVMDIFlags,
496        DerivedFrom: LLVMMetadataRef,
497        Elements: *mut LLVMMetadataRef,
498        NumElements: ::libc::c_uint,
499        RunTimeLang: ::libc::c_uint,
500        VTableHolder: LLVMMetadataRef,
501        UniqueId: *const ::libc::c_char,
502        UniqueIdLen: ::libc::size_t,
503    ) -> LLVMMetadataRef;
504
505    /// Create debugging information entry for a member.
506    pub fn LLVMDIBuilderCreateMemberType(
507        Builder: LLVMDIBuilderRef,
508        Scope: LLVMMetadataRef,
509        Name: *const ::libc::c_char,
510        NameLen: ::libc::size_t,
511        File: LLVMMetadataRef,
512        LineNo: ::libc::c_uint,
513        SizeInBits: u64,
514        AlignInBits: u32,
515        OffsetInBits: u64,
516        Flags: LLVMDIFlags,
517        Ty: LLVMMetadataRef,
518    ) -> LLVMMetadataRef;
519
520    /// Create debugging information entry for a C++ static data member.
521    pub fn LLVMDIBuilderCreateStaticMemberType(
522        Builder: LLVMDIBuilderRef,
523        Scope: LLVMMetadataRef,
524        Name: *const ::libc::c_char,
525        NameLen: ::libc::size_t,
526        File: LLVMMetadataRef,
527        LineNumber: ::libc::c_uint,
528        Type: LLVMMetadataRef,
529        Flags: LLVMDIFlags,
530        ConstantVal: LLVMValueRef,
531        AlignInBits: u32,
532    ) -> LLVMMetadataRef;
533
534    /// Create debugging information entry for a pointer to member.
535    pub fn LLVMDIBuilderCreateMemberPointerType(
536        Builder: LLVMDIBuilderRef,
537        PointeeType: LLVMMetadataRef,
538        ClassType: LLVMMetadataRef,
539        SizeInBits: u64,
540        AlignInBits: u32,
541        Flags: LLVMDIFlags,
542    ) -> LLVMMetadataRef;
543
544    /// Create debugging information entry for Objective-C instance variable.
545    pub fn LLVMDIBuilderCreateObjCIVar(
546        Builder: LLVMDIBuilderRef,
547        Name: *const ::libc::c_char,
548        NameLen: ::libc::size_t,
549        File: LLVMMetadataRef,
550        LineNo: ::libc::c_uint,
551        SizeInBits: u64,
552        AlignInBits: u32,
553        OffsetInBits: u64,
554        Flags: LLVMDIFlags,
555        Ty: LLVMMetadataRef,
556        PropertyNode: LLVMMetadataRef,
557    ) -> LLVMMetadataRef;
558
559    /// Create debugging information entry for Objective-C property.
560    pub fn LLVMDIBuilderCreateObjCProperty(
561        Builder: LLVMDIBuilderRef,
562        Name: *const ::libc::c_char,
563        NameLen: ::libc::size_t,
564        File: LLVMMetadataRef,
565        LineNo: ::libc::c_uint,
566        GetterName: *const ::libc::c_char,
567        GetterNameLen: ::libc::size_t,
568        SetterName: *const ::libc::c_char,
569        SetterNameLen: ::libc::size_t,
570        PropertyAttributes: ::libc::c_uint,
571        Ty: LLVMMetadataRef,
572    ) -> LLVMMetadataRef;
573
574    /// Create a uniqued DIType* clone with FlagObjectPointer and FlagArtificial set.
575    pub fn LLVMDIBuilderCreateObjectPointerType(
576        Builder: LLVMDIBuilderRef,
577        Type: LLVMMetadataRef,
578    ) -> LLVMMetadataRef;
579
580    /// Create debugging information entry for a qualified type, e.g. 'const int'.
581    pub fn LLVMDIBuilderCreateQualifiedType(
582        Builder: LLVMDIBuilderRef,
583        Tag: ::libc::c_uint,
584        Type: LLVMMetadataRef,
585    ) -> LLVMMetadataRef;
586
587    /// Create debugging information entry for a c++ style reference or rvalue reference type.
588    pub fn LLVMDIBuilderCreateReferenceType(
589        Builder: LLVMDIBuilderRef,
590        Tag: ::libc::c_uint,
591        Type: LLVMMetadataRef,
592    ) -> LLVMMetadataRef;
593
594    /// Create C++11 nullptr type.
595    pub fn LLVMDIBuilderCreateNullPtrType(Builder: LLVMDIBuilderRef) -> LLVMMetadataRef;
596
597    /// Create debugging information entry for a typedef.
598    pub fn LLVMDIBuilderCreateTypedef(
599        Builder: LLVMDIBuilderRef,
600        Type: LLVMMetadataRef,
601        Name: *const ::libc::c_char,
602        NameLen: ::libc::size_t,
603        File: LLVMMetadataRef,
604        LineNo: ::libc::c_uint,
605        Scope: LLVMMetadataRef,
606        AlignInBits: u32,
607    ) -> LLVMMetadataRef;
608
609    /// Create debugging information entry to establish inheritance relationship between two types.
610    pub fn LLVMDIBuilderCreateInheritance(
611        Builder: LLVMDIBuilderRef,
612        Ty: LLVMMetadataRef,
613        BaseTy: LLVMMetadataRef,
614        BaseOffset: u64,
615        VBPtrOffset: u32,
616        Flags: LLVMDIFlags,
617    ) -> LLVMMetadataRef;
618
619    /// Create a permanent forward-declared type.
620    pub fn LLVMDIBuilderCreateForwardDecl(
621        Builder: LLVMDIBuilderRef,
622        Tag: ::libc::c_uint,
623        Name: *const ::libc::c_char,
624        NameLen: ::libc::size_t,
625        Scope: LLVMMetadataRef,
626        File: LLVMMetadataRef,
627        Line: ::libc::c_uint,
628        RuntimeLang: ::libc::c_uint,
629        SizeInBits: u64,
630        AlignInBits: u32,
631        UniqueIdentifier: *const ::libc::c_char,
632        UniqueIdentifierLen: ::libc::size_t,
633    ) -> LLVMMetadataRef;
634
635    /// Create a temporary forward-declared type.
636    pub fn LLVMDIBuilderCreateReplaceableCompositeType(
637        Builder: LLVMDIBuilderRef,
638        Tag: ::libc::c_uint,
639        Name: *const ::libc::c_char,
640        NameLen: ::libc::size_t,
641        Scope: LLVMMetadataRef,
642        File: LLVMMetadataRef,
643        Line: ::libc::c_uint,
644        RuntimeLang: ::libc::c_uint,
645        SizeInBits: u64,
646        AlignInBits: u32,
647        Flags: LLVMDIFlags,
648        UniqueIdentifier: *const ::libc::c_char,
649        UniqueIdentifierLen: ::libc::size_t,
650    ) -> LLVMMetadataRef;
651
652    /// Create debugging information entry for a bit field member.
653    pub fn LLVMDIBuilderCreateBitFieldMemberType(
654        Builder: LLVMDIBuilderRef,
655        Scope: LLVMMetadataRef,
656        Name: *const ::libc::c_char,
657        NameLen: ::libc::size_t,
658        File: LLVMMetadataRef,
659        LineNumber: ::libc::c_uint,
660        SizeInBits: u64,
661        OffsetInBits: u64,
662        StorageOffsetInBits: u64,
663        Flags: LLVMDIFlags,
664        Type: LLVMMetadataRef,
665    ) -> LLVMMetadataRef;
666
667    /// Create debugging information entry for a class.
668    pub fn LLVMDIBuilderCreateClassType(
669        Builder: LLVMDIBuilderRef,
670        Scope: LLVMMetadataRef,
671        Name: *const ::libc::c_char,
672        NameLen: ::libc::size_t,
673        File: LLVMMetadataRef,
674        LineNumber: ::libc::c_uint,
675        SizeInBits: u64,
676        AlignInBits: u32,
677        OffsetInBits: u64,
678        Flags: LLVMDIFlags,
679        DerivedFrom: LLVMMetadataRef,
680        Elements: *mut LLVMMetadataRef,
681        NumElements: ::libc::c_uint,
682        VTableHolder: LLVMMetadataRef,
683        TemplateParamsNode: LLVMMetadataRef,
684        UniqueIdentifier: *const ::libc::c_char,
685        UniqueIdentifierLen: ::libc::size_t,
686    ) -> LLVMMetadataRef;
687
688    /// Create a uniqued DIType* clone with FlagArtificial set.
689    pub fn LLVMDIBuilderCreateArtificialType(
690        Builder: LLVMDIBuilderRef,
691        Type: LLVMMetadataRef,
692    ) -> LLVMMetadataRef;
693
694    /// Get the name of this DIType.
695    pub fn LLVMDITypeGetName(
696        DType: LLVMMetadataRef,
697        Length: *mut ::libc::size_t,
698    ) -> *const ::libc::c_char;
699
700    /// Get the size of this DIType in bits.
701    pub fn LLVMDITypeGetSizeInBits(DType: LLVMMetadataRef) -> u64;
702
703    /// Get the offset of this DIType in bits.
704    pub fn LLVMDITypeGetOffsetInBits(DType: LLVMMetadataRef) -> u64;
705
706    /// Get the alignment of this DIType in bits.
707    pub fn LLVMDITypeGetAlignInBits(DType: LLVMMetadataRef) -> u32;
708
709    /// Get the source line where this DIType is declared.
710    pub fn LLVMDITypeGetLine(DType: LLVMMetadataRef) -> ::libc::c_uint;
711
712    /// Get the flags associated with this DIType.
713    pub fn LLVMDITypeGetFlags(DType: LLVMMetadataRef) -> LLVMDIFlags;
714
715    /// Create a descriptor for a value range.
716    pub fn LLVMDIBuilderGetOrCreateSubrange(
717        Builder: LLVMDIBuilderRef,
718        LowerBound: i64,
719        Count: i64,
720    ) -> LLVMMetadataRef;
721
722    /// Create an array of DI Nodes.
723    pub fn LLVMDIBuilderGetOrCreateArray(
724        Builder: LLVMDIBuilderRef,
725        Data: *mut LLVMMetadataRef,
726        NumElements: ::libc::size_t,
727    ) -> LLVMMetadataRef;
728
729    /// Create a new descriptor for the specified variable which has a complex
730    pub fn LLVMDIBuilderCreateExpression(
731        Builder: LLVMDIBuilderRef,
732        Addr: *mut u64,
733        Length: ::libc::size_t,
734    ) -> LLVMMetadataRef;
735
736    /// Create a new descriptor for the specified variable that does not have an
737    pub fn LLVMDIBuilderCreateConstantValueExpression(
738        Builder: LLVMDIBuilderRef,
739        Value: u64,
740    ) -> LLVMMetadataRef;
741
742    /// Create a new descriptor for the specified variable.
743    pub fn LLVMDIBuilderCreateGlobalVariableExpression(
744        Builder: LLVMDIBuilderRef,
745        Scope: LLVMMetadataRef,
746        Name: *const ::libc::c_char,
747        NameLen: ::libc::size_t,
748        Linkage: *const ::libc::c_char,
749        LinkLen: ::libc::size_t,
750        File: LLVMMetadataRef,
751        LineNo: ::libc::c_uint,
752        Ty: LLVMMetadataRef,
753        LocalToUnit: LLVMBool,
754        Expr: LLVMMetadataRef,
755        Decl: LLVMMetadataRef,
756        AlignInBits: u32,
757    ) -> LLVMMetadataRef;
758
759    /// Get the dwarf::Tag of a DINode
760    pub fn LLVMGetDINodeTag(MD: LLVMMetadataRef) -> u16;
761
762    /// Retrieves the DIVariable associated with this global variable expression.
763    pub fn LLVMDIGlobalVariableExpressionGetVariable(GVE: LLVMMetadataRef) -> LLVMMetadataRef;
764
765    /// Retrieves the DIExpression associated with this global variable expression.
766    pub fn LLVMDIGlobalVariableExpressionGetExpression(GVE: LLVMMetadataRef) -> LLVMMetadataRef;
767
768    ///Get the metadata of the file associated with a given variable.
769    pub fn LLVMDIVariableGetFile(Var: LLVMMetadataRef) -> LLVMMetadataRef;
770
771    /// Get the metadata of the scope associated with a given variable.
772    pub fn LLVMDIVariableGetScope(Var: LLVMMetadataRef) -> LLVMMetadataRef;
773
774    /// Get the source line where this \c DIVariable is declared.
775    pub fn LLVMDIVariableGetLine(Var: LLVMMetadataRef) -> ::libc::c_uint;
776
777    /// Create a new temporary \c MDNode.  Suitable for use in constructing cyclic
778    pub fn LLVMTemporaryMDNode(
779        Ctx: LLVMContextRef,
780        Data: *mut LLVMMetadataRef,
781        NumElements: ::libc::size_t,
782    ) -> LLVMMetadataRef;
783
784    /// Deallocate a temporary node.
785    pub fn LLVMDisposeTemporaryMDNode(TempNode: LLVMMetadataRef);
786
787    /// Replace all uses of temporary metadata.
788    pub fn LLVMMetadataReplaceAllUsesWith(
789        TempTargetMetadata: LLVMMetadataRef,
790        Replacement: LLVMMetadataRef,
791    );
792
793    /// Create a new descriptor for the specified global variable that is temporary
794    pub fn LLVMDIBuilderCreateTempGlobalVariableFwdDecl(
795        Builder: LLVMDIBuilderRef,
796        Scope: LLVMMetadataRef,
797        Name: *const ::libc::c_char,
798        NameLen: ::libc::size_t,
799        Linkage: *const ::libc::c_char,
800        LnkLen: ::libc::size_t,
801        File: LLVMMetadataRef,
802        LineNo: ::libc::c_uint,
803        Ty: LLVMMetadataRef,
804        LocalToUnit: LLVMBool,
805        Decl: LLVMMetadataRef,
806        AlignInBits: u32,
807    ) -> LLVMMetadataRef;
808
809    /// Insert a new llvm.dbg.declare intrinsic call before the given instruction.
810    pub fn LLVMDIBuilderInsertDeclareBefore(
811        Builder: LLVMDIBuilderRef,
812        Storage: LLVMValueRef,
813        VarInfo: LLVMMetadataRef,
814        Expr: LLVMMetadataRef,
815        DebugLoc: LLVMMetadataRef,
816        Instr: LLVMValueRef,
817    ) -> LLVMValueRef;
818
819    /// Insert a new llvm.dbg.declare intrinsic call at the end of the given basic block. If the basic block has a terminator instruction, the intrinsic is inserted before that terminator instruction.
820    pub fn LLVMDIBuilderInsertDeclareAtEnd(
821        Builder: LLVMDIBuilderRef,
822        Storage: LLVMValueRef,
823        VarInfo: LLVMMetadataRef,
824        Expr: LLVMMetadataRef,
825        DebugLoc: LLVMMetadataRef,
826        Block: LLVMBasicBlockRef,
827    ) -> LLVMValueRef;
828
829    /// Insert a new llvm.dbg.value intrinsic call before the given instruction.
830    pub fn LLVMDIBuilderInsertDbgValueBefore(
831        Builder: LLVMDIBuilderRef,
832        Val: LLVMValueRef,
833        VarInfo: LLVMMetadataRef,
834        Expr: LLVMMetadataRef,
835        DebugLoc: LLVMMetadataRef,
836        Instr: LLVMValueRef,
837    ) -> LLVMValueRef;
838
839    /// Insert a new llvm.dbg.value intrinsic call at the end of the given basic block. If the basic block has a terminator instruction, the intrinsic is inserted before that terminator instruction.
840    pub fn LLVMDIBuilderInsertDbgValueAtEnd(
841        Builder: LLVMDIBuilderRef,
842        Val: LLVMValueRef,
843        VarInfo: LLVMMetadataRef,
844        Expr: LLVMMetadataRef,
845        DebugLoc: LLVMMetadataRef,
846        Block: LLVMBasicBlockRef,
847    ) -> LLVMValueRef;
848
849    /// Create a new descriptor for a local auto variable.
850    pub fn LLVMDIBuilderCreateAutoVariable(
851        Builder: LLVMDIBuilderRef,
852        Scope: LLVMMetadataRef,
853        Name: *const ::libc::c_char,
854        NameLen: ::libc::size_t,
855        File: LLVMMetadataRef,
856        LineNo: ::libc::c_uint,
857        Ty: LLVMMetadataRef,
858        AlwaysPreserve: LLVMBool,
859        Flags: LLVMDIFlags,
860        AlignInBits: u32,
861    ) -> LLVMMetadataRef;
862
863    /// Create a new descriptor for a function parameter variable.
864    pub fn LLVMDIBuilderCreateParameterVariable(
865        Builder: LLVMDIBuilderRef,
866        Scope: LLVMMetadataRef,
867        Name: *const ::libc::c_char,
868        NameLen: ::libc::size_t,
869        ArgNo: ::libc::c_uint,
870        File: LLVMMetadataRef,
871        LineNo: ::libc::c_uint,
872        Ty: LLVMMetadataRef,
873        AlwaysPreserve: LLVMBool,
874        Flags: LLVMDIFlags,
875    ) -> LLVMMetadataRef;
876
877    /// Get the metadata of the subprogram attached to a function.
878    pub fn LLVMGetSubprogram(Func: LLVMValueRef) -> LLVMMetadataRef;
879
880    /// Set the subprogram attached to a function.
881    pub fn LLVMSetSubprogram(Func: LLVMValueRef, SP: LLVMMetadataRef);
882
883    /// Get the line associated with a given subprogram.
884    pub fn LLVMDISubprogramGetLine(Subprogram: LLVMMetadataRef) -> ::libc::c_uint;
885
886    /// Get the debug location for the given instruction.
887    pub fn LLVMInstructionGetDebugLoc(Inst: LLVMValueRef) -> LLVMMetadataRef;
888
889    /// Set the debug location for the given instruction.
890    pub fn LLVMInstructionSetDebugLoc(Inst: LLVMValueRef, Loc: LLVMMetadataRef);
891
892    /// Obtain the enumerated type of a metadata instance.
893    pub fn LLVMGetMetadataKind(Metadata: LLVMMetadataRef) -> LLVMMetadataKind;
894}