1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
//! Generation of DWARF debug info.
use super::*;

// Debug info flags.
pub type LLVMDIFlags = ::libc::c_int;
pub const LLVMDIFlagZero: LLVMDIFlags = 0;
pub const LLVMDIFlagPrivate: LLVMDIFlags = 1;
pub const LLVMDIFlagProtected: LLVMDIFlags = 2;
pub const LLVMDIFlagPublic: LLVMDIFlags = 3;
pub const LLVMDIFlagFwdDecl: LLVMDIFlags = 1 << 2;
pub const LLVMDIFlagAppleBlock: LLVMDIFlags = 1 << 3;
pub const LLVMDIFlagReservedBit4: LLVMDIFlags = 1 << 4;
pub const LLVMDIFlagVirtual: LLVMDIFlags = 1 << 5;
pub const LLVMDIFlagArtificial: LLVMDIFlags = 1 << 6;
pub const LLVMDIFlagExplicit: LLVMDIFlags = 1 << 7;
pub const LLVMDIFlagPrototyped: LLVMDIFlags = 1 << 8;
pub const LLVMDIFlagObjcClassComplete: LLVMDIFlags = 1 << 9;
pub const LLVMDIFlagObjectPointer: LLVMDIFlags = 1 << 10;
pub const LLVMDIFlagVector: LLVMDIFlags = 1 << 11;
pub const LLVMDIFlagStaticMember: LLVMDIFlags = 1 << 12;
pub const LLVMDIFlagLValueReference: LLVMDIFlags = 1 << 13;
pub const LLVMDIFlagRValueReference: LLVMDIFlags = 1 << 14;
pub const LLVMDIFlagReserved: LLVMDIFlags = 1 << 15;
pub const LLVMDIFlagSingleInheritance: LLVMDIFlags = 1 << 16;
pub const LLVMDIFlagMultipleInheritance: LLVMDIFlags = 2 << 16;
pub const LLVMDIFlagVirtualInheritance: LLVMDIFlags = 3 << 16;
pub const LLVMDIFlagIntroducedVirtual: LLVMDIFlags = 1 << 18;
pub const LLVMDIFlagBitField: LLVMDIFlags = 1 << 19;
pub const LLVMDIFlagNoReturn: LLVMDIFlags = 1 << 20;
pub const LLVMDIFlagTypePassByValue: LLVMDIFlags = 1 << 22;
pub const LLVMDIFlagTypePassByReference: LLVMDIFlags = 1 << 23;
pub const LLVMDIFlagEnumClass: LLVMDIFlags = 1 << 24;
pub const LLVMDIFlagThunk: LLVMDIFlags = 1 << 25;
pub const LLVMDIFlagNonTrivial: LLVMDIFlags = 1 << 26;
pub const LLVMDIFlagBigendian: LLVMDIFlags = 1 << 27;
pub const LLVMDIFlagLittleEndian: LLVMDIFlags = 1 << 28;
pub const LLVMDIFlagIndirectVirtualBase: LLVMDIFlags = (1 << 2) | (1 << 5);
pub const LLVMDIFlagAccessibility: LLVMDIFlags =
    LLVMDIFlagProtected | LLVMDIFlagPrivate | LLVMDIFlagPublic;
pub const LLVMDIFlagPtrToMemberRep: LLVMDIFlags =
    LLVMDIFlagSingleInheritance | LLVMDIFlagMultipleInheritance | LLVMDIFlagVirtualInheritance;

/// Source languages known by DWARF.
#[repr(C)]
#[derive(Debug)]
pub enum LLVMDWARFSourceLanguage {
    LLVMDWARFSourceLanguageC89,
    LLVMDWARFSourceLanguageC,
    LLVMDWARFSourceLanguageAda83,
    LLVMDWARFSourceLanguageC_plus_plus,
    LLVMDWARFSourceLanguageCobol74,
    LLVMDWARFSourceLanguageCobol85,
    LLVMDWARFSourceLanguageFortran77,
    LLVMDWARFSourceLanguageFortran90,
    LLVMDWARFSourceLanguagePascal83,
    LLVMDWARFSourceLanguageModula2,
    // New in DWARF v3:
    LLVMDWARFSourceLanguageJava,
    LLVMDWARFSourceLanguageC99,
    LLVMDWARFSourceLanguageAda95,
    LLVMDWARFSourceLanguageFortran95,
    LLVMDWARFSourceLanguagePLI,
    LLVMDWARFSourceLanguageObjC,
    LLVMDWARFSourceLanguageObjC_plus_plus,
    LLVMDWARFSourceLanguageUPC,
    LLVMDWARFSourceLanguageD,
    // New in DWARF v4:
    LLVMDWARFSourceLanguagePython,
    // New in DWARF v5:
    LLVMDWARFSourceLanguageOpenCL,
    LLVMDWARFSourceLanguageGo,
    LLVMDWARFSourceLanguageModula3,
    LLVMDWARFSourceLanguageHaskell,
    LLVMDWARFSourceLanguageC_plus_plus_03,
    LLVMDWARFSourceLanguageC_plus_plus_11,
    LLVMDWARFSourceLanguageOCaml,
    LLVMDWARFSourceLanguageRust,
    LLVMDWARFSourceLanguageC11,
    LLVMDWARFSourceLanguageSwift,
    LLVMDWARFSourceLanguageJulia,
    LLVMDWARFSourceLanguageDylan,
    LLVMDWARFSourceLanguageC_plus_plus_14,
    LLVMDWARFSourceLanguageFortran03,
    LLVMDWARFSourceLanguageFortran08,
    LLVMDWARFSourceLanguageRenderScript,
    LLVMDWARFSourceLanguageBLISS,
    LLVMDWARFSourceLanguageKotlin,
    LLVMDWARFSourceLanguageZig,
    LLVMDWARFSourceLanguageCrystal,
    LLVMDWARFSourceLanguageC_plus_plus_17,
    LLVMDWARFSourceLanguageC_plus_plus_20,
    LLVMDWARFSourceLanguageC17,
    LLVMDWARFSourceLanguageFortran18,
    LLVMDWARFSourceLanguageAda2005,
    LLVMDWARFSourceLanguageAda2012,
    LLVMDWARFSourceLanguageMojo,
    // Vendor extensions:
    LLVMDWARFSourceLanguageMips_Assembler,
    LLVMDWARFSourceLanguageGOOGLE_RenderScript,
    LLVMDWARFSourceLanguageBORLAND_Delphi,
}

/// The amount of debug information to emit.
#[repr(C)]
#[derive(Debug)]
pub enum LLVMDWARFEmissionKind {
    LLVMDWARFEmissionKindNone = 0,
    LLVMDWARFEmissionKindFull,
    LLVMDWARFEmissionKindLineTablesOnly,
}

#[repr(C)]
#[derive(Debug)]
pub enum LLVMMetadataKind {
    LLVMMDStringMetadataKind,
    LLVMConstantAsMetadataMetadataKind,
    LLVMLocalAsMetadataMetadataKind,
    LLVMDistinctMDOperandPlaceholderMetadataKind,
    LLVMMDTupleMetadataKind,
    LLVMDILocationMetadataKind,
    LLVMDIExpressionMetadataKind,
    LLVMDIGlobalVariableExpressionMetadataKind,
    LLVMGenericDINodeMetadataKind,
    LLVMDISubrangeMetadataKind,
    LLVMDIEnumeratorMetadataKind,
    LLVMDIBasicTypeMetadataKind,
    LLVMDIDerivedTypeMetadataKind,
    LLVMDICompositeTypeMetadataKind,
    LLVMDISubroutineTypeMetadataKind,
    LLVMDIFileMetadataKind,
    LLVMDICompileUnitMetadataKind,
    LLVMDISubprogramMetadataKind,
    LLVMDILexicalBlockMetadataKind,
    LLVMDILexicalBlockFileMetadataKind,
    LLVMDINamespaceMetadataKind,
    LLVMDIModuleMetadataKind,
    LLVMDITemplateTypeParameterMetadataKind,
    LLVMDITemplateValueParameterMetadataKind,
    LLVMDIGlobalVariableMetadataKind,
    LLVMDILocalVariableMetadataKind,
    LLVMDILabelMetadataKind,
    LLVMDIObjCPropertyMetadataKind,
    LLVMDIImportedEntityMetadataKind,
    LLVMDIMacroMetadataKind,
    LLVMDIMacroFileMetadataKind,
    LLVMDICommonBlockMetadataKind,
    LLVMDIStringTypeMetadataKind,
    LLVMDIGenericSubrangeMetadataKind,
    LLVMDIArgListMetadataKind,
    LLVMDIAssignIDMetadataKind,
}

pub type LLVMDWARFTypeEncoding = ::libc::c_uint;

#[repr(C)]
#[derive(Debug)]
pub enum LLVMDWARFMacinfoRecordType {
    LLVMDWARFMacinfoRecordTypeDefine = 0x01,
    LLVMDWARFMacinfoRecordTypeMacro = 0x02,
    LLVMDWARFMacinfoRecordTypeStartFile = 0x03,
    LLVMDWARFMacinfoRecordTypeEndFile = 0x04,
    LLVMDWARFMacinfoRecordTypeVendorExt = 0xff,
}

extern "C" {
    /// The current debug metadata version number.
    pub fn LLVMDebugMetadataVersion() -> ::libc::c_uint;
    /// The version of debug metadata that's present in the provided Module.
    pub fn LLVMGetModuleDebugMetadataVersion(Module: LLVMModuleRef) -> ::libc::c_uint;
    /// Strip debug info in the module if it exists.
    pub fn LLVMStripModuleDebugInfo(Module: LLVMModuleRef) -> LLVMBool;
    /// Construct a builder for a module, do not allow unresolved nodes.
    pub fn LLVMCreateDIBuilderDisallowUnresolved(M: LLVMModuleRef) -> LLVMDIBuilderRef;
    /// Construct a builder for a module and collect unresolved nodes.
    pub fn LLVMCreateDIBuilder(M: LLVMModuleRef) -> LLVMDIBuilderRef;
    /// Deallocate a builder and everything it owns.
    ///
    /// The builder must be finalized before this.
    pub fn LLVMDisposeDIBuilder(Builder: LLVMDIBuilderRef);
    /// Construct any deferred debug info descriptors.
    pub fn LLVMDIBuilderFinalize(Builder: LLVMDIBuilderRef);
    /// Finalize a specific subprogram.
    /// No new variables may be added to this subprogram afterwards.
    pub fn LLVMDIBuilderFinalizeSubprogram(Builder: LLVMDIBuilderRef, Subprogram: LLVMMetadataRef);
    pub fn LLVMDIBuilderCreateCompileUnit(
        Builder: LLVMDIBuilderRef,
        Lang: LLVMDWARFSourceLanguage,
        FileRef: LLVMMetadataRef,
        Producer: *const ::libc::c_char,
        ProducerLen: ::libc::size_t,
        isOptimized: LLVMBool,
        Flags: *const ::libc::c_char,
        FlagsLen: ::libc::size_t,
        RuntimeVer: ::libc::c_uint,
        SplitName: *const ::libc::c_char,
        SplitNameLen: ::libc::size_t,
        Kind: LLVMDWARFEmissionKind,
        DWOId: ::libc::c_uint,
        SplitDebugInlining: LLVMBool,
        DebugInfoForProfiling: LLVMBool,
        SysRoot: *const ::libc::c_char,
        SysRootLen: ::libc::size_t,
        SDK: *const ::libc::c_char,
        SDKLen: ::libc::size_t,
    ) -> LLVMMetadataRef;
    /// Create a file descriptor to hold debugging information for a file.
    pub fn LLVMDIBuilderCreateFile(
        Builder: LLVMDIBuilderRef,
        Filename: *const ::libc::c_char,
        FilenameLen: ::libc::size_t,
        Directory: *const ::libc::c_char,
        DirectoryLen: ::libc::size_t,
    ) -> LLVMMetadataRef;

    /// Creates a new descriptor for a module with the specified parent scope.
    pub fn LLVMDIBuilderCreateModule(
        Builder: LLVMDIBuilderRef,
        ParentScope: LLVMMetadataRef,
        Name: *const ::libc::c_char,
        NameLen: ::libc::size_t,
        ConfigMacros: *const ::libc::c_char,
        ConfigMacrosLen: ::libc::size_t,
        IncludePath: *const ::libc::c_char,
        IncludePathLen: ::libc::size_t,
        APINotesFile: *const ::libc::c_char,
        APINotesFileLen: ::libc::size_t,
    ) -> LLVMMetadataRef;

    /// Creates a new descriptor for a namespace with the specified parent scope.
    pub fn LLVMDIBuilderCreateNameSpace(
        Builder: LLVMDIBuilderRef,
        ParentScope: LLVMMetadataRef,
        Name: *const ::libc::c_char,
        NameLen: ::libc::size_t,
        ExportSymbols: LLVMBool,
    ) -> LLVMMetadataRef;

    /// Create a new descriptor for the specified subprogram.
    pub fn LLVMDIBuilderCreateFunction(
        Builder: LLVMDIBuilderRef,
        Scope: LLVMMetadataRef,
        Name: *const ::libc::c_char,
        NameLen: ::libc::size_t,
        LinkageName: *const ::libc::c_char,
        LinkageNameLen: ::libc::size_t,
        File: LLVMMetadataRef,
        LineNo: ::libc::c_uint,
        Ty: LLVMMetadataRef,
        IsLocalToUnit: LLVMBool,
        IsDefinition: LLVMBool,
        ScopeLine: ::libc::c_uint,
        Flags: LLVMDIFlags,
        IsOptimized: LLVMBool,
    ) -> LLVMMetadataRef;

    /// Create a descriptor for a lexical block with the specified parent context.
    pub fn LLVMDIBuilderCreateLexicalBlock(
        Builder: LLVMDIBuilderRef,
        Scope: LLVMMetadataRef,
        File: LLVMMetadataRef,
        Line: ::libc::c_uint,
        Column: ::libc::c_uint,
    ) -> LLVMMetadataRef;

    /// Create a descriptor for a lexical block with a new file attached.
    pub fn LLVMDIBuilderCreateLexicalBlockFile(
        Builder: LLVMDIBuilderRef,
        Scope: LLVMMetadataRef,
        File: LLVMMetadataRef,
        Discriminator: ::libc::c_uint,
    ) -> LLVMMetadataRef;

    /// Create a descriptor for an imported namespace. Suitable for e.g. C++ using declarations.
    pub fn LLVMDIBuilderCreateImportedModuleFromNamespace(
        Builder: LLVMDIBuilderRef,
        Scope: LLVMMetadataRef,
        NS: LLVMMetadataRef,
        File: LLVMMetadataRef,
        Line: ::libc::c_uint,
    ) -> LLVMMetadataRef;

    /// Create a descriptor for an imported module that aliases another imported entity descriptor.
    pub fn LLVMDIBuilderCreateImportedModuleFromAlias(
        Builder: LLVMDIBuilderRef,
        Scope: LLVMMetadataRef,
        ImportedEntity: LLVMMetadataRef,
        File: LLVMMetadataRef,
        Line: ::libc::c_uint,
        Elements: *mut LLVMMetadataRef,
        NumElements: ::libc::c_uint,
    ) -> LLVMMetadataRef;

    /// Create a descriptor for an imported module.
    pub fn LLVMDIBuilderCreateImportedModuleFromModule(
        Builder: LLVMDIBuilderRef,
        Scope: LLVMMetadataRef,
        M: LLVMMetadataRef,
        File: LLVMMetadataRef,
        Line: ::libc::c_uint,
        Elements: *mut LLVMMetadataRef,
        NumElements: ::libc::c_uint,
    ) -> LLVMMetadataRef;

    /// Create a descriptor for an imported function, type, or variable.
    ///
    /// Suitable for e.g. FORTRAN-style USE declarations.
    pub fn LLVMDIBuilderCreateImportedDeclaration(
        Builder: LLVMDIBuilderRef,
        Scope: LLVMMetadataRef,
        Decl: LLVMMetadataRef,
        File: LLVMMetadataRef,
        Line: ::libc::c_uint,
        Name: *const ::libc::c_char,
        NameLen: ::libc::size_t,
        Elements: *mut LLVMMetadataRef,
        NumElements: ::libc::c_uint,
    ) -> LLVMMetadataRef;

    /// Creates a new DebugLocation that describes a source location.
    pub fn LLVMDIBuilderCreateDebugLocation(
        Ctx: LLVMContextRef,
        Line: ::libc::c_uint,
        Column: ::libc::c_uint,
        Scope: LLVMMetadataRef,
        InlinedAt: LLVMMetadataRef,
    ) -> LLVMMetadataRef;

    /// Get the line number of this debug location.
    pub fn LLVMDILocationGetLine(Location: LLVMMetadataRef) -> ::libc::c_uint;

    /// Get the column number of this debug location.
    pub fn LLVMDILocationGetColumn(Location: LLVMMetadataRef) -> ::libc::c_uint;

    /// Get the local scope associated with this debug location.
    pub fn LLVMDILocationGetScope(Location: LLVMMetadataRef) -> LLVMMetadataRef;

    /// Get the "inline at" location associated with this debug location.
    pub fn LLVMDILocationGetInlinedAt(Location: LLVMMetadataRef) -> LLVMMetadataRef;

    /// Get the metadata of the file associated with a given scope.
    pub fn LLVMDIScopeGetFile(Scope: LLVMMetadataRef) -> LLVMMetadataRef;

    /// Get the directory of a given file.
    pub fn LLVMDIFileGetDirectory(
        File: LLVMMetadataRef,
        Len: *mut ::libc::c_uint,
    ) -> *const ::libc::c_char;

    /// Get the name of a given file.
    pub fn LLVMDIFileGetFilename(
        File: LLVMMetadataRef,
        Len: *mut ::libc::c_uint,
    ) -> *const ::libc::c_char;

    /// Get the source of a given file.
    pub fn LLVMDIFileGetSource(
        File: LLVMMetadataRef,
        Len: *mut ::libc::c_uint,
    ) -> *const ::libc::c_char;

    /// Create a type array.
    pub fn LLVMDIBuilderGetOrCreateTypeArray(
        Builder: LLVMDIBuilderRef,
        Data: *mut LLVMMetadataRef,
        NumElements: ::libc::size_t,
    ) -> LLVMMetadataRef;

    /// Create subroutine type.
    pub fn LLVMDIBuilderCreateSubroutineType(
        Builder: LLVMDIBuilderRef,
        File: LLVMMetadataRef,
        ParameterTypes: *mut LLVMMetadataRef,
        NumParameterTypes: ::libc::c_uint,
        Flags: LLVMDIFlags,
    ) -> LLVMMetadataRef;

    pub fn LLVMDIBuilderCreateMacro(
        Builder: LLVMDIBuilderRef,
        ParentMacroFile: LLVMMetadataRef,
        Line: ::libc::c_uint,
        RecordType: LLVMDWARFMacinfoRecordType,
        Name: *const ::libc::c_char,
        NameLen: usize,
        Value: *const ::libc::c_char,
        ValueLen: usize,
    ) -> LLVMMetadataRef;

    pub fn LLVMDIBuilderCreateTempMacroFile(
        Builder: LLVMDIBuilderRef,
        ParentMacroFile: LLVMMetadataRef,
        Line: ::libc::c_uint,
        File: LLVMMetadataRef,
    ) -> LLVMMetadataRef;

    /// Create debugging information entry for an enumerator.
    pub fn LLVMDIBuilderCreateEnumerator(
        Builder: LLVMDIBuilderRef,
        Name: *const ::libc::c_char,
        NameLen: ::libc::size_t,
        Value: i64,
        IsUnsigned: LLVMBool,
    ) -> LLVMMetadataRef;

    /// Create debugging information entry for an enumeration.
    pub fn LLVMDIBuilderCreateEnumerationType(
        Builder: LLVMDIBuilderRef,
        Scope: LLVMMetadataRef,
        Name: *const ::libc::c_char,
        NameLen: ::libc::size_t,
        File: LLVMMetadataRef,
        LineNumber: ::libc::c_uint,
        SizeInBits: u64,
        AlignInBits: u32,
        Elements: *mut LLVMMetadataRef,
        NumElements: ::libc::c_uint,
        ClassTy: LLVMMetadataRef,
    ) -> LLVMMetadataRef;

    /// Create debugging information entry for a union.
    pub fn LLVMDIBuilderCreateUnionType(
        Builder: LLVMDIBuilderRef,
        Scope: LLVMMetadataRef,
        Name: *const ::libc::c_char,
        NameLen: ::libc::size_t,
        File: LLVMMetadataRef,
        LineNumber: ::libc::c_uint,
        SizeInBits: u64,
        AlignInBits: u32,
        Flags: LLVMDIFlags,
        Elements: *mut LLVMMetadataRef,
        NumElements: ::libc::c_uint,
        RunTimeLang: ::libc::c_uint,
        UniqueId: *const ::libc::c_char,
        UniqueIdLen: ::libc::size_t,
    ) -> LLVMMetadataRef;

    /// Create debugging information entry for an array.
    pub fn LLVMDIBuilderCreateArrayType(
        Builder: LLVMDIBuilderRef,
        Size: u64,
        AlignInBits: u32,
        Ty: LLVMMetadataRef,
        Subscripts: *mut LLVMMetadataRef,
        NumSubscripts: ::libc::c_uint,
    ) -> LLVMMetadataRef;

    /// Create debugging information entry for a vector type.
    pub fn LLVMDIBuilderCreateVectorType(
        Builder: LLVMDIBuilderRef,
        Size: u64,
        AlignInBits: u32,
        Ty: LLVMMetadataRef,
        Subscripts: *mut LLVMMetadataRef,
        NumSubscripts: ::libc::c_uint,
    ) -> LLVMMetadataRef;

    /// Create a DWARF unspecified type.
    pub fn LLVMDIBuilderCreateUnspecifiedType(
        Builder: LLVMDIBuilderRef,
        Name: *const ::libc::c_char,
        NameLen: ::libc::size_t,
    ) -> LLVMMetadataRef;

    /// Create debugging information entry for a basic type.
    pub fn LLVMDIBuilderCreateBasicType(
        Builder: LLVMDIBuilderRef,
        Name: *const ::libc::c_char,
        NameLen: ::libc::size_t,
        SizeInBits: u64,
        Encoding: LLVMDWARFTypeEncoding,
        Flags: LLVMDIFlags,
    ) -> LLVMMetadataRef;

    /// Create debugging information entry for a pointer.
    pub fn LLVMDIBuilderCreatePointerType(
        Builder: LLVMDIBuilderRef,
        PointeeTy: LLVMMetadataRef,
        SizeInBits: u64,
        AlignInBits: u32,
        AddressSpace: ::libc::c_uint,
        Name: *const ::libc::c_char,
        NameLen: ::libc::size_t,
    ) -> LLVMMetadataRef;

    /// Create debugging information entry for a struct.
    pub fn LLVMDIBuilderCreateStructType(
        Builder: LLVMDIBuilderRef,
        Scope: LLVMMetadataRef,
        Name: *const ::libc::c_char,
        NameLen: ::libc::size_t,
        File: LLVMMetadataRef,
        LineNumber: ::libc::c_uint,
        SizeInBits: u64,
        AlignInBits: u32,
        Flags: LLVMDIFlags,
        DerivedFrom: LLVMMetadataRef,
        Elements: *mut LLVMMetadataRef,
        NumElements: ::libc::c_uint,
        RunTimeLang: ::libc::c_uint,
        VTableHolder: LLVMMetadataRef,
        UniqueId: *const ::libc::c_char,
        UniqueIdLen: ::libc::size_t,
    ) -> LLVMMetadataRef;

    /// Create debugging information entry for a member.
    pub fn LLVMDIBuilderCreateMemberType(
        Builder: LLVMDIBuilderRef,
        Scope: LLVMMetadataRef,
        Name: *const ::libc::c_char,
        NameLen: ::libc::size_t,
        File: LLVMMetadataRef,
        LineNo: ::libc::c_uint,
        SizeInBits: u64,
        AlignInBits: u32,
        OffsetInBits: u64,
        Flags: LLVMDIFlags,
        Ty: LLVMMetadataRef,
    ) -> LLVMMetadataRef;

    /// Create debugging information entry for a C++ static data member.
    pub fn LLVMDIBuilderCreateStaticMemberType(
        Builder: LLVMDIBuilderRef,
        Scope: LLVMMetadataRef,
        Name: *const ::libc::c_char,
        NameLen: ::libc::size_t,
        File: LLVMMetadataRef,
        LineNumber: ::libc::c_uint,
        Type: LLVMMetadataRef,
        Flags: LLVMDIFlags,
        ConstantVal: LLVMValueRef,
        AlignInBits: u32,
    ) -> LLVMMetadataRef;

    /// Create debugging information entry for a pointer to member.
    pub fn LLVMDIBuilderCreateMemberPointerType(
        Builder: LLVMDIBuilderRef,
        PointeeType: LLVMMetadataRef,
        ClassType: LLVMMetadataRef,
        SizeInBits: u64,
        AlignInBits: u32,
        Flags: LLVMDIFlags,
    ) -> LLVMMetadataRef;

    /// Create debugging information entry for Objective-C instance variable.
    pub fn LLVMDIBuilderCreateObjCIVar(
        Builder: LLVMDIBuilderRef,
        Name: *const ::libc::c_char,
        NameLen: ::libc::size_t,
        File: LLVMMetadataRef,
        LineNo: ::libc::c_uint,
        SizeInBits: u64,
        AlignInBits: u32,
        OffsetInBits: u64,
        Flags: LLVMDIFlags,
        Ty: LLVMMetadataRef,
        PropertyNode: LLVMMetadataRef,
    ) -> LLVMMetadataRef;

    /// Create debugging information entry for Objective-C property.
    pub fn LLVMDIBuilderCreateObjCProperty(
        Builder: LLVMDIBuilderRef,
        Name: *const ::libc::c_char,
        NameLen: ::libc::size_t,
        File: LLVMMetadataRef,
        LineNo: ::libc::c_uint,
        GetterName: *const ::libc::c_char,
        GetterNameLen: ::libc::size_t,
        SetterName: *const ::libc::c_char,
        SetterNameLen: ::libc::size_t,
        PropertyAttributes: ::libc::c_uint,
        Ty: LLVMMetadataRef,
    ) -> LLVMMetadataRef;

    /// Create a uniqued DIType* clone with FlagObjectPointer and FlagArtificial set.
    pub fn LLVMDIBuilderCreateObjectPointerType(
        Builder: LLVMDIBuilderRef,
        Type: LLVMMetadataRef,
    ) -> LLVMMetadataRef;

    /// Create debugging information entry for a qualified type, e.g. 'const int'.
    pub fn LLVMDIBuilderCreateQualifiedType(
        Builder: LLVMDIBuilderRef,
        Tag: ::libc::c_uint,
        Type: LLVMMetadataRef,
    ) -> LLVMMetadataRef;

    /// Create debugging information entry for a c++ style reference or rvalue reference type.
    pub fn LLVMDIBuilderCreateReferenceType(
        Builder: LLVMDIBuilderRef,
        Tag: ::libc::c_uint,
        Type: LLVMMetadataRef,
    ) -> LLVMMetadataRef;

    /// Create C++11 nullptr type.
    pub fn LLVMDIBuilderCreateNullPtrType(Builder: LLVMDIBuilderRef) -> LLVMMetadataRef;

    /// Create debugging information entry for a typedef.
    pub fn LLVMDIBuilderCreateTypedef(
        Builder: LLVMDIBuilderRef,
        Type: LLVMMetadataRef,
        Name: *const ::libc::c_char,
        NameLen: ::libc::size_t,
        File: LLVMMetadataRef,
        LineNo: ::libc::c_uint,
        Scope: LLVMMetadataRef,
        AlignInBits: u32,
    ) -> LLVMMetadataRef;

    /// Create debugging information entry to establish inheritance relationship between two types.
    pub fn LLVMDIBuilderCreateInheritance(
        Builder: LLVMDIBuilderRef,
        Ty: LLVMMetadataRef,
        BaseTy: LLVMMetadataRef,
        BaseOffset: u64,
        VBPtrOffset: u32,
        Flags: LLVMDIFlags,
    ) -> LLVMMetadataRef;

    /// Create a permanent forward-declared type.
    pub fn LLVMDIBuilderCreateForwardDecl(
        Builder: LLVMDIBuilderRef,
        Tag: ::libc::c_uint,
        Name: *const ::libc::c_char,
        NameLen: ::libc::size_t,
        Scope: LLVMMetadataRef,
        File: LLVMMetadataRef,
        Line: ::libc::c_uint,
        RuntimeLang: ::libc::c_uint,
        SizeInBits: u64,
        AlignInBits: u32,
        UniqueIdentifier: *const ::libc::c_char,
        UniqueIdentifierLen: ::libc::size_t,
    ) -> LLVMMetadataRef;

    /// Create a temporary forward-declared type.
    pub fn LLVMDIBuilderCreateReplaceableCompositeType(
        Builder: LLVMDIBuilderRef,
        Tag: ::libc::c_uint,
        Name: *const ::libc::c_char,
        NameLen: ::libc::size_t,
        Scope: LLVMMetadataRef,
        File: LLVMMetadataRef,
        Line: ::libc::c_uint,
        RuntimeLang: ::libc::c_uint,
        SizeInBits: u64,
        AlignInBits: u32,
        Flags: LLVMDIFlags,
        UniqueIdentifier: *const ::libc::c_char,
        UniqueIdentifierLen: ::libc::size_t,
    ) -> LLVMMetadataRef;

    /// Create debugging information entry for a bit field member.
    pub fn LLVMDIBuilderCreateBitFieldMemberType(
        Builder: LLVMDIBuilderRef,
        Scope: LLVMMetadataRef,
        Name: *const ::libc::c_char,
        NameLen: ::libc::size_t,
        File: LLVMMetadataRef,
        LineNumber: ::libc::c_uint,
        SizeInBits: u64,
        OffsetInBits: u64,
        StorageOffsetInBits: u64,
        Flags: LLVMDIFlags,
        Type: LLVMMetadataRef,
    ) -> LLVMMetadataRef;

    /// Create debugging information entry for a class.
    pub fn LLVMDIBuilderCreateClassType(
        Builder: LLVMDIBuilderRef,
        Scope: LLVMMetadataRef,
        Name: *const ::libc::c_char,
        NameLen: ::libc::size_t,
        File: LLVMMetadataRef,
        LineNumber: ::libc::c_uint,
        SizeInBits: u64,
        AlignInBits: u32,
        OffsetInBits: u64,
        Flags: LLVMDIFlags,
        DerivedFrom: LLVMMetadataRef,
        Elements: *mut LLVMMetadataRef,
        NumElements: ::libc::c_uint,
        VTableHolder: LLVMMetadataRef,
        TemplateParamsNode: LLVMMetadataRef,
        UniqueIdentifier: *const ::libc::c_char,
        UniqueIdentifierLen: ::libc::size_t,
    ) -> LLVMMetadataRef;

    /// Create a uniqued DIType* clone with FlagArtificial set.
    pub fn LLVMDIBuilderCreateArtificialType(
        Builder: LLVMDIBuilderRef,
        Type: LLVMMetadataRef,
    ) -> LLVMMetadataRef;

    /// Get the name of this DIType.
    pub fn LLVMDITypeGetName(
        DType: LLVMMetadataRef,
        Length: *mut ::libc::size_t,
    ) -> *const ::libc::c_char;

    /// Get the size of this DIType in bits.
    pub fn LLVMDITypeGetSizeInBits(DType: LLVMMetadataRef) -> u64;

    /// Get the offset of this DIType in bits.
    pub fn LLVMDITypeGetOffsetInBits(DType: LLVMMetadataRef) -> u64;

    /// Get the alignment of this DIType in bits.
    pub fn LLVMDITypeGetAlignInBits(DType: LLVMMetadataRef) -> u32;

    /// Get the source line where this DIType is declared.
    pub fn LLVMDITypeGetLine(DType: LLVMMetadataRef) -> ::libc::c_uint;

    /// Get the flags associated with this DIType.
    pub fn LLVMDITypeGetFlags(DType: LLVMMetadataRef) -> LLVMDIFlags;

    /// Create a descriptor for a value range.
    pub fn LLVMDIBuilderGetOrCreateSubrange(
        Builder: LLVMDIBuilderRef,
        LowerBound: i64,
        Count: i64,
    ) -> LLVMMetadataRef;

    /// Create an array of DI Nodes.
    pub fn LLVMDIBuilderGetOrCreateArray(
        Builder: LLVMDIBuilderRef,
        Data: *mut LLVMMetadataRef,
        NumElements: ::libc::size_t,
    ) -> LLVMMetadataRef;

    /// Create a new descriptor for the specified variable which has a complex
    pub fn LLVMDIBuilderCreateExpression(
        Builder: LLVMDIBuilderRef,
        Addr: *mut u64,
        Length: ::libc::size_t,
    ) -> LLVMMetadataRef;

    /// Create a new descriptor for the specified variable that does not have an
    pub fn LLVMDIBuilderCreateConstantValueExpression(
        Builder: LLVMDIBuilderRef,
        Value: u64,
    ) -> LLVMMetadataRef;

    /// Create a new descriptor for the specified variable.
    pub fn LLVMDIBuilderCreateGlobalVariableExpression(
        Builder: LLVMDIBuilderRef,
        Scope: LLVMMetadataRef,
        Name: *const ::libc::c_char,
        NameLen: ::libc::size_t,
        Linkage: *const ::libc::c_char,
        LinkLen: ::libc::size_t,
        File: LLVMMetadataRef,
        LineNo: ::libc::c_uint,
        Ty: LLVMMetadataRef,
        LocalToUnit: LLVMBool,
        Expr: LLVMMetadataRef,
        Decl: LLVMMetadataRef,
        AlignInBits: u32,
    ) -> LLVMMetadataRef;

    /// Get the dwarf::Tag of a DINode
    pub fn LLVMGetDINodeTag(MD: LLVMMetadataRef) -> u16;

    /// Retrieves the DIVariable associated with this global variable expression.
    pub fn LLVMDIGlobalVariableExpressionGetVariable(GVE: LLVMMetadataRef) -> LLVMMetadataRef;

    /// Retrieves the DIExpression associated with this global variable expression.
    pub fn LLVMDIGlobalVariableExpressionGetExpression(GVE: LLVMMetadataRef) -> LLVMMetadataRef;

    ///Get the metadata of the file associated with a given variable.
    pub fn LLVMDIVariableGetFile(Var: LLVMMetadataRef) -> LLVMMetadataRef;

    /// Get the metadata of the scope associated with a given variable.
    pub fn LLVMDIVariableGetScope(Var: LLVMMetadataRef) -> LLVMMetadataRef;

    /// Get the source line where this \c DIVariable is declared.
    pub fn LLVMDIVariableGetLine(Var: LLVMMetadataRef) -> ::libc::c_uint;

    /// Create a new temporary \c MDNode.  Suitable for use in constructing cyclic
    pub fn LLVMTemporaryMDNode(
        Ctx: LLVMContextRef,
        Data: *mut LLVMMetadataRef,
        NumElements: ::libc::size_t,
    ) -> LLVMMetadataRef;

    /// Deallocate a temporary node.
    pub fn LLVMDisposeTemporaryMDNode(TempNode: LLVMMetadataRef);

    /// Replace all uses of temporary metadata.
    pub fn LLVMMetadataReplaceAllUsesWith(
        TempTargetMetadata: LLVMMetadataRef,
        Replacement: LLVMMetadataRef,
    );

    /// Create a new descriptor for the specified global variable that is temporary
    pub fn LLVMDIBuilderCreateTempGlobalVariableFwdDecl(
        Builder: LLVMDIBuilderRef,
        Scope: LLVMMetadataRef,
        Name: *const ::libc::c_char,
        NameLen: ::libc::size_t,
        Linkage: *const ::libc::c_char,
        LnkLen: ::libc::size_t,
        File: LLVMMetadataRef,
        LineNo: ::libc::c_uint,
        Ty: LLVMMetadataRef,
        LocalToUnit: LLVMBool,
        Decl: LLVMMetadataRef,
        AlignInBits: u32,
    ) -> LLVMMetadataRef;

    /// Insert a new llvm.dbg.declare intrinsic call before the given instruction.
    pub fn LLVMDIBuilderInsertDeclareBefore(
        Builder: LLVMDIBuilderRef,
        Storage: LLVMValueRef,
        VarInfo: LLVMMetadataRef,
        Expr: LLVMMetadataRef,
        DebugLoc: LLVMMetadataRef,
        Instr: LLVMValueRef,
    ) -> LLVMValueRef;

    /// 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.
    pub fn LLVMDIBuilderInsertDeclareAtEnd(
        Builder: LLVMDIBuilderRef,
        Storage: LLVMValueRef,
        VarInfo: LLVMMetadataRef,
        Expr: LLVMMetadataRef,
        DebugLoc: LLVMMetadataRef,
        Block: LLVMBasicBlockRef,
    ) -> LLVMValueRef;

    /// Insert a new llvm.dbg.value intrinsic call before the given instruction.
    pub fn LLVMDIBuilderInsertDbgValueBefore(
        Builder: LLVMDIBuilderRef,
        Val: LLVMValueRef,
        VarInfo: LLVMMetadataRef,
        Expr: LLVMMetadataRef,
        DebugLoc: LLVMMetadataRef,
        Instr: LLVMValueRef,
    ) -> LLVMValueRef;

    /// 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.
    pub fn LLVMDIBuilderInsertDbgValueAtEnd(
        Builder: LLVMDIBuilderRef,
        Val: LLVMValueRef,
        VarInfo: LLVMMetadataRef,
        Expr: LLVMMetadataRef,
        DebugLoc: LLVMMetadataRef,
        Block: LLVMBasicBlockRef,
    ) -> LLVMValueRef;

    /// Create a new descriptor for a local auto variable.
    pub fn LLVMDIBuilderCreateAutoVariable(
        Builder: LLVMDIBuilderRef,
        Scope: LLVMMetadataRef,
        Name: *const ::libc::c_char,
        NameLen: ::libc::size_t,
        File: LLVMMetadataRef,
        LineNo: ::libc::c_uint,
        Ty: LLVMMetadataRef,
        AlwaysPreserve: LLVMBool,
        Flags: LLVMDIFlags,
        AlignInBits: u32,
    ) -> LLVMMetadataRef;

    /// Create a new descriptor for a function parameter variable.
    pub fn LLVMDIBuilderCreateParameterVariable(
        Builder: LLVMDIBuilderRef,
        Scope: LLVMMetadataRef,
        Name: *const ::libc::c_char,
        NameLen: ::libc::size_t,
        ArgNo: ::libc::c_uint,
        File: LLVMMetadataRef,
        LineNo: ::libc::c_uint,
        Ty: LLVMMetadataRef,
        AlwaysPreserve: LLVMBool,
        Flags: LLVMDIFlags,
    ) -> LLVMMetadataRef;

    /// Get the metadata of the subprogram attached to a function.
    pub fn LLVMGetSubprogram(Func: LLVMValueRef) -> LLVMMetadataRef;

    /// Set the subprogram attached to a function.
    pub fn LLVMSetSubprogram(Func: LLVMValueRef, SP: LLVMMetadataRef);

    /// Get the line associated with a given subprogram.
    pub fn LLVMDISubprogramGetLine(Subprogram: LLVMMetadataRef) -> ::libc::c_uint;

    /// Get the debug location for the given instruction.
    pub fn LLVMInstructionGetDebugLoc(Inst: LLVMValueRef) -> LLVMMetadataRef;

    /// Set the debug location for the given instruction.
    pub fn LLVMInstructionSetDebugLoc(Inst: LLVMValueRef, Loc: LLVMMetadataRef);

    /// Obtain the enumerated type of a metadata instance.
    pub fn LLVMGetMetadataKind(Metadata: LLVMMetadataRef) -> LLVMMetadataKind;
}