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