1 //===------------ DebugInfo.h - LLVM C API Debug Info API -----------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 ///
10 /// This file declares the C API endpoints for generating DWARF Debug Info
11 ///
12 /// Note: This interface is experimental. It is *NOT* stable, and may be
13 ///       changed without warning.
14 ///
15 //===----------------------------------------------------------------------===//
16 
17 #ifndef LLVM_C_DEBUGINFO_H
18 #define LLVM_C_DEBUGINFO_H
19 
20 #include "llvm-c/Core.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 /**
27  * Debug info flags.
28  */
29 typedef enum {
30   LLVMDIFlagZero = 0,
31   LLVMDIFlagPrivate = 1,
32   LLVMDIFlagProtected = 2,
33   LLVMDIFlagPublic = 3,
34   LLVMDIFlagFwdDecl = 1 << 2,
35   LLVMDIFlagAppleBlock = 1 << 3,
36   LLVMDIFlagBlockByrefStruct = 1 << 4,
37   LLVMDIFlagVirtual = 1 << 5,
38   LLVMDIFlagArtificial = 1 << 6,
39   LLVMDIFlagExplicit = 1 << 7,
40   LLVMDIFlagPrototyped = 1 << 8,
41   LLVMDIFlagObjcClassComplete = 1 << 9,
42   LLVMDIFlagObjectPointer = 1 << 10,
43   LLVMDIFlagVector = 1 << 11,
44   LLVMDIFlagStaticMember = 1 << 12,
45   LLVMDIFlagLValueReference = 1 << 13,
46   LLVMDIFlagRValueReference = 1 << 14,
47   LLVMDIFlagReserved = 1 << 15,
48   LLVMDIFlagSingleInheritance = 1 << 16,
49   LLVMDIFlagMultipleInheritance = 2 << 16,
50   LLVMDIFlagVirtualInheritance = 3 << 16,
51   LLVMDIFlagIntroducedVirtual = 1 << 18,
52   LLVMDIFlagBitField = 1 << 19,
53   LLVMDIFlagNoReturn = 1 << 20,
54   LLVMDIFlagMainSubprogram = 1 << 21,
55   LLVMDIFlagTypePassByValue = 1 << 22,
56   LLVMDIFlagTypePassByReference = 1 << 23,
57   LLVMDIFlagFixedEnum = 1 << 24,
58   LLVMDIFlagThunk = 1 << 25,
59   LLVMDIFlagTrivial = 1 << 26,
60   LLVMDIFlagIndirectVirtualBase = (1 << 2) | (1 << 5),
61   LLVMDIFlagAccessibility = LLVMDIFlagPrivate | LLVMDIFlagProtected |
62                             LLVMDIFlagPublic,
63   LLVMDIFlagPtrToMemberRep = LLVMDIFlagSingleInheritance |
64                              LLVMDIFlagMultipleInheritance |
65                              LLVMDIFlagVirtualInheritance
66 } LLVMDIFlags;
67 
68 /**
69  * Source languages known by DWARF.
70  */
71 typedef enum {
72   LLVMDWARFSourceLanguageC89,
73   LLVMDWARFSourceLanguageC,
74   LLVMDWARFSourceLanguageAda83,
75   LLVMDWARFSourceLanguageC_plus_plus,
76   LLVMDWARFSourceLanguageCobol74,
77   LLVMDWARFSourceLanguageCobol85,
78   LLVMDWARFSourceLanguageFortran77,
79   LLVMDWARFSourceLanguageFortran90,
80   LLVMDWARFSourceLanguagePascal83,
81   LLVMDWARFSourceLanguageModula2,
82   // New in DWARF v3:
83   LLVMDWARFSourceLanguageJava,
84   LLVMDWARFSourceLanguageC99,
85   LLVMDWARFSourceLanguageAda95,
86   LLVMDWARFSourceLanguageFortran95,
87   LLVMDWARFSourceLanguagePLI,
88   LLVMDWARFSourceLanguageObjC,
89   LLVMDWARFSourceLanguageObjC_plus_plus,
90   LLVMDWARFSourceLanguageUPC,
91   LLVMDWARFSourceLanguageD,
92   // New in DWARF v4:
93   LLVMDWARFSourceLanguagePython,
94   // New in DWARF v5:
95   LLVMDWARFSourceLanguageOpenCL,
96   LLVMDWARFSourceLanguageGo,
97   LLVMDWARFSourceLanguageModula3,
98   LLVMDWARFSourceLanguageHaskell,
99   LLVMDWARFSourceLanguageC_plus_plus_03,
100   LLVMDWARFSourceLanguageC_plus_plus_11,
101   LLVMDWARFSourceLanguageOCaml,
102   LLVMDWARFSourceLanguageRust,
103   LLVMDWARFSourceLanguageC11,
104   LLVMDWARFSourceLanguageSwift,
105   LLVMDWARFSourceLanguageJulia,
106   LLVMDWARFSourceLanguageDylan,
107   LLVMDWARFSourceLanguageC_plus_plus_14,
108   LLVMDWARFSourceLanguageFortran03,
109   LLVMDWARFSourceLanguageFortran08,
110   LLVMDWARFSourceLanguageRenderScript,
111   LLVMDWARFSourceLanguageBLISS,
112   // Vendor extensions:
113   LLVMDWARFSourceLanguageMips_Assembler,
114   LLVMDWARFSourceLanguageGOOGLE_RenderScript,
115   LLVMDWARFSourceLanguageBORLAND_Delphi
116 } LLVMDWARFSourceLanguage;
117 
118 /**
119  * The amount of debug information to emit.
120  */
121 typedef enum {
122     LLVMDWARFEmissionNone = 0,
123     LLVMDWARFEmissionFull,
124     LLVMDWARFEmissionLineTablesOnly
125 } LLVMDWARFEmissionKind;
126 
127 /**
128  * An LLVM DWARF type encoding.
129  */
130 typedef unsigned LLVMDWARFTypeEncoding;
131 
132 /**
133  * The current debug metadata version number.
134  */
135 unsigned LLVMDebugMetadataVersion(void);
136 
137 /**
138  * The version of debug metadata that's present in the provided \c Module.
139  */
140 unsigned LLVMGetModuleDebugMetadataVersion(LLVMModuleRef Module);
141 
142 /**
143  * Strip debug info in the module if it exists.
144  * To do this, we remove all calls to the debugger intrinsics and any named
145  * metadata for debugging. We also remove debug locations for instructions.
146  * Return true if module is modified.
147  */
148 LLVMBool LLVMStripModuleDebugInfo(LLVMModuleRef Module);
149 
150 /**
151  * Construct a builder for a module, and do not allow for unresolved nodes
152  * attached to the module.
153  */
154 LLVMDIBuilderRef LLVMCreateDIBuilderDisallowUnresolved(LLVMModuleRef M);
155 
156 /**
157  * Construct a builder for a module and collect unresolved nodes attached
158  * to the module in order to resolve cycles during a call to
159  * \c LLVMDIBuilderFinalize.
160  */
161 LLVMDIBuilderRef LLVMCreateDIBuilder(LLVMModuleRef M);
162 
163 /**
164  * Deallocates the \c DIBuilder and everything it owns.
165  * @note You must call \c LLVMDIBuilderFinalize before this
166  */
167 void LLVMDisposeDIBuilder(LLVMDIBuilderRef Builder);
168 
169 /**
170  * Construct any deferred debug info descriptors.
171  */
172 void LLVMDIBuilderFinalize(LLVMDIBuilderRef Builder);
173 
174 /**
175  * A CompileUnit provides an anchor for all debugging
176  * information generated during this instance of compilation.
177  * \param Lang          Source programming language, eg.
178  *                      \c LLVMDWARFSourceLanguageC99
179  * \param FileRef       File info.
180  * \param Producer      Identify the producer of debugging information
181  *                      and code.  Usually this is a compiler
182  *                      version string.
183  * \param ProducerLen   The length of the C string passed to \c Producer.
184  * \param isOptimized   A boolean flag which indicates whether optimization
185  *                      is enabled or not.
186  * \param Flags         This string lists command line options. This
187  *                      string is directly embedded in debug info
188  *                      output which may be used by a tool
189  *                      analyzing generated debugging information.
190  * \param FlagsLen      The length of the C string passed to \c Flags.
191  * \param RuntimeVer    This indicates runtime version for languages like
192  *                      Objective-C.
193  * \param SplitName     The name of the file that we'll split debug info
194  *                      out into.
195  * \param SplitNameLen  The length of the C string passed to \c SplitName.
196  * \param Kind          The kind of debug information to generate.
197  * \param DWOId         The DWOId if this is a split skeleton compile unit.
198  * \param SplitDebugInlining    Whether to emit inline debug info.
199  * \param DebugInfoForProfiling Whether to emit extra debug info for
200  *                              profile collection.
201  */
202 LLVMMetadataRef LLVMDIBuilderCreateCompileUnit(
203     LLVMDIBuilderRef Builder, LLVMDWARFSourceLanguage Lang,
204     LLVMMetadataRef FileRef, const char *Producer, size_t ProducerLen,
205     LLVMBool isOptimized, const char *Flags, size_t FlagsLen,
206     unsigned RuntimeVer, const char *SplitName, size_t SplitNameLen,
207     LLVMDWARFEmissionKind Kind, unsigned DWOId, LLVMBool SplitDebugInlining,
208     LLVMBool DebugInfoForProfiling);
209 
210 /**
211  * Create a file descriptor to hold debugging information for a file.
212  * \param Builder      The \c DIBuilder.
213  * \param Filename     File name.
214  * \param FilenameLen  The length of the C string passed to \c Filename.
215  * \param Directory    Directory.
216  * \param DirectoryLen The length of the C string passed to \c Directory.
217  */
218 LLVMMetadataRef
219 LLVMDIBuilderCreateFile(LLVMDIBuilderRef Builder, const char *Filename,
220                         size_t FilenameLen, const char *Directory,
221                         size_t DirectoryLen);
222 
223 /**
224  * Creates a new descriptor for a module with the specified parent scope.
225  * \param Builder         The \c DIBuilder.
226  * \param ParentScope     The parent scope containing this module declaration.
227  * \param Name            Module name.
228  * \param NameLen         The length of the C string passed to \c Name.
229  * \param ConfigMacros    A space-separated shell-quoted list of -D macro
230                           definitions as they would appear on a command line.
231  * \param ConfigMacrosLen The length of the C string passed to \c ConfigMacros.
232  * \param IncludePath     The path to the module map file.
233  * \param IncludePathLen  The length of the C string passed to \c IncludePath.
234  * \param ISysRoot        The Clang system root (value of -isysroot).
235  * \param ISysRootLen     The length of the C string passed to \c ISysRoot.
236  */
237 LLVMMetadataRef
238 LLVMDIBuilderCreateModule(LLVMDIBuilderRef Builder, LLVMMetadataRef ParentScope,
239                           const char *Name, size_t NameLen,
240                           const char *ConfigMacros, size_t ConfigMacrosLen,
241                           const char *IncludePath, size_t IncludePathLen,
242                           const char *ISysRoot, size_t ISysRootLen);
243 
244 /**
245  * Creates a new descriptor for a namespace with the specified parent scope.
246  * \param Builder          The \c DIBuilder.
247  * \param ParentScope      The parent scope containing this module declaration.
248  * \param Name             NameSpace name.
249  * \param NameLen          The length of the C string passed to \c Name.
250  * \param ExportSymbols    Whether or not the namespace exports symbols, e.g.
251  *                         this is true of C++ inline namespaces.
252  */
253 LLVMMetadataRef
254 LLVMDIBuilderCreateNameSpace(LLVMDIBuilderRef Builder,
255                              LLVMMetadataRef ParentScope,
256                              const char *Name, size_t NameLen,
257                              LLVMBool ExportSymbols);
258 
259 /**
260  * Create a new descriptor for the specified subprogram.
261  * \param Builder         The \c DIBuilder.
262  * \param Scope           Function scope.
263  * \param Name            Function name.
264  * \param NameLen         Length of enumeration name.
265  * \param LinkageName     Mangled function name.
266  * \param LinkageNameLen  Length of linkage name.
267  * \param File            File where this variable is defined.
268  * \param LineNo          Line number.
269  * \param Ty              Function type.
270  * \param IsLocalToUnit   True if this function is not externally visible.
271  * \param IsDefinition    True if this is a function definition.
272  * \param ScopeLine       Set to the beginning of the scope this starts
273  * \param Flags           E.g.: \c LLVMDIFlagLValueReference. These flags are
274  *                        used to emit dwarf attributes.
275  * \param IsOptimized     True if optimization is ON.
276  */
277 LLVMMetadataRef LLVMDIBuilderCreateFunction(
278     LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
279     size_t NameLen, const char *LinkageName, size_t LinkageNameLen,
280     LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty,
281     LLVMBool IsLocalToUnit, LLVMBool IsDefinition,
282     unsigned ScopeLine, LLVMDIFlags Flags, LLVMBool IsOptimized);
283 
284 /**
285  * Create a descriptor for a lexical block with the specified parent context.
286  * \param Builder      The \c DIBuilder.
287  * \param Scope        Parent lexical block.
288  * \param File         Source file.
289  * \param Line         The line in the source file.
290  * \param Column       The column in the source file.
291  */
292 LLVMMetadataRef LLVMDIBuilderCreateLexicalBlock(
293     LLVMDIBuilderRef Builder, LLVMMetadataRef Scope,
294     LLVMMetadataRef File, unsigned Line, unsigned Column);
295 
296 /**
297  * Create a descriptor for a lexical block with a new file attached.
298  * \param Builder        The \c DIBuilder.
299  * \param Scope          Lexical block.
300  * \param File           Source file.
301  * \param Discriminator  DWARF path discriminator value.
302  */
303 LLVMMetadataRef
304 LLVMDIBuilderCreateLexicalBlockFile(LLVMDIBuilderRef Builder,
305                                     LLVMMetadataRef Scope,
306                                     LLVMMetadataRef File,
307                                     unsigned Discriminator);
308 
309 /**
310  * Create a descriptor for an imported namespace. Suitable for e.g. C++
311  * using declarations.
312  * \param Builder    The \c DIBuilder.
313  * \param Scope      The scope this module is imported into
314  * \param File       File where the declaration is located.
315  * \param Line       Line number of the declaration.
316  */
317 LLVMMetadataRef
318 LLVMDIBuilderCreateImportedModuleFromNamespace(LLVMDIBuilderRef Builder,
319                                                LLVMMetadataRef Scope,
320                                                LLVMMetadataRef NS,
321                                                LLVMMetadataRef File,
322                                                unsigned Line);
323 
324 /**
325  * Create a descriptor for an imported module that aliases another
326  * imported entity descriptor.
327  * \param Builder        The \c DIBuilder.
328  * \param Scope          The scope this module is imported into
329  * \param ImportedEntity Previous imported entity to alias.
330  * \param File           File where the declaration is located.
331  * \param Line           Line number of the declaration.
332  */
333 LLVMMetadataRef
334 LLVMDIBuilderCreateImportedModuleFromAlias(LLVMDIBuilderRef Builder,
335                                            LLVMMetadataRef Scope,
336                                            LLVMMetadataRef ImportedEntity,
337                                            LLVMMetadataRef File,
338                                            unsigned Line);
339 
340 /**
341  * Create a descriptor for an imported module.
342  * \param Builder    The \c DIBuilder.
343  * \param Scope      The scope this module is imported into
344  * \param M          The module being imported here
345  * \param File       File where the declaration is located.
346  * \param Line       Line number of the declaration.
347  */
348 LLVMMetadataRef
349 LLVMDIBuilderCreateImportedModuleFromModule(LLVMDIBuilderRef Builder,
350                                             LLVMMetadataRef Scope,
351                                             LLVMMetadataRef M,
352                                             LLVMMetadataRef File,
353                                             unsigned Line);
354 
355 /**
356  * Create a descriptor for an imported function, type, or variable.  Suitable
357  * for e.g. FORTRAN-style USE declarations.
358  * \param Builder    The DIBuilder.
359  * \param Scope      The scope this module is imported into.
360  * \param Decl       The declaration (or definition) of a function, type,
361                      or variable.
362  * \param File       File where the declaration is located.
363  * \param Line       Line number of the declaration.
364  * \param Name       A name that uniquely identifies this imported declaration.
365  * \param NameLen    The length of the C string passed to \c Name.
366  */
367 LLVMMetadataRef
368 LLVMDIBuilderCreateImportedDeclaration(LLVMDIBuilderRef Builder,
369                                        LLVMMetadataRef Scope,
370                                        LLVMMetadataRef Decl,
371                                        LLVMMetadataRef File,
372                                        unsigned Line,
373                                        const char *Name, size_t NameLen);
374 
375 /**
376  * Creates a new DebugLocation that describes a source location.
377  * \param Line The line in the source file.
378  * \param Column The column in the source file.
379  * \param Scope The scope in which the location resides.
380  * \param InlinedAt The scope where this location was inlined, if at all.
381  *                  (optional).
382  * \note If the item to which this location is attached cannot be
383  *       attributed to a source line, pass 0 for the line and column.
384  */
385 LLVMMetadataRef
386 LLVMDIBuilderCreateDebugLocation(LLVMContextRef Ctx, unsigned Line,
387                                  unsigned Column, LLVMMetadataRef Scope,
388                                  LLVMMetadataRef InlinedAt);
389 
390 /**
391  * Get the line number of this debug location.
392  * \param Location     The debug location.
393  *
394  * @see DILocation::getLine()
395  */
396 unsigned LLVMDILocationGetLine(LLVMMetadataRef Location);
397 
398 /**
399  * Get the column number of this debug location.
400  * \param Location     The debug location.
401  *
402  * @see DILocation::getColumn()
403  */
404 unsigned LLVMDILocationGetColumn(LLVMMetadataRef Location);
405 
406 /**
407  * Get the local scope associated with this debug location.
408  * \param Location     The debug location.
409  *
410  * @see DILocation::getScope()
411  */
412 LLVMMetadataRef LLVMDILocationGetScope(LLVMMetadataRef Location);
413 
414 /**
415  * Create a type array.
416  * \param Builder        The DIBuilder.
417  * \param Data           The type elements.
418  * \param NumElements    Number of type elements.
419  */
420 LLVMMetadataRef LLVMDIBuilderGetOrCreateTypeArray(LLVMDIBuilderRef Builder,
421                                                   LLVMMetadataRef *Data,
422                                                   size_t NumElements);
423 
424 /**
425  * Create subroutine type.
426  * \param Builder        The DIBuilder.
427  * \param File            The file in which the subroutine resides.
428  * \param ParameterTypes  An array of subroutine parameter types. This
429  *                        includes return type at 0th index.
430  * \param NumParameterTypes The number of parameter types in \c ParameterTypes
431  * \param Flags           E.g.: \c LLVMDIFlagLValueReference.
432  *                        These flags are used to emit dwarf attributes.
433  */
434 LLVMMetadataRef
435 LLVMDIBuilderCreateSubroutineType(LLVMDIBuilderRef Builder,
436                                   LLVMMetadataRef File,
437                                   LLVMMetadataRef *ParameterTypes,
438                                   unsigned NumParameterTypes,
439                                   LLVMDIFlags Flags);
440 
441 /**
442  * Create debugging information entry for an enumeration.
443  * \param Builder        The DIBuilder.
444  * \param Scope          Scope in which this enumeration is defined.
445  * \param Name           Enumeration name.
446  * \param NameLen        Length of enumeration name.
447  * \param File           File where this member is defined.
448  * \param LineNumber     Line number.
449  * \param SizeInBits     Member size.
450  * \param AlignInBits    Member alignment.
451  * \param Elements       Enumeration elements.
452  * \param NumElements    Number of enumeration elements.
453  * \param ClassTy        Underlying type of a C++11/ObjC fixed enum.
454  */
455 LLVMMetadataRef LLVMDIBuilderCreateEnumerationType(
456     LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
457     size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,
458     uint64_t SizeInBits, uint32_t AlignInBits, LLVMMetadataRef *Elements,
459     unsigned NumElements, LLVMMetadataRef ClassTy);
460 
461 /**
462  * Create debugging information entry for a union.
463  * \param Builder      The DIBuilder.
464  * \param Scope        Scope in which this union is defined.
465  * \param Name         Union name.
466  * \param NameLen      Length of union name.
467  * \param File         File where this member is defined.
468  * \param LineNumber   Line number.
469  * \param SizeInBits   Member size.
470  * \param AlignInBits  Member alignment.
471  * \param Flags        Flags to encode member attribute, e.g. private
472  * \param Elements     Union elements.
473  * \param NumElements  Number of union elements.
474  * \param RunTimeLang  Optional parameter, Objective-C runtime version.
475  * \param UniqueId     A unique identifier for the union.
476  * \param UniqueIdLen  Length of unique identifier.
477  */
478 LLVMMetadataRef LLVMDIBuilderCreateUnionType(
479     LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
480     size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,
481     uint64_t SizeInBits, uint32_t AlignInBits, LLVMDIFlags Flags,
482     LLVMMetadataRef *Elements, unsigned NumElements, unsigned RunTimeLang,
483     const char *UniqueId, size_t UniqueIdLen);
484 
485 
486 /**
487  * Create debugging information entry for an array.
488  * \param Builder      The DIBuilder.
489  * \param Size         Array size.
490  * \param AlignInBits  Alignment.
491  * \param Ty           Element type.
492  * \param Subscripts   Subscripts.
493  * \param NumSubscripts Number of subscripts.
494  */
495 LLVMMetadataRef
496 LLVMDIBuilderCreateArrayType(LLVMDIBuilderRef Builder, uint64_t Size,
497                              uint32_t AlignInBits, LLVMMetadataRef Ty,
498                              LLVMMetadataRef *Subscripts,
499                              unsigned NumSubscripts);
500 
501 /**
502  * Create debugging information entry for a vector type.
503  * \param Builder      The DIBuilder.
504  * \param Size         Vector size.
505  * \param AlignInBits  Alignment.
506  * \param Ty           Element type.
507  * \param Subscripts   Subscripts.
508  * \param NumSubscripts Number of subscripts.
509  */
510 LLVMMetadataRef
511 LLVMDIBuilderCreateVectorType(LLVMDIBuilderRef Builder, uint64_t Size,
512                               uint32_t AlignInBits, LLVMMetadataRef Ty,
513                               LLVMMetadataRef *Subscripts,
514                               unsigned NumSubscripts);
515 
516 /**
517  * Create a DWARF unspecified type.
518  * \param Builder   The DIBuilder.
519  * \param Name      The unspecified type's name.
520  * \param NameLen   Length of type name.
521  */
522 LLVMMetadataRef
523 LLVMDIBuilderCreateUnspecifiedType(LLVMDIBuilderRef Builder, const char *Name,
524                                    size_t NameLen);
525 
526 /**
527  * Create debugging information entry for a basic
528  * type.
529  * \param Builder     The DIBuilder.
530  * \param Name        Type name.
531  * \param NameLen     Length of type name.
532  * \param SizeInBits  Size of the type.
533  * \param Encoding    DWARF encoding code, e.g. \c LLVMDWARFTypeEncoding_float.
534  */
535 LLVMMetadataRef
536 LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef Builder, const char *Name,
537                              size_t NameLen, uint64_t SizeInBits,
538                              LLVMDWARFTypeEncoding Encoding);
539 
540 /**
541  * Create debugging information entry for a pointer.
542  * \param Builder     The DIBuilder.
543  * \param PointeeTy         Type pointed by this pointer.
544  * \param SizeInBits        Size.
545  * \param AlignInBits       Alignment. (optional, pass 0 to ignore)
546  * \param AddressSpace      DWARF address space. (optional, pass 0 to ignore)
547  * \param Name              Pointer type name. (optional)
548  * \param NameLen           Length of pointer type name. (optional)
549  */
550 LLVMMetadataRef LLVMDIBuilderCreatePointerType(
551     LLVMDIBuilderRef Builder, LLVMMetadataRef PointeeTy,
552     uint64_t SizeInBits, uint32_t AlignInBits, unsigned AddressSpace,
553     const char *Name, size_t NameLen);
554 
555 /**
556  * Create debugging information entry for a struct.
557  * \param Builder     The DIBuilder.
558  * \param Scope        Scope in which this struct is defined.
559  * \param Name         Struct name.
560  * \param NameLen      Struct name length.
561  * \param File         File where this member is defined.
562  * \param LineNumber   Line number.
563  * \param SizeInBits   Member size.
564  * \param AlignInBits  Member alignment.
565  * \param Flags        Flags to encode member attribute, e.g. private
566  * \param Elements     Struct elements.
567  * \param NumElements  Number of struct elements.
568  * \param RunTimeLang  Optional parameter, Objective-C runtime version.
569  * \param VTableHolder The object containing the vtable for the struct.
570  * \param UniqueId     A unique identifier for the struct.
571  * \param UniqueIdLen  Length of the unique identifier for the struct.
572  */
573 LLVMMetadataRef LLVMDIBuilderCreateStructType(
574     LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
575     size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,
576     uint64_t SizeInBits, uint32_t AlignInBits, LLVMDIFlags Flags,
577     LLVMMetadataRef DerivedFrom, LLVMMetadataRef *Elements,
578     unsigned NumElements, unsigned RunTimeLang, LLVMMetadataRef VTableHolder,
579     const char *UniqueId, size_t UniqueIdLen);
580 
581 /**
582  * Create debugging information entry for a member.
583  * \param Builder      The DIBuilder.
584  * \param Scope        Member scope.
585  * \param Name         Member name.
586  * \param NameLen      Length of member name.
587  * \param File         File where this member is defined.
588  * \param LineNo       Line number.
589  * \param SizeInBits   Member size.
590  * \param AlignInBits  Member alignment.
591  * \param OffsetInBits Member offset.
592  * \param Flags        Flags to encode member attribute, e.g. private
593  * \param Ty           Parent type.
594  */
595 LLVMMetadataRef LLVMDIBuilderCreateMemberType(
596     LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
597     size_t NameLen, LLVMMetadataRef File, unsigned LineNo,
598     uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
599     LLVMDIFlags Flags, LLVMMetadataRef Ty);
600 
601 /**
602  * Create debugging information entry for a
603  * C++ static data member.
604  * \param Builder      The DIBuilder.
605  * \param Scope        Member scope.
606  * \param Name         Member name.
607  * \param NameLen      Length of member name.
608  * \param File         File where this member is declared.
609  * \param LineNumber   Line number.
610  * \param Type         Type of the static member.
611  * \param Flags        Flags to encode member attribute, e.g. private.
612  * \param ConstantVal  Const initializer of the member.
613  * \param AlignInBits  Member alignment.
614  */
615 LLVMMetadataRef
616 LLVMDIBuilderCreateStaticMemberType(
617     LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
618     size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,
619     LLVMMetadataRef Type, LLVMDIFlags Flags, LLVMValueRef ConstantVal,
620     uint32_t AlignInBits);
621 
622 /**
623  * Create debugging information entry for a pointer to member.
624  * \param Builder      The DIBuilder.
625  * \param PointeeType  Type pointed to by this pointer.
626  * \param ClassType    Type for which this pointer points to members of.
627  * \param SizeInBits   Size.
628  * \param AlignInBits  Alignment.
629  * \param Flags        Flags.
630  */
631 LLVMMetadataRef
632 LLVMDIBuilderCreateMemberPointerType(LLVMDIBuilderRef Builder,
633                                      LLVMMetadataRef PointeeType,
634                                      LLVMMetadataRef ClassType,
635                                      uint64_t SizeInBits,
636                                      uint32_t AlignInBits,
637                                      LLVMDIFlags Flags);
638 /**
639  * Create debugging information entry for Objective-C instance variable.
640  * \param Builder      The DIBuilder.
641  * \param Name         Member name.
642  * \param NameLen      The length of the C string passed to \c Name.
643  * \param File         File where this member is defined.
644  * \param LineNo       Line number.
645  * \param SizeInBits   Member size.
646  * \param AlignInBits  Member alignment.
647  * \param OffsetInBits Member offset.
648  * \param Flags        Flags to encode member attribute, e.g. private
649  * \param Ty           Parent type.
650  * \param PropertyNode Property associated with this ivar.
651  */
652 LLVMMetadataRef
653 LLVMDIBuilderCreateObjCIVar(LLVMDIBuilderRef Builder,
654                             const char *Name, size_t NameLen,
655                             LLVMMetadataRef File, unsigned LineNo,
656                             uint64_t SizeInBits, uint32_t AlignInBits,
657                             uint64_t OffsetInBits, LLVMDIFlags Flags,
658                             LLVMMetadataRef Ty, LLVMMetadataRef PropertyNode);
659 
660 /**
661  * Create debugging information entry for Objective-C property.
662  * \param Builder            The DIBuilder.
663  * \param Name               Property name.
664  * \param NameLen            The length of the C string passed to \c Name.
665  * \param File               File where this property is defined.
666  * \param LineNo             Line number.
667  * \param GetterName         Name of the Objective C property getter selector.
668  * \param GetterNameLen      The length of the C string passed to \c GetterName.
669  * \param SetterName         Name of the Objective C property setter selector.
670  * \param SetterNameLen      The length of the C string passed to \c SetterName.
671  * \param PropertyAttributes Objective C property attributes.
672  * \param Ty                 Type.
673  */
674 LLVMMetadataRef
675 LLVMDIBuilderCreateObjCProperty(LLVMDIBuilderRef Builder,
676                                 const char *Name, size_t NameLen,
677                                 LLVMMetadataRef File, unsigned LineNo,
678                                 const char *GetterName, size_t GetterNameLen,
679                                 const char *SetterName, size_t SetterNameLen,
680                                 unsigned PropertyAttributes,
681                                 LLVMMetadataRef Ty);
682 
683 /**
684  * Create a uniqued DIType* clone with FlagObjectPointer and FlagArtificial set.
685  * \param Builder   The DIBuilder.
686  * \param Type      The underlying type to which this pointer points.
687  */
688 LLVMMetadataRef
689 LLVMDIBuilderCreateObjectPointerType(LLVMDIBuilderRef Builder,
690                                      LLVMMetadataRef Type);
691 
692 /**
693  * Create debugging information entry for a qualified
694  * type, e.g. 'const int'.
695  * \param Builder     The DIBuilder.
696  * \param Tag         Tag identifying type,
697  *                    e.g. LLVMDWARFTypeQualifier_volatile_type
698  * \param Type        Base Type.
699  */
700 LLVMMetadataRef
701 LLVMDIBuilderCreateQualifiedType(LLVMDIBuilderRef Builder, unsigned Tag,
702                                  LLVMMetadataRef Type);
703 
704 /**
705  * Create debugging information entry for a c++
706  * style reference or rvalue reference type.
707  * \param Builder   The DIBuilder.
708  * \param Tag       Tag identifying type,
709  * \param Type      Base Type.
710  */
711 LLVMMetadataRef
712 LLVMDIBuilderCreateReferenceType(LLVMDIBuilderRef Builder, unsigned Tag,
713                                  LLVMMetadataRef Type);
714 
715 /**
716  * Create C++11 nullptr type.
717  * \param Builder   The DIBuilder.
718  */
719 LLVMMetadataRef
720 LLVMDIBuilderCreateNullPtrType(LLVMDIBuilderRef Builder);
721 
722 /**
723  * Create debugging information entry for a typedef.
724  * \param Builder    The DIBuilder.
725  * \param Type       Original type.
726  * \param Name       Typedef name.
727  * \param File       File where this type is defined.
728  * \param LineNo     Line number.
729  * \param Scope      The surrounding context for the typedef.
730  */
731 LLVMMetadataRef
732 LLVMDIBuilderCreateTypedef(LLVMDIBuilderRef Builder, LLVMMetadataRef Type,
733                            const char *Name, size_t NameLen,
734                            LLVMMetadataRef File, unsigned LineNo,
735                            LLVMMetadataRef Scope);
736 
737 /**
738  * Create debugging information entry to establish inheritance relationship
739  * between two types.
740  * \param Builder       The DIBuilder.
741  * \param Ty            Original type.
742  * \param BaseTy        Base type. Ty is inherits from base.
743  * \param BaseOffset    Base offset.
744  * \param VBPtrOffset  Virtual base pointer offset.
745  * \param Flags         Flags to describe inheritance attribute, e.g. private
746  */
747 LLVMMetadataRef
748 LLVMDIBuilderCreateInheritance(LLVMDIBuilderRef Builder,
749                                LLVMMetadataRef Ty, LLVMMetadataRef BaseTy,
750                                uint64_t BaseOffset, uint32_t VBPtrOffset,
751                                LLVMDIFlags Flags);
752 
753 /**
754  * Create a permanent forward-declared type.
755  * \param Builder             The DIBuilder.
756  * \param Tag                 A unique tag for this type.
757  * \param Name                Type name.
758  * \param NameLen             Length of type name.
759  * \param Scope               Type scope.
760  * \param File                File where this type is defined.
761  * \param Line                Line number where this type is defined.
762  * \param RuntimeLang         Indicates runtime version for languages like
763  *                            Objective-C.
764  * \param SizeInBits          Member size.
765  * \param AlignInBits         Member alignment.
766  * \param UniqueIdentifier    A unique identifier for the type.
767  * \param UniqueIdentifierLen Length of the unique identifier.
768  */
769 LLVMMetadataRef LLVMDIBuilderCreateForwardDecl(
770     LLVMDIBuilderRef Builder, unsigned Tag, const char *Name,
771     size_t NameLen, LLVMMetadataRef Scope, LLVMMetadataRef File, unsigned Line,
772     unsigned RuntimeLang, uint64_t SizeInBits, uint32_t AlignInBits,
773     const char *UniqueIdentifier, size_t UniqueIdentifierLen);
774 
775 /**
776  * Create a temporary forward-declared type.
777  * \param Builder             The DIBuilder.
778  * \param Tag                 A unique tag for this type.
779  * \param Name                Type name.
780  * \param NameLen             Length of type name.
781  * \param Scope               Type scope.
782  * \param File                File where this type is defined.
783  * \param Line                Line number where this type is defined.
784  * \param RuntimeLang         Indicates runtime version for languages like
785  *                            Objective-C.
786  * \param SizeInBits          Member size.
787  * \param AlignInBits         Member alignment.
788  * \param Flags               Flags.
789  * \param UniqueIdentifier    A unique identifier for the type.
790  * \param UniqueIdentifierLen Length of the unique identifier.
791  */
792 LLVMMetadataRef
793 LLVMDIBuilderCreateReplaceableCompositeType(
794     LLVMDIBuilderRef Builder, unsigned Tag, const char *Name,
795     size_t NameLen, LLVMMetadataRef Scope, LLVMMetadataRef File, unsigned Line,
796     unsigned RuntimeLang, uint64_t SizeInBits, uint32_t AlignInBits,
797     LLVMDIFlags Flags, const char *UniqueIdentifier,
798     size_t UniqueIdentifierLen);
799 
800 /**
801  * Create debugging information entry for a bit field member.
802  * \param Builder             The DIBuilder.
803  * \param Scope               Member scope.
804  * \param Name                Member name.
805  * \param NameLen             Length of member name.
806  * \param File                File where this member is defined.
807  * \param LineNumber          Line number.
808  * \param SizeInBits          Member size.
809  * \param OffsetInBits        Member offset.
810  * \param StorageOffsetInBits Member storage offset.
811  * \param Flags               Flags to encode member attribute.
812  * \param Type                Parent type.
813  */
814 LLVMMetadataRef
815 LLVMDIBuilderCreateBitFieldMemberType(LLVMDIBuilderRef Builder,
816                                       LLVMMetadataRef Scope,
817                                       const char *Name, size_t NameLen,
818                                       LLVMMetadataRef File, unsigned LineNumber,
819                                       uint64_t SizeInBits,
820                                       uint64_t OffsetInBits,
821                                       uint64_t StorageOffsetInBits,
822                                       LLVMDIFlags Flags, LLVMMetadataRef Type);
823 
824 /**
825  * Create debugging information entry for a class.
826  * \param Scope               Scope in which this class is defined.
827  * \param Name                Class name.
828  * \param NameLen             The length of the C string passed to \c Name.
829  * \param File                File where this member is defined.
830  * \param LineNumber          Line number.
831  * \param SizeInBits          Member size.
832  * \param AlignInBits         Member alignment.
833  * \param OffsetInBits        Member offset.
834  * \param Flags               Flags to encode member attribute, e.g. private.
835  * \param DerivedFrom         Debug info of the base class of this type.
836  * \param Elements            Class members.
837  * \param NumElements         Number of class elements.
838  * \param VTableHolder        Debug info of the base class that contains vtable
839  *                            for this type. This is used in
840  *                            DW_AT_containing_type. See DWARF documentation
841  *                            for more info.
842  * \param TemplateParamsNode  Template type parameters.
843  * \param UniqueIdentifier    A unique identifier for the type.
844  * \param UniqueIdentifierLen Length of the unique identifier.
845  */
846 LLVMMetadataRef LLVMDIBuilderCreateClassType(LLVMDIBuilderRef Builder,
847     LLVMMetadataRef Scope, const char *Name, size_t NameLen,
848     LLVMMetadataRef File, unsigned LineNumber, uint64_t SizeInBits,
849     uint32_t AlignInBits, uint64_t OffsetInBits, LLVMDIFlags Flags,
850     LLVMMetadataRef DerivedFrom,
851     LLVMMetadataRef *Elements, unsigned NumElements,
852     LLVMMetadataRef VTableHolder, LLVMMetadataRef TemplateParamsNode,
853     const char *UniqueIdentifier, size_t UniqueIdentifierLen);
854 
855 /**
856  * Create a uniqued DIType* clone with FlagArtificial set.
857  * \param Builder     The DIBuilder.
858  * \param Type        The underlying type.
859  */
860 LLVMMetadataRef
861 LLVMDIBuilderCreateArtificialType(LLVMDIBuilderRef Builder,
862                                   LLVMMetadataRef Type);
863 
864 /**
865  * Get the name of this DIType.
866  * \param DType     The DIType.
867  * \param Length    The length of the returned string.
868  *
869  * @see DIType::getName()
870  */
871 const char *LLVMDITypeGetName(LLVMMetadataRef DType, size_t *Length);
872 
873 /**
874  * Get the size of this DIType in bits.
875  * \param DType     The DIType.
876  *
877  * @see DIType::getSizeInBits()
878  */
879 uint64_t LLVMDITypeGetSizeInBits(LLVMMetadataRef DType);
880 
881 /**
882  * Get the offset of this DIType in bits.
883  * \param DType     The DIType.
884  *
885  * @see DIType::getOffsetInBits()
886  */
887 uint64_t LLVMDITypeGetOffsetInBits(LLVMMetadataRef DType);
888 
889 /**
890  * Get the alignment of this DIType in bits.
891  * \param DType     The DIType.
892  *
893  * @see DIType::getAlignInBits()
894  */
895 uint32_t LLVMDITypeGetAlignInBits(LLVMMetadataRef DType);
896 
897 /**
898  * Get the source line where this DIType is declared.
899  * \param DType     The DIType.
900  *
901  * @see DIType::getLine()
902  */
903 unsigned LLVMDITypeGetLine(LLVMMetadataRef DType);
904 
905 /**
906  * Get the flags associated with this DIType.
907  * \param DType     The DIType.
908  *
909  * @see DIType::getFlags()
910  */
911 LLVMDIFlags LLVMDITypeGetFlags(LLVMMetadataRef DType);
912 
913 /**
914  * Create a descriptor for a value range.
915  * \param Builder    The DIBuilder.
916  * \param LowerBound Lower bound of the subrange, e.g. 0 for C, 1 for Fortran.
917  * \param Count      Count of elements in the subrange.
918  */
919 LLVMMetadataRef LLVMDIBuilderGetOrCreateSubrange(LLVMDIBuilderRef Builder,
920                                                  int64_t LowerBound,
921                                                  int64_t Count);
922 
923 /**
924  * Create an array of DI Nodes.
925  * \param Builder        The DIBuilder.
926  * \param Data           The DI Node elements.
927  * \param NumElements    Number of DI Node elements.
928  */
929 LLVMMetadataRef LLVMDIBuilderGetOrCreateArray(LLVMDIBuilderRef Builder,
930                                               LLVMMetadataRef *Data,
931                                               size_t NumElements);
932 
933 /**
934  * Create a new descriptor for the specified variable which has a complex
935  * address expression for its address.
936  * \param Builder     The DIBuilder.
937  * \param Addr        An array of complex address operations.
938  * \param Length      Length of the address operation array.
939  */
940 LLVMMetadataRef LLVMDIBuilderCreateExpression(LLVMDIBuilderRef Builder,
941                                               int64_t *Addr, size_t Length);
942 
943 /**
944  * Create a new descriptor for the specified variable that does not have an
945  * address, but does have a constant value.
946  * \param Builder     The DIBuilder.
947  * \param Value       The constant value.
948  */
949 LLVMMetadataRef
950 LLVMDIBuilderCreateConstantValueExpression(LLVMDIBuilderRef Builder,
951                                            int64_t Value);
952 
953 /**
954  * Create a new descriptor for the specified variable.
955  * \param Scope       Variable scope.
956  * \param Name        Name of the variable.
957  * \param NameLen     The length of the C string passed to \c Name.
958  * \param Linkage     Mangled  name of the variable.
959  * \param LinkLen     The length of the C string passed to \c Linkage.
960  * \param File        File where this variable is defined.
961  * \param LineNo      Line number.
962  * \param Ty          Variable Type.
963  * \param LocalToUnit Boolean flag indicate whether this variable is
964  *                    externally visible or not.
965  * \param Expr        The location of the global relative to the attached
966  *                    GlobalVariable.
967  * \param Decl        Reference to the corresponding declaration.
968  * \param AlignInBits Variable alignment(or 0 if no alignment attr was
969  *                    specified)
970  */
971 LLVMMetadataRef
972 LLVMDIBuilderCreateGlobalVariableExpression(LLVMDIBuilderRef Builder,
973                                             LLVMMetadataRef Scope,
974                                             const char *Name, size_t NameLen,
975                                             const char *Linkage, size_t LinkLen,
976                                             LLVMMetadataRef File,
977                                             unsigned LineNo,
978                                             LLVMMetadataRef Ty,
979                                             LLVMBool LocalToUnit,
980                                             LLVMMetadataRef Expr,
981                                             LLVMMetadataRef Decl,
982                                             uint32_t AlignInBits);
983 /**
984  * Create a new temporary \c MDNode.  Suitable for use in constructing cyclic
985  * \c MDNode structures. A temporary \c MDNode is not uniqued, may be RAUW'd,
986  * and must be manually deleted with \c LLVMDisposeTemporaryMDNode.
987  * \param Ctx            The context in which to construct the temporary node.
988  * \param Data           The metadata elements.
989  * \param NumElements    Number of metadata elements.
990  */
991 LLVMMetadataRef LLVMTemporaryMDNode(LLVMContextRef Ctx, LLVMMetadataRef *Data,
992                                     size_t NumElements);
993 
994 /**
995  * Deallocate a temporary node.
996  *
997  * Calls \c replaceAllUsesWith(nullptr) before deleting, so any remaining
998  * references will be reset.
999  * \param TempNode    The temporary metadata node.
1000  */
1001 void LLVMDisposeTemporaryMDNode(LLVMMetadataRef TempNode);
1002 
1003 /**
1004  * Replace all uses of temporary metadata.
1005  * \param TempTargetMetadata    The temporary metadata node.
1006  * \param Replacement           The replacement metadata node.
1007  */
1008 void LLVMMetadataReplaceAllUsesWith(LLVMMetadataRef TempTargetMetadata,
1009                                     LLVMMetadataRef Replacement);
1010 
1011 /**
1012  * Create a new descriptor for the specified global variable that is temporary
1013  * and meant to be RAUWed.
1014  * \param Scope       Variable scope.
1015  * \param Name        Name of the variable.
1016  * \param NameLen     The length of the C string passed to \c Name.
1017  * \param Linkage     Mangled  name of the variable.
1018  * \param LnkLen      The length of the C string passed to \c Linkage.
1019  * \param File        File where this variable is defined.
1020  * \param LineNo      Line number.
1021  * \param Ty          Variable Type.
1022  * \param LocalToUnit Boolean flag indicate whether this variable is
1023  *                    externally visible or not.
1024  * \param Decl        Reference to the corresponding declaration.
1025  * \param AlignInBits Variable alignment(or 0 if no alignment attr was
1026  *                    specified)
1027  */
1028 LLVMMetadataRef
1029 LLVMDIBuilderCreateTempGlobalVariableFwdDecl(LLVMDIBuilderRef Builder,
1030                                              LLVMMetadataRef Scope,
1031                                              const char *Name, size_t NameLen,
1032                                              const char *Linkage, size_t LnkLen,
1033                                              LLVMMetadataRef File,
1034                                              unsigned LineNo,
1035                                              LLVMMetadataRef Ty,
1036                                              LLVMBool LocalToUnit,
1037                                              LLVMMetadataRef Decl,
1038                                              uint32_t AlignInBits);
1039 
1040 /**
1041  * Insert a new llvm.dbg.declare intrinsic call before the given instruction.
1042  * \param Builder     The DIBuilder.
1043  * \param Storage     The storage of the variable to declare.
1044  * \param VarInfo     The variable's debug info descriptor.
1045  * \param Expr        A complex location expression for the variable.
1046  * \param DebugLoc    Debug info location.
1047  * \param Instr       Instruction acting as a location for the new intrinsic.
1048  */
1049 LLVMValueRef LLVMDIBuilderInsertDeclareBefore(
1050   LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
1051   LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr);
1052 
1053 /**
1054  * Insert a new llvm.dbg.declare intrinsic call at the end of the given basic
1055  * block. If the basic block has a terminator instruction, the intrinsic is
1056  * inserted before that terminator instruction.
1057  * \param Builder     The DIBuilder.
1058  * \param Storage     The storage of the variable to declare.
1059  * \param VarInfo     The variable's debug info descriptor.
1060  * \param Expr        A complex location expression for the variable.
1061  * \param DebugLoc    Debug info location.
1062  * \param Block       Basic block acting as a location for the new intrinsic.
1063  */
1064 LLVMValueRef LLVMDIBuilderInsertDeclareAtEnd(
1065     LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
1066     LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block);
1067 
1068 /**
1069  * Insert a new llvm.dbg.value intrinsic call before the given instruction.
1070  * \param Builder     The DIBuilder.
1071  * \param Val         The value of the variable.
1072  * \param VarInfo     The variable's debug info descriptor.
1073  * \param Expr        A complex location expression for the variable.
1074  * \param DebugLoc    Debug info location.
1075  * \param Instr       Instruction acting as a location for the new intrinsic.
1076  */
1077 LLVMValueRef LLVMDIBuilderInsertDbgValueBefore(LLVMDIBuilderRef Builder,
1078                                                LLVMValueRef Val,
1079                                                LLVMMetadataRef VarInfo,
1080                                                LLVMMetadataRef Expr,
1081                                                LLVMMetadataRef DebugLoc,
1082                                                LLVMValueRef Instr);
1083 
1084 /**
1085  * Insert a new llvm.dbg.value intrinsic call at the end of the given basic
1086  * block. If the basic block has a terminator instruction, the intrinsic is
1087  * inserted before that terminator instruction.
1088  * \param Builder     The DIBuilder.
1089  * \param Val         The value of the variable.
1090  * \param VarInfo     The variable's debug info descriptor.
1091  * \param Expr        A complex location expression for the variable.
1092  * \param DebugLoc    Debug info location.
1093  * \param Block       Basic block acting as a location for the new intrinsic.
1094  */
1095 LLVMValueRef LLVMDIBuilderInsertDbgValueAtEnd(LLVMDIBuilderRef Builder,
1096                                               LLVMValueRef Val,
1097                                               LLVMMetadataRef VarInfo,
1098                                               LLVMMetadataRef Expr,
1099                                               LLVMMetadataRef DebugLoc,
1100                                               LLVMBasicBlockRef Block);
1101 
1102 /**
1103  * Create a new descriptor for a local auto variable.
1104  * \param Builder         The DIBuilder.
1105  * \param Scope           The local scope the variable is declared in.
1106  * \param Name            Variable name.
1107  * \param NameLen         Length of variable name.
1108  * \param File            File where this variable is defined.
1109  * \param LineNo          Line number.
1110  * \param Ty              Metadata describing the type of the variable.
1111  * \param AlwaysPreserve  If true, this descriptor will survive optimizations.
1112  * \param Flags           Flags.
1113  * \param AlignInBits     Variable alignment.
1114  */
1115 LLVMMetadataRef LLVMDIBuilderCreateAutoVariable(
1116     LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
1117     size_t NameLen, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty,
1118     LLVMBool AlwaysPreserve, LLVMDIFlags Flags, uint32_t AlignInBits);
1119 
1120 /**
1121  * Create a new descriptor for a function parameter variable.
1122  * \param Builder         The DIBuilder.
1123  * \param Scope           The local scope the variable is declared in.
1124  * \param Name            Variable name.
1125  * \param NameLen         Length of variable name.
1126  * \param ArgNo           Unique argument number for this variable; starts at 1.
1127  * \param File            File where this variable is defined.
1128  * \param LineNo          Line number.
1129  * \param Ty              Metadata describing the type of the variable.
1130  * \param AlwaysPreserve  If true, this descriptor will survive optimizations.
1131  * \param Flags           Flags.
1132  */
1133 LLVMMetadataRef LLVMDIBuilderCreateParameterVariable(
1134     LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
1135     size_t NameLen, unsigned ArgNo, LLVMMetadataRef File, unsigned LineNo,
1136     LLVMMetadataRef Ty, LLVMBool AlwaysPreserve, LLVMDIFlags Flags);
1137 
1138 /**
1139  * Get the metadata of the subprogram attached to a function.
1140  *
1141  * @see llvm::Function::getSubprogram()
1142  */
1143 LLVMMetadataRef LLVMGetSubprogram(LLVMValueRef Func);
1144 
1145 /**
1146  * Set the subprogram attached to a function.
1147  *
1148  * @see llvm::Function::setSubprogram()
1149  */
1150 void LLVMSetSubprogram(LLVMValueRef Func, LLVMMetadataRef SP);
1151 
1152 #ifdef __cplusplus
1153 } /* end extern "C" */
1154 #endif
1155 
1156 #endif
1157