Skip to main content

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