1 //===------------ DebugInfo.h - LLVM C API Debug Info API -----------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 /// This file declares the C API endpoints for generating DWARF Debug Info
11 /// Note: This interface is experimental. It is *NOT* stable, and may be
12 /// changed without warning.
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_C_DEBUGINFO_H
17 #define LLVM_C_DEBUGINFO_H
19 #include "llvm-c/Core.h"
20 #include "llvm-c/ExternC.h"
29 LLVMDIFlagPrivate
= 1,
30 LLVMDIFlagProtected
= 2,
32 LLVMDIFlagFwdDecl
= 1 << 2,
33 LLVMDIFlagAppleBlock
= 1 << 3,
34 LLVMDIFlagReservedBit4
= 1 << 4,
35 LLVMDIFlagVirtual
= 1 << 5,
36 LLVMDIFlagArtificial
= 1 << 6,
37 LLVMDIFlagExplicit
= 1 << 7,
38 LLVMDIFlagPrototyped
= 1 << 8,
39 LLVMDIFlagObjcClassComplete
= 1 << 9,
40 LLVMDIFlagObjectPointer
= 1 << 10,
41 LLVMDIFlagVector
= 1 << 11,
42 LLVMDIFlagStaticMember
= 1 << 12,
43 LLVMDIFlagLValueReference
= 1 << 13,
44 LLVMDIFlagRValueReference
= 1 << 14,
45 LLVMDIFlagReserved
= 1 << 15,
46 LLVMDIFlagSingleInheritance
= 1 << 16,
47 LLVMDIFlagMultipleInheritance
= 2 << 16,
48 LLVMDIFlagVirtualInheritance
= 3 << 16,
49 LLVMDIFlagIntroducedVirtual
= 1 << 18,
50 LLVMDIFlagBitField
= 1 << 19,
51 LLVMDIFlagNoReturn
= 1 << 20,
52 LLVMDIFlagTypePassByValue
= 1 << 22,
53 LLVMDIFlagTypePassByReference
= 1 << 23,
54 LLVMDIFlagEnumClass
= 1 << 24,
55 LLVMDIFlagFixedEnum
= LLVMDIFlagEnumClass
, // Deprecated.
56 LLVMDIFlagThunk
= 1 << 25,
57 LLVMDIFlagNonTrivial
= 1 << 26,
58 LLVMDIFlagBigEndian
= 1 << 27,
59 LLVMDIFlagLittleEndian
= 1 << 28,
60 LLVMDIFlagIndirectVirtualBase
= (1 << 2) | (1 << 5),
61 LLVMDIFlagAccessibility
= LLVMDIFlagPrivate
| LLVMDIFlagProtected
|
63 LLVMDIFlagPtrToMemberRep
= LLVMDIFlagSingleInheritance
|
64 LLVMDIFlagMultipleInheritance
|
65 LLVMDIFlagVirtualInheritance
69 * Source languages known by DWARF.
72 LLVMDWARFSourceLanguageC89
,
73 LLVMDWARFSourceLanguageC
,
74 LLVMDWARFSourceLanguageAda83
,
75 LLVMDWARFSourceLanguageC_plus_plus
,
76 LLVMDWARFSourceLanguageCobol74
,
77 LLVMDWARFSourceLanguageCobol85
,
78 LLVMDWARFSourceLanguageFortran77
,
79 LLVMDWARFSourceLanguageFortran90
,
80 LLVMDWARFSourceLanguagePascal83
,
81 LLVMDWARFSourceLanguageModula2
,
83 LLVMDWARFSourceLanguageJava
,
84 LLVMDWARFSourceLanguageC99
,
85 LLVMDWARFSourceLanguageAda95
,
86 LLVMDWARFSourceLanguageFortran95
,
87 LLVMDWARFSourceLanguagePLI
,
88 LLVMDWARFSourceLanguageObjC
,
89 LLVMDWARFSourceLanguageObjC_plus_plus
,
90 LLVMDWARFSourceLanguageUPC
,
91 LLVMDWARFSourceLanguageD
,
93 LLVMDWARFSourceLanguagePython
,
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
;
119 * The amount of debug information to emit.
122 LLVMDWARFEmissionNone
= 0,
123 LLVMDWARFEmissionFull
,
124 LLVMDWARFEmissionLineTablesOnly
125 } LLVMDWARFEmissionKind
;
128 * The kind of metadata nodes.
131 LLVMMDStringMetadataKind
,
132 LLVMConstantAsMetadataMetadataKind
,
133 LLVMLocalAsMetadataMetadataKind
,
134 LLVMDistinctMDOperandPlaceholderMetadataKind
,
135 LLVMMDTupleMetadataKind
,
136 LLVMDILocationMetadataKind
,
137 LLVMDIExpressionMetadataKind
,
138 LLVMDIGlobalVariableExpressionMetadataKind
,
139 LLVMGenericDINodeMetadataKind
,
140 LLVMDISubrangeMetadataKind
,
141 LLVMDIEnumeratorMetadataKind
,
142 LLVMDIBasicTypeMetadataKind
,
143 LLVMDIDerivedTypeMetadataKind
,
144 LLVMDICompositeTypeMetadataKind
,
145 LLVMDISubroutineTypeMetadataKind
,
146 LLVMDIFileMetadataKind
,
147 LLVMDICompileUnitMetadataKind
,
148 LLVMDISubprogramMetadataKind
,
149 LLVMDILexicalBlockMetadataKind
,
150 LLVMDILexicalBlockFileMetadataKind
,
151 LLVMDINamespaceMetadataKind
,
152 LLVMDIModuleMetadataKind
,
153 LLVMDITemplateTypeParameterMetadataKind
,
154 LLVMDITemplateValueParameterMetadataKind
,
155 LLVMDIGlobalVariableMetadataKind
,
156 LLVMDILocalVariableMetadataKind
,
157 LLVMDILabelMetadataKind
,
158 LLVMDIObjCPropertyMetadataKind
,
159 LLVMDIImportedEntityMetadataKind
,
160 LLVMDIMacroMetadataKind
,
161 LLVMDIMacroFileMetadataKind
,
162 LLVMDICommonBlockMetadataKind
,
163 LLVMDIStringTypeMetadataKind
,
164 LLVMDIGenericSubrangeMetadataKind
,
165 LLVMDIArgListMetadataKind
167 typedef unsigned LLVMMetadataKind
;
170 * An LLVM DWARF type encoding.
172 typedef unsigned LLVMDWARFTypeEncoding
;
175 * Describes the kind of macro declaration used for LLVMDIBuilderCreateMacro.
176 * @see llvm::dwarf::MacinfoRecordType
177 * @note Values are from DW_MACINFO_* constants in the DWARF specification.
180 LLVMDWARFMacinfoRecordTypeDefine
= 0x01,
181 LLVMDWARFMacinfoRecordTypeMacro
= 0x02,
182 LLVMDWARFMacinfoRecordTypeStartFile
= 0x03,
183 LLVMDWARFMacinfoRecordTypeEndFile
= 0x04,
184 LLVMDWARFMacinfoRecordTypeVendorExt
= 0xff
185 } LLVMDWARFMacinfoRecordType
;
188 * The current debug metadata version number.
190 unsigned LLVMDebugMetadataVersion(void);
193 * The version of debug metadata that's present in the provided \c Module.
195 unsigned LLVMGetModuleDebugMetadataVersion(LLVMModuleRef Module
);
198 * Strip debug info in the module if it exists.
199 * To do this, we remove all calls to the debugger intrinsics and any named
200 * metadata for debugging. We also remove debug locations for instructions.
201 * Return true if module is modified.
203 LLVMBool
LLVMStripModuleDebugInfo(LLVMModuleRef Module
);
206 * Construct a builder for a module, and do not allow for unresolved nodes
207 * attached to the module.
209 LLVMDIBuilderRef
LLVMCreateDIBuilderDisallowUnresolved(LLVMModuleRef M
);
212 * Construct a builder for a module and collect unresolved nodes attached
213 * to the module in order to resolve cycles during a call to
214 * \c LLVMDIBuilderFinalize.
216 LLVMDIBuilderRef
LLVMCreateDIBuilder(LLVMModuleRef M
);
219 * Deallocates the \c DIBuilder and everything it owns.
220 * @note You must call \c LLVMDIBuilderFinalize before this
222 void LLVMDisposeDIBuilder(LLVMDIBuilderRef Builder
);
225 * Construct any deferred debug info descriptors.
227 void LLVMDIBuilderFinalize(LLVMDIBuilderRef Builder
);
230 * A CompileUnit provides an anchor for all debugging
231 * information generated during this instance of compilation.
232 * \param Lang Source programming language, eg.
233 * \c LLVMDWARFSourceLanguageC99
234 * \param FileRef File info.
235 * \param Producer Identify the producer of debugging information
236 * and code. Usually this is a compiler
238 * \param ProducerLen The length of the C string passed to \c Producer.
239 * \param isOptimized A boolean flag which indicates whether optimization
241 * \param Flags This string lists command line options. This
242 * string is directly embedded in debug info
243 * output which may be used by a tool
244 * analyzing generated debugging information.
245 * \param FlagsLen The length of the C string passed to \c Flags.
246 * \param RuntimeVer This indicates runtime version for languages like
248 * \param SplitName The name of the file that we'll split debug info
250 * \param SplitNameLen The length of the C string passed to \c SplitName.
251 * \param Kind The kind of debug information to generate.
252 * \param DWOId The DWOId if this is a split skeleton compile unit.
253 * \param SplitDebugInlining Whether to emit inline debug info.
254 * \param DebugInfoForProfiling Whether to emit extra debug info for
255 * profile collection.
256 * \param SysRoot The Clang system root (value of -isysroot).
257 * \param SysRootLen The length of the C string passed to \c SysRoot.
258 * \param SDK The SDK. On Darwin, the last component of the sysroot.
259 * \param SDKLen The length of the C string passed to \c SDK.
261 LLVMMetadataRef
LLVMDIBuilderCreateCompileUnit(
262 LLVMDIBuilderRef Builder
, LLVMDWARFSourceLanguage Lang
,
263 LLVMMetadataRef FileRef
, const char *Producer
, size_t ProducerLen
,
264 LLVMBool isOptimized
, const char *Flags
, size_t FlagsLen
,
265 unsigned RuntimeVer
, const char *SplitName
, size_t SplitNameLen
,
266 LLVMDWARFEmissionKind Kind
, unsigned DWOId
, LLVMBool SplitDebugInlining
,
267 LLVMBool DebugInfoForProfiling
, const char *SysRoot
, size_t SysRootLen
,
268 const char *SDK
, size_t SDKLen
);
271 * Create a file descriptor to hold debugging information for a file.
272 * \param Builder The \c DIBuilder.
273 * \param Filename File name.
274 * \param FilenameLen The length of the C string passed to \c Filename.
275 * \param Directory Directory.
276 * \param DirectoryLen The length of the C string passed to \c Directory.
279 LLVMDIBuilderCreateFile(LLVMDIBuilderRef Builder
, const char *Filename
,
280 size_t FilenameLen
, const char *Directory
,
281 size_t DirectoryLen
);
284 * Creates a new descriptor for a module with the specified parent scope.
285 * \param Builder The \c DIBuilder.
286 * \param ParentScope The parent scope containing this module declaration.
287 * \param Name Module name.
288 * \param NameLen The length of the C string passed to \c Name.
289 * \param ConfigMacros A space-separated shell-quoted list of -D macro
290 definitions as they would appear on a command line.
291 * \param ConfigMacrosLen The length of the C string passed to \c ConfigMacros.
292 * \param IncludePath The path to the module map file.
293 * \param IncludePathLen The length of the C string passed to \c IncludePath.
294 * \param APINotesFile The path to an API notes file for the module.
295 * \param APINotesFileLen The length of the C string passed to \c APINotestFile.
298 LLVMDIBuilderCreateModule(LLVMDIBuilderRef Builder
, LLVMMetadataRef ParentScope
,
299 const char *Name
, size_t NameLen
,
300 const char *ConfigMacros
, size_t ConfigMacrosLen
,
301 const char *IncludePath
, size_t IncludePathLen
,
302 const char *APINotesFile
, size_t APINotesFileLen
);
305 * Creates a new descriptor for a namespace with the specified parent scope.
306 * \param Builder The \c DIBuilder.
307 * \param ParentScope The parent scope containing this module declaration.
308 * \param Name NameSpace name.
309 * \param NameLen The length of the C string passed to \c Name.
310 * \param ExportSymbols Whether or not the namespace exports symbols, e.g.
311 * this is true of C++ inline namespaces.
314 LLVMDIBuilderCreateNameSpace(LLVMDIBuilderRef Builder
,
315 LLVMMetadataRef ParentScope
,
316 const char *Name
, size_t NameLen
,
317 LLVMBool ExportSymbols
);
320 * Create a new descriptor for the specified subprogram.
321 * \param Builder The \c DIBuilder.
322 * \param Scope Function scope.
323 * \param Name Function name.
324 * \param NameLen Length of enumeration name.
325 * \param LinkageName Mangled function name.
326 * \param LinkageNameLen Length of linkage name.
327 * \param File File where this variable is defined.
328 * \param LineNo Line number.
329 * \param Ty Function type.
330 * \param IsLocalToUnit True if this function is not externally visible.
331 * \param IsDefinition True if this is a function definition.
332 * \param ScopeLine Set to the beginning of the scope this starts
333 * \param Flags E.g.: \c LLVMDIFlagLValueReference. These flags are
334 * used to emit dwarf attributes.
335 * \param IsOptimized True if optimization is ON.
337 LLVMMetadataRef
LLVMDIBuilderCreateFunction(
338 LLVMDIBuilderRef Builder
, LLVMMetadataRef Scope
, const char *Name
,
339 size_t NameLen
, const char *LinkageName
, size_t LinkageNameLen
,
340 LLVMMetadataRef File
, unsigned LineNo
, LLVMMetadataRef Ty
,
341 LLVMBool IsLocalToUnit
, LLVMBool IsDefinition
,
342 unsigned ScopeLine
, LLVMDIFlags Flags
, LLVMBool IsOptimized
);
345 * Create a descriptor for a lexical block with the specified parent context.
346 * \param Builder The \c DIBuilder.
347 * \param Scope Parent lexical block.
348 * \param File Source file.
349 * \param Line The line in the source file.
350 * \param Column The column in the source file.
352 LLVMMetadataRef
LLVMDIBuilderCreateLexicalBlock(
353 LLVMDIBuilderRef Builder
, LLVMMetadataRef Scope
,
354 LLVMMetadataRef File
, unsigned Line
, unsigned Column
);
357 * Create a descriptor for a lexical block with a new file attached.
358 * \param Builder The \c DIBuilder.
359 * \param Scope Lexical block.
360 * \param File Source file.
361 * \param Discriminator DWARF path discriminator value.
364 LLVMDIBuilderCreateLexicalBlockFile(LLVMDIBuilderRef Builder
,
365 LLVMMetadataRef Scope
,
366 LLVMMetadataRef File
,
367 unsigned Discriminator
);
370 * Create a descriptor for an imported namespace. Suitable for e.g. C++
371 * using declarations.
372 * \param Builder The \c DIBuilder.
373 * \param Scope The scope this module is imported into
374 * \param File File where the declaration is located.
375 * \param Line Line number of the declaration.
378 LLVMDIBuilderCreateImportedModuleFromNamespace(LLVMDIBuilderRef Builder
,
379 LLVMMetadataRef Scope
,
381 LLVMMetadataRef File
,
385 * Create a descriptor for an imported module that aliases another
386 * imported entity descriptor.
387 * \param Builder The \c DIBuilder.
388 * \param Scope The scope this module is imported into
389 * \param ImportedEntity Previous imported entity to alias.
390 * \param File File where the declaration is located.
391 * \param Line Line number of the declaration.
394 LLVMDIBuilderCreateImportedModuleFromAlias(LLVMDIBuilderRef Builder
,
395 LLVMMetadataRef Scope
,
396 LLVMMetadataRef ImportedEntity
,
397 LLVMMetadataRef File
,
401 * Create a descriptor for an imported module.
402 * \param Builder The \c DIBuilder.
403 * \param Scope The scope this module is imported into
404 * \param M The module being imported here
405 * \param File File where the declaration is located.
406 * \param Line Line number of the declaration.
409 LLVMDIBuilderCreateImportedModuleFromModule(LLVMDIBuilderRef Builder
,
410 LLVMMetadataRef Scope
,
412 LLVMMetadataRef File
,
416 * Create a descriptor for an imported function, type, or variable. Suitable
417 * for e.g. FORTRAN-style USE declarations.
418 * \param Builder The DIBuilder.
419 * \param Scope The scope this module is imported into.
420 * \param Decl The declaration (or definition) of a function, type,
422 * \param File File where the declaration is located.
423 * \param Line Line number of the declaration.
424 * \param Name A name that uniquely identifies this imported declaration.
425 * \param NameLen The length of the C string passed to \c Name.
428 LLVMDIBuilderCreateImportedDeclaration(LLVMDIBuilderRef Builder
,
429 LLVMMetadataRef Scope
,
430 LLVMMetadataRef Decl
,
431 LLVMMetadataRef File
,
433 const char *Name
, size_t NameLen
);
436 * Creates a new DebugLocation that describes a source location.
437 * \param Line The line in the source file.
438 * \param Column The column in the source file.
439 * \param Scope The scope in which the location resides.
440 * \param InlinedAt The scope where this location was inlined, if at all.
442 * \note If the item to which this location is attached cannot be
443 * attributed to a source line, pass 0 for the line and column.
446 LLVMDIBuilderCreateDebugLocation(LLVMContextRef Ctx
, unsigned Line
,
447 unsigned Column
, LLVMMetadataRef Scope
,
448 LLVMMetadataRef InlinedAt
);
451 * Get the line number of this debug location.
452 * \param Location The debug location.
454 * @see DILocation::getLine()
456 unsigned LLVMDILocationGetLine(LLVMMetadataRef Location
);
459 * Get the column number of this debug location.
460 * \param Location The debug location.
462 * @see DILocation::getColumn()
464 unsigned LLVMDILocationGetColumn(LLVMMetadataRef Location
);
467 * Get the local scope associated with this debug location.
468 * \param Location The debug location.
470 * @see DILocation::getScope()
472 LLVMMetadataRef
LLVMDILocationGetScope(LLVMMetadataRef Location
);
475 * Get the "inline at" location associated with this debug location.
476 * \param Location The debug location.
478 * @see DILocation::getInlinedAt()
480 LLVMMetadataRef
LLVMDILocationGetInlinedAt(LLVMMetadataRef Location
);
483 * Get the metadata of the file associated with a given scope.
484 * \param Scope The scope object.
486 * @see DIScope::getFile()
488 LLVMMetadataRef
LLVMDIScopeGetFile(LLVMMetadataRef Scope
);
491 * Get the directory of a given file.
492 * \param File The file object.
493 * \param Len The length of the returned string.
495 * @see DIFile::getDirectory()
497 const char *LLVMDIFileGetDirectory(LLVMMetadataRef File
, unsigned *Len
);
500 * Get the name of a given file.
501 * \param File The file object.
502 * \param Len The length of the returned string.
504 * @see DIFile::getFilename()
506 const char *LLVMDIFileGetFilename(LLVMMetadataRef File
, unsigned *Len
);
509 * Get the source of a given file.
510 * \param File The file object.
511 * \param Len The length of the returned string.
513 * @see DIFile::getSource()
515 const char *LLVMDIFileGetSource(LLVMMetadataRef File
, unsigned *Len
);
518 * Create a type array.
519 * \param Builder The DIBuilder.
520 * \param Data The type elements.
521 * \param NumElements Number of type elements.
523 LLVMMetadataRef
LLVMDIBuilderGetOrCreateTypeArray(LLVMDIBuilderRef Builder
,
524 LLVMMetadataRef
*Data
,
528 * Create subroutine type.
529 * \param Builder The DIBuilder.
530 * \param File The file in which the subroutine resides.
531 * \param ParameterTypes An array of subroutine parameter types. This
532 * includes return type at 0th index.
533 * \param NumParameterTypes The number of parameter types in \c ParameterTypes
534 * \param Flags E.g.: \c LLVMDIFlagLValueReference.
535 * These flags are used to emit dwarf attributes.
538 LLVMDIBuilderCreateSubroutineType(LLVMDIBuilderRef Builder
,
539 LLVMMetadataRef File
,
540 LLVMMetadataRef
*ParameterTypes
,
541 unsigned NumParameterTypes
,
545 * Create debugging information entry for a macro.
546 * @param Builder The DIBuilder.
547 * @param ParentMacroFile Macro parent (could be NULL).
548 * @param Line Source line number where the macro is defined.
549 * @param RecordType DW_MACINFO_define or DW_MACINFO_undef.
550 * @param Name Macro name.
551 * @param NameLen Macro name length.
552 * @param Value Macro value.
553 * @param ValueLen Macro value length.
555 LLVMMetadataRef
LLVMDIBuilderCreateMacro(LLVMDIBuilderRef Builder
,
556 LLVMMetadataRef ParentMacroFile
,
558 LLVMDWARFMacinfoRecordType RecordType
,
559 const char *Name
, size_t NameLen
,
560 const char *Value
, size_t ValueLen
);
563 * Create debugging information temporary entry for a macro file.
564 * List of macro node direct children will be calculated by DIBuilder,
565 * using the \p ParentMacroFile relationship.
566 * @param Builder The DIBuilder.
567 * @param ParentMacroFile Macro parent (could be NULL).
568 * @param Line Source line number where the macro file is included.
569 * @param File File descriptor containing the name of the macro file.
572 LLVMDIBuilderCreateTempMacroFile(LLVMDIBuilderRef Builder
,
573 LLVMMetadataRef ParentMacroFile
, unsigned Line
,
574 LLVMMetadataRef File
);
577 * Create debugging information entry for an enumerator.
578 * @param Builder The DIBuilder.
579 * @param Name Enumerator name.
580 * @param NameLen Length of enumerator name.
581 * @param Value Enumerator value.
582 * @param IsUnsigned True if the value is unsigned.
584 LLVMMetadataRef
LLVMDIBuilderCreateEnumerator(LLVMDIBuilderRef Builder
,
585 const char *Name
, size_t NameLen
,
587 LLVMBool IsUnsigned
);
590 * Create debugging information entry for an enumeration.
591 * \param Builder The DIBuilder.
592 * \param Scope Scope in which this enumeration is defined.
593 * \param Name Enumeration name.
594 * \param NameLen Length of enumeration name.
595 * \param File File where this member is defined.
596 * \param LineNumber Line number.
597 * \param SizeInBits Member size.
598 * \param AlignInBits Member alignment.
599 * \param Elements Enumeration elements.
600 * \param NumElements Number of enumeration elements.
601 * \param ClassTy Underlying type of a C++11/ObjC fixed enum.
603 LLVMMetadataRef
LLVMDIBuilderCreateEnumerationType(
604 LLVMDIBuilderRef Builder
, LLVMMetadataRef Scope
, const char *Name
,
605 size_t NameLen
, LLVMMetadataRef File
, unsigned LineNumber
,
606 uint64_t SizeInBits
, uint32_t AlignInBits
, LLVMMetadataRef
*Elements
,
607 unsigned NumElements
, LLVMMetadataRef ClassTy
);
610 * Create debugging information entry for a union.
611 * \param Builder The DIBuilder.
612 * \param Scope Scope in which this union is defined.
613 * \param Name Union name.
614 * \param NameLen Length of union name.
615 * \param File File where this member is defined.
616 * \param LineNumber Line number.
617 * \param SizeInBits Member size.
618 * \param AlignInBits Member alignment.
619 * \param Flags Flags to encode member attribute, e.g. private
620 * \param Elements Union elements.
621 * \param NumElements Number of union elements.
622 * \param RunTimeLang Optional parameter, Objective-C runtime version.
623 * \param UniqueId A unique identifier for the union.
624 * \param UniqueIdLen Length of unique identifier.
626 LLVMMetadataRef
LLVMDIBuilderCreateUnionType(
627 LLVMDIBuilderRef Builder
, LLVMMetadataRef Scope
, const char *Name
,
628 size_t NameLen
, LLVMMetadataRef File
, unsigned LineNumber
,
629 uint64_t SizeInBits
, uint32_t AlignInBits
, LLVMDIFlags Flags
,
630 LLVMMetadataRef
*Elements
, unsigned NumElements
, unsigned RunTimeLang
,
631 const char *UniqueId
, size_t UniqueIdLen
);
635 * Create debugging information entry for an array.
636 * \param Builder The DIBuilder.
637 * \param Size Array size.
638 * \param AlignInBits Alignment.
639 * \param Ty Element type.
640 * \param Subscripts Subscripts.
641 * \param NumSubscripts Number of subscripts.
644 LLVMDIBuilderCreateArrayType(LLVMDIBuilderRef Builder
, uint64_t Size
,
645 uint32_t AlignInBits
, LLVMMetadataRef Ty
,
646 LLVMMetadataRef
*Subscripts
,
647 unsigned NumSubscripts
);
650 * Create debugging information entry for a vector type.
651 * \param Builder The DIBuilder.
652 * \param Size Vector size.
653 * \param AlignInBits Alignment.
654 * \param Ty Element type.
655 * \param Subscripts Subscripts.
656 * \param NumSubscripts Number of subscripts.
659 LLVMDIBuilderCreateVectorType(LLVMDIBuilderRef Builder
, uint64_t Size
,
660 uint32_t AlignInBits
, LLVMMetadataRef Ty
,
661 LLVMMetadataRef
*Subscripts
,
662 unsigned NumSubscripts
);
665 * Create a DWARF unspecified type.
666 * \param Builder The DIBuilder.
667 * \param Name The unspecified type's name.
668 * \param NameLen Length of type name.
671 LLVMDIBuilderCreateUnspecifiedType(LLVMDIBuilderRef Builder
, const char *Name
,
675 * Create debugging information entry for a basic
677 * \param Builder The DIBuilder.
678 * \param Name Type name.
679 * \param NameLen Length of type name.
680 * \param SizeInBits Size of the type.
681 * \param Encoding DWARF encoding code, e.g. \c LLVMDWARFTypeEncoding_float.
682 * \param Flags Flags to encode optional attribute like endianity
685 LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef Builder
, const char *Name
,
686 size_t NameLen
, uint64_t SizeInBits
,
687 LLVMDWARFTypeEncoding Encoding
,
691 * Create debugging information entry for a pointer.
692 * \param Builder The DIBuilder.
693 * \param PointeeTy Type pointed by this pointer.
694 * \param SizeInBits Size.
695 * \param AlignInBits Alignment. (optional, pass 0 to ignore)
696 * \param AddressSpace DWARF address space. (optional, pass 0 to ignore)
697 * \param Name Pointer type name. (optional)
698 * \param NameLen Length of pointer type name. (optional)
700 LLVMMetadataRef
LLVMDIBuilderCreatePointerType(
701 LLVMDIBuilderRef Builder
, LLVMMetadataRef PointeeTy
,
702 uint64_t SizeInBits
, uint32_t AlignInBits
, unsigned AddressSpace
,
703 const char *Name
, size_t NameLen
);
706 * Create debugging information entry for a struct.
707 * \param Builder The DIBuilder.
708 * \param Scope Scope in which this struct is defined.
709 * \param Name Struct name.
710 * \param NameLen Struct name length.
711 * \param File File where this member is defined.
712 * \param LineNumber Line number.
713 * \param SizeInBits Member size.
714 * \param AlignInBits Member alignment.
715 * \param Flags Flags to encode member attribute, e.g. private
716 * \param Elements Struct elements.
717 * \param NumElements Number of struct elements.
718 * \param RunTimeLang Optional parameter, Objective-C runtime version.
719 * \param VTableHolder The object containing the vtable for the struct.
720 * \param UniqueId A unique identifier for the struct.
721 * \param UniqueIdLen Length of the unique identifier for the struct.
723 LLVMMetadataRef
LLVMDIBuilderCreateStructType(
724 LLVMDIBuilderRef Builder
, LLVMMetadataRef Scope
, const char *Name
,
725 size_t NameLen
, LLVMMetadataRef File
, unsigned LineNumber
,
726 uint64_t SizeInBits
, uint32_t AlignInBits
, LLVMDIFlags Flags
,
727 LLVMMetadataRef DerivedFrom
, LLVMMetadataRef
*Elements
,
728 unsigned NumElements
, unsigned RunTimeLang
, LLVMMetadataRef VTableHolder
,
729 const char *UniqueId
, size_t UniqueIdLen
);
732 * Create debugging information entry for a member.
733 * \param Builder The DIBuilder.
734 * \param Scope Member scope.
735 * \param Name Member name.
736 * \param NameLen Length of member name.
737 * \param File File where this member is defined.
738 * \param LineNo Line number.
739 * \param SizeInBits Member size.
740 * \param AlignInBits Member alignment.
741 * \param OffsetInBits Member offset.
742 * \param Flags Flags to encode member attribute, e.g. private
743 * \param Ty Parent type.
745 LLVMMetadataRef
LLVMDIBuilderCreateMemberType(
746 LLVMDIBuilderRef Builder
, LLVMMetadataRef Scope
, const char *Name
,
747 size_t NameLen
, LLVMMetadataRef File
, unsigned LineNo
,
748 uint64_t SizeInBits
, uint32_t AlignInBits
, uint64_t OffsetInBits
,
749 LLVMDIFlags Flags
, LLVMMetadataRef Ty
);
752 * Create debugging information entry for a
753 * C++ static data member.
754 * \param Builder The DIBuilder.
755 * \param Scope Member scope.
756 * \param Name Member name.
757 * \param NameLen Length of member name.
758 * \param File File where this member is declared.
759 * \param LineNumber Line number.
760 * \param Type Type of the static member.
761 * \param Flags Flags to encode member attribute, e.g. private.
762 * \param ConstantVal Const initializer of the member.
763 * \param AlignInBits Member alignment.
766 LLVMDIBuilderCreateStaticMemberType(
767 LLVMDIBuilderRef Builder
, LLVMMetadataRef Scope
, const char *Name
,
768 size_t NameLen
, LLVMMetadataRef File
, unsigned LineNumber
,
769 LLVMMetadataRef Type
, LLVMDIFlags Flags
, LLVMValueRef ConstantVal
,
770 uint32_t AlignInBits
);
773 * Create debugging information entry for a pointer to member.
774 * \param Builder The DIBuilder.
775 * \param PointeeType Type pointed to by this pointer.
776 * \param ClassType Type for which this pointer points to members of.
777 * \param SizeInBits Size.
778 * \param AlignInBits Alignment.
779 * \param Flags Flags.
782 LLVMDIBuilderCreateMemberPointerType(LLVMDIBuilderRef Builder
,
783 LLVMMetadataRef PointeeType
,
784 LLVMMetadataRef ClassType
,
786 uint32_t AlignInBits
,
789 * Create debugging information entry for Objective-C instance variable.
790 * \param Builder The DIBuilder.
791 * \param Name Member name.
792 * \param NameLen The length of the C string passed to \c Name.
793 * \param File File where this member is defined.
794 * \param LineNo Line number.
795 * \param SizeInBits Member size.
796 * \param AlignInBits Member alignment.
797 * \param OffsetInBits Member offset.
798 * \param Flags Flags to encode member attribute, e.g. private
799 * \param Ty Parent type.
800 * \param PropertyNode Property associated with this ivar.
803 LLVMDIBuilderCreateObjCIVar(LLVMDIBuilderRef Builder
,
804 const char *Name
, size_t NameLen
,
805 LLVMMetadataRef File
, unsigned LineNo
,
806 uint64_t SizeInBits
, uint32_t AlignInBits
,
807 uint64_t OffsetInBits
, LLVMDIFlags Flags
,
808 LLVMMetadataRef Ty
, LLVMMetadataRef PropertyNode
);
811 * Create debugging information entry for Objective-C property.
812 * \param Builder The DIBuilder.
813 * \param Name Property name.
814 * \param NameLen The length of the C string passed to \c Name.
815 * \param File File where this property is defined.
816 * \param LineNo Line number.
817 * \param GetterName Name of the Objective C property getter selector.
818 * \param GetterNameLen The length of the C string passed to \c GetterName.
819 * \param SetterName Name of the Objective C property setter selector.
820 * \param SetterNameLen The length of the C string passed to \c SetterName.
821 * \param PropertyAttributes Objective C property attributes.
825 LLVMDIBuilderCreateObjCProperty(LLVMDIBuilderRef Builder
,
826 const char *Name
, size_t NameLen
,
827 LLVMMetadataRef File
, unsigned LineNo
,
828 const char *GetterName
, size_t GetterNameLen
,
829 const char *SetterName
, size_t SetterNameLen
,
830 unsigned PropertyAttributes
,
834 * Create a uniqued DIType* clone with FlagObjectPointer and FlagArtificial set.
835 * \param Builder The DIBuilder.
836 * \param Type The underlying type to which this pointer points.
839 LLVMDIBuilderCreateObjectPointerType(LLVMDIBuilderRef Builder
,
840 LLVMMetadataRef Type
);
843 * Create debugging information entry for a qualified
844 * type, e.g. 'const int'.
845 * \param Builder The DIBuilder.
846 * \param Tag Tag identifying type,
847 * e.g. LLVMDWARFTypeQualifier_volatile_type
848 * \param Type Base Type.
851 LLVMDIBuilderCreateQualifiedType(LLVMDIBuilderRef Builder
, unsigned Tag
,
852 LLVMMetadataRef Type
);
855 * Create debugging information entry for a c++
856 * style reference or rvalue reference type.
857 * \param Builder The DIBuilder.
858 * \param Tag Tag identifying type,
859 * \param Type Base Type.
862 LLVMDIBuilderCreateReferenceType(LLVMDIBuilderRef Builder
, unsigned Tag
,
863 LLVMMetadataRef Type
);
866 * Create C++11 nullptr type.
867 * \param Builder The DIBuilder.
870 LLVMDIBuilderCreateNullPtrType(LLVMDIBuilderRef Builder
);
873 * Create debugging information entry for a typedef.
874 * \param Builder The DIBuilder.
875 * \param Type Original type.
876 * \param Name Typedef name.
877 * \param File File where this type is defined.
878 * \param LineNo Line number.
879 * \param Scope The surrounding context for the typedef.
882 LLVMDIBuilderCreateTypedef(LLVMDIBuilderRef Builder
, LLVMMetadataRef Type
,
883 const char *Name
, size_t NameLen
,
884 LLVMMetadataRef File
, unsigned LineNo
,
885 LLVMMetadataRef Scope
, uint32_t AlignInBits
);
888 * Create debugging information entry to establish inheritance relationship
890 * \param Builder The DIBuilder.
891 * \param Ty Original type.
892 * \param BaseTy Base type. Ty is inherits from base.
893 * \param BaseOffset Base offset.
894 * \param VBPtrOffset Virtual base pointer offset.
895 * \param Flags Flags to describe inheritance attribute, e.g. private
898 LLVMDIBuilderCreateInheritance(LLVMDIBuilderRef Builder
,
899 LLVMMetadataRef Ty
, LLVMMetadataRef BaseTy
,
900 uint64_t BaseOffset
, uint32_t VBPtrOffset
,
904 * Create a permanent forward-declared type.
905 * \param Builder The DIBuilder.
906 * \param Tag A unique tag for this type.
907 * \param Name Type name.
908 * \param NameLen Length of type name.
909 * \param Scope Type scope.
910 * \param File File where this type is defined.
911 * \param Line Line number where this type is defined.
912 * \param RuntimeLang Indicates runtime version for languages like
914 * \param SizeInBits Member size.
915 * \param AlignInBits Member alignment.
916 * \param UniqueIdentifier A unique identifier for the type.
917 * \param UniqueIdentifierLen Length of the unique identifier.
919 LLVMMetadataRef
LLVMDIBuilderCreateForwardDecl(
920 LLVMDIBuilderRef Builder
, unsigned Tag
, const char *Name
,
921 size_t NameLen
, LLVMMetadataRef Scope
, LLVMMetadataRef File
, unsigned Line
,
922 unsigned RuntimeLang
, uint64_t SizeInBits
, uint32_t AlignInBits
,
923 const char *UniqueIdentifier
, size_t UniqueIdentifierLen
);
926 * Create a temporary forward-declared type.
927 * \param Builder The DIBuilder.
928 * \param Tag A unique tag for this type.
929 * \param Name Type name.
930 * \param NameLen Length of type name.
931 * \param Scope Type scope.
932 * \param File File where this type is defined.
933 * \param Line Line number where this type is defined.
934 * \param RuntimeLang Indicates runtime version for languages like
936 * \param SizeInBits Member size.
937 * \param AlignInBits Member alignment.
938 * \param Flags Flags.
939 * \param UniqueIdentifier A unique identifier for the type.
940 * \param UniqueIdentifierLen Length of the unique identifier.
943 LLVMDIBuilderCreateReplaceableCompositeType(
944 LLVMDIBuilderRef Builder
, unsigned Tag
, const char *Name
,
945 size_t NameLen
, LLVMMetadataRef Scope
, LLVMMetadataRef File
, unsigned Line
,
946 unsigned RuntimeLang
, uint64_t SizeInBits
, uint32_t AlignInBits
,
947 LLVMDIFlags Flags
, const char *UniqueIdentifier
,
948 size_t UniqueIdentifierLen
);
951 * Create debugging information entry for a bit field member.
952 * \param Builder The DIBuilder.
953 * \param Scope Member scope.
954 * \param Name Member name.
955 * \param NameLen Length of member name.
956 * \param File File where this member is defined.
957 * \param LineNumber Line number.
958 * \param SizeInBits Member size.
959 * \param OffsetInBits Member offset.
960 * \param StorageOffsetInBits Member storage offset.
961 * \param Flags Flags to encode member attribute.
962 * \param Type Parent type.
965 LLVMDIBuilderCreateBitFieldMemberType(LLVMDIBuilderRef Builder
,
966 LLVMMetadataRef Scope
,
967 const char *Name
, size_t NameLen
,
968 LLVMMetadataRef File
, unsigned LineNumber
,
970 uint64_t OffsetInBits
,
971 uint64_t StorageOffsetInBits
,
972 LLVMDIFlags Flags
, LLVMMetadataRef Type
);
975 * Create debugging information entry for a class.
976 * \param Scope Scope in which this class is defined.
977 * \param Name Class name.
978 * \param NameLen The length of the C string passed to \c Name.
979 * \param File File where this member is defined.
980 * \param LineNumber Line number.
981 * \param SizeInBits Member size.
982 * \param AlignInBits Member alignment.
983 * \param OffsetInBits Member offset.
984 * \param Flags Flags to encode member attribute, e.g. private.
985 * \param DerivedFrom Debug info of the base class of this type.
986 * \param Elements Class members.
987 * \param NumElements Number of class elements.
988 * \param VTableHolder Debug info of the base class that contains vtable
989 * for this type. This is used in
990 * DW_AT_containing_type. See DWARF documentation
992 * \param TemplateParamsNode Template type parameters.
993 * \param UniqueIdentifier A unique identifier for the type.
994 * \param UniqueIdentifierLen Length of the unique identifier.
996 LLVMMetadataRef
LLVMDIBuilderCreateClassType(LLVMDIBuilderRef Builder
,
997 LLVMMetadataRef Scope
, const char *Name
, size_t NameLen
,
998 LLVMMetadataRef File
, unsigned LineNumber
, uint64_t SizeInBits
,
999 uint32_t AlignInBits
, uint64_t OffsetInBits
, LLVMDIFlags Flags
,
1000 LLVMMetadataRef DerivedFrom
,
1001 LLVMMetadataRef
*Elements
, unsigned NumElements
,
1002 LLVMMetadataRef VTableHolder
, LLVMMetadataRef TemplateParamsNode
,
1003 const char *UniqueIdentifier
, size_t UniqueIdentifierLen
);
1006 * Create a uniqued DIType* clone with FlagArtificial set.
1007 * \param Builder The DIBuilder.
1008 * \param Type The underlying type.
1011 LLVMDIBuilderCreateArtificialType(LLVMDIBuilderRef Builder
,
1012 LLVMMetadataRef Type
);
1015 * Get the name of this DIType.
1016 * \param DType The DIType.
1017 * \param Length The length of the returned string.
1019 * @see DIType::getName()
1021 const char *LLVMDITypeGetName(LLVMMetadataRef DType
, size_t *Length
);
1024 * Get the size of this DIType in bits.
1025 * \param DType The DIType.
1027 * @see DIType::getSizeInBits()
1029 uint64_t LLVMDITypeGetSizeInBits(LLVMMetadataRef DType
);
1032 * Get the offset of this DIType in bits.
1033 * \param DType The DIType.
1035 * @see DIType::getOffsetInBits()
1037 uint64_t LLVMDITypeGetOffsetInBits(LLVMMetadataRef DType
);
1040 * Get the alignment of this DIType in bits.
1041 * \param DType The DIType.
1043 * @see DIType::getAlignInBits()
1045 uint32_t LLVMDITypeGetAlignInBits(LLVMMetadataRef DType
);
1048 * Get the source line where this DIType is declared.
1049 * \param DType The DIType.
1051 * @see DIType::getLine()
1053 unsigned LLVMDITypeGetLine(LLVMMetadataRef DType
);
1056 * Get the flags associated with this DIType.
1057 * \param DType The DIType.
1059 * @see DIType::getFlags()
1061 LLVMDIFlags
LLVMDITypeGetFlags(LLVMMetadataRef DType
);
1064 * Create a descriptor for a value range.
1065 * \param Builder The DIBuilder.
1066 * \param LowerBound Lower bound of the subrange, e.g. 0 for C, 1 for Fortran.
1067 * \param Count Count of elements in the subrange.
1069 LLVMMetadataRef
LLVMDIBuilderGetOrCreateSubrange(LLVMDIBuilderRef Builder
,
1074 * Create an array of DI Nodes.
1075 * \param Builder The DIBuilder.
1076 * \param Data The DI Node elements.
1077 * \param NumElements Number of DI Node elements.
1079 LLVMMetadataRef
LLVMDIBuilderGetOrCreateArray(LLVMDIBuilderRef Builder
,
1080 LLVMMetadataRef
*Data
,
1081 size_t NumElements
);
1084 * Create a new descriptor for the specified variable which has a complex
1085 * address expression for its address.
1086 * \param Builder The DIBuilder.
1087 * \param Addr An array of complex address operations.
1088 * \param Length Length of the address operation array.
1090 LLVMMetadataRef
LLVMDIBuilderCreateExpression(LLVMDIBuilderRef Builder
,
1091 int64_t *Addr
, size_t Length
);
1094 * Create a new descriptor for the specified variable that does not have an
1095 * address, but does have a constant value.
1096 * \param Builder The DIBuilder.
1097 * \param Value The constant value.
1100 LLVMDIBuilderCreateConstantValueExpression(LLVMDIBuilderRef Builder
,
1104 * Create a new descriptor for the specified variable.
1105 * \param Scope Variable scope.
1106 * \param Name Name of the variable.
1107 * \param NameLen The length of the C string passed to \c Name.
1108 * \param Linkage Mangled name of the variable.
1109 * \param LinkLen The length of the C string passed to \c Linkage.
1110 * \param File File where this variable is defined.
1111 * \param LineNo Line number.
1112 * \param Ty Variable Type.
1113 * \param LocalToUnit Boolean flag indicate whether this variable is
1114 * externally visible or not.
1115 * \param Expr The location of the global relative to the attached
1117 * \param Decl Reference to the corresponding declaration.
1119 * \param AlignInBits Variable alignment(or 0 if no alignment attr was
1122 LLVMMetadataRef
LLVMDIBuilderCreateGlobalVariableExpression(
1123 LLVMDIBuilderRef Builder
, LLVMMetadataRef Scope
, const char *Name
,
1124 size_t NameLen
, const char *Linkage
, size_t LinkLen
, LLVMMetadataRef File
,
1125 unsigned LineNo
, LLVMMetadataRef Ty
, LLVMBool LocalToUnit
,
1126 LLVMMetadataRef Expr
, LLVMMetadataRef Decl
, uint32_t AlignInBits
);
1129 * Retrieves the \c DIVariable associated with this global variable expression.
1130 * \param GVE The global variable expression.
1132 * @see llvm::DIGlobalVariableExpression::getVariable()
1134 LLVMMetadataRef
LLVMDIGlobalVariableExpressionGetVariable(LLVMMetadataRef GVE
);
1137 * Retrieves the \c DIExpression associated with this global variable expression.
1138 * \param GVE The global variable expression.
1140 * @see llvm::DIGlobalVariableExpression::getExpression()
1142 LLVMMetadataRef
LLVMDIGlobalVariableExpressionGetExpression(
1143 LLVMMetadataRef GVE
);
1146 * Get the metadata of the file associated with a given variable.
1147 * \param Var The variable object.
1149 * @see DIVariable::getFile()
1151 LLVMMetadataRef
LLVMDIVariableGetFile(LLVMMetadataRef Var
);
1154 * Get the metadata of the scope associated with a given variable.
1155 * \param Var The variable object.
1157 * @see DIVariable::getScope()
1159 LLVMMetadataRef
LLVMDIVariableGetScope(LLVMMetadataRef Var
);
1162 * Get the source line where this \c DIVariable is declared.
1163 * \param Var The DIVariable.
1165 * @see DIVariable::getLine()
1167 unsigned LLVMDIVariableGetLine(LLVMMetadataRef Var
);
1170 * Create a new temporary \c MDNode. Suitable for use in constructing cyclic
1171 * \c MDNode structures. A temporary \c MDNode is not uniqued, may be RAUW'd,
1172 * and must be manually deleted with \c LLVMDisposeTemporaryMDNode.
1173 * \param Ctx The context in which to construct the temporary node.
1174 * \param Data The metadata elements.
1175 * \param NumElements Number of metadata elements.
1177 LLVMMetadataRef
LLVMTemporaryMDNode(LLVMContextRef Ctx
, LLVMMetadataRef
*Data
,
1178 size_t NumElements
);
1181 * Deallocate a temporary node.
1183 * Calls \c replaceAllUsesWith(nullptr) before deleting, so any remaining
1184 * references will be reset.
1185 * \param TempNode The temporary metadata node.
1187 void LLVMDisposeTemporaryMDNode(LLVMMetadataRef TempNode
);
1190 * Replace all uses of temporary metadata.
1191 * \param TempTargetMetadata The temporary metadata node.
1192 * \param Replacement The replacement metadata node.
1194 void LLVMMetadataReplaceAllUsesWith(LLVMMetadataRef TempTargetMetadata
,
1195 LLVMMetadataRef Replacement
);
1198 * Create a new descriptor for the specified global variable that is temporary
1199 * and meant to be RAUWed.
1200 * \param Scope Variable scope.
1201 * \param Name Name of the variable.
1202 * \param NameLen The length of the C string passed to \c Name.
1203 * \param Linkage Mangled name of the variable.
1204 * \param LnkLen The length of the C string passed to \c Linkage.
1205 * \param File File where this variable is defined.
1206 * \param LineNo Line number.
1207 * \param Ty Variable Type.
1208 * \param LocalToUnit Boolean flag indicate whether this variable is
1209 * externally visible or not.
1210 * \param Decl Reference to the corresponding declaration.
1211 * \param AlignInBits Variable alignment(or 0 if no alignment attr was
1214 LLVMMetadataRef
LLVMDIBuilderCreateTempGlobalVariableFwdDecl(
1215 LLVMDIBuilderRef Builder
, LLVMMetadataRef Scope
, const char *Name
,
1216 size_t NameLen
, const char *Linkage
, size_t LnkLen
, LLVMMetadataRef File
,
1217 unsigned LineNo
, LLVMMetadataRef Ty
, LLVMBool LocalToUnit
,
1218 LLVMMetadataRef Decl
, uint32_t AlignInBits
);
1221 * Insert a new llvm.dbg.declare intrinsic call before the given instruction.
1222 * \param Builder The DIBuilder.
1223 * \param Storage The storage of the variable to declare.
1224 * \param VarInfo The variable's debug info descriptor.
1225 * \param Expr A complex location expression for the variable.
1226 * \param DebugLoc Debug info location.
1227 * \param Instr Instruction acting as a location for the new intrinsic.
1229 LLVMValueRef
LLVMDIBuilderInsertDeclareBefore(
1230 LLVMDIBuilderRef Builder
, LLVMValueRef Storage
, LLVMMetadataRef VarInfo
,
1231 LLVMMetadataRef Expr
, LLVMMetadataRef DebugLoc
, LLVMValueRef Instr
);
1234 * Insert a new llvm.dbg.declare intrinsic call at the end of the given basic
1235 * block. If the basic block has a terminator instruction, the intrinsic is
1236 * inserted before that terminator instruction.
1237 * \param Builder The DIBuilder.
1238 * \param Storage The storage of the variable to declare.
1239 * \param VarInfo The variable's debug info descriptor.
1240 * \param Expr A complex location expression for the variable.
1241 * \param DebugLoc Debug info location.
1242 * \param Block Basic block acting as a location for the new intrinsic.
1244 LLVMValueRef
LLVMDIBuilderInsertDeclareAtEnd(
1245 LLVMDIBuilderRef Builder
, LLVMValueRef Storage
, LLVMMetadataRef VarInfo
,
1246 LLVMMetadataRef Expr
, LLVMMetadataRef DebugLoc
, LLVMBasicBlockRef Block
);
1249 * Insert a new llvm.dbg.value intrinsic call before the given instruction.
1250 * \param Builder The DIBuilder.
1251 * \param Val The value of the variable.
1252 * \param VarInfo The variable's debug info descriptor.
1253 * \param Expr A complex location expression for the variable.
1254 * \param DebugLoc Debug info location.
1255 * \param Instr Instruction acting as a location for the new intrinsic.
1257 LLVMValueRef
LLVMDIBuilderInsertDbgValueBefore(LLVMDIBuilderRef Builder
,
1259 LLVMMetadataRef VarInfo
,
1260 LLVMMetadataRef Expr
,
1261 LLVMMetadataRef DebugLoc
,
1262 LLVMValueRef Instr
);
1265 * Insert a new llvm.dbg.value intrinsic call at the end of the given basic
1266 * block. If the basic block has a terminator instruction, the intrinsic is
1267 * inserted before that terminator instruction.
1268 * \param Builder The DIBuilder.
1269 * \param Val The value of the variable.
1270 * \param VarInfo The variable's debug info descriptor.
1271 * \param Expr A complex location expression for the variable.
1272 * \param DebugLoc Debug info location.
1273 * \param Block Basic block acting as a location for the new intrinsic.
1275 LLVMValueRef
LLVMDIBuilderInsertDbgValueAtEnd(LLVMDIBuilderRef Builder
,
1277 LLVMMetadataRef VarInfo
,
1278 LLVMMetadataRef Expr
,
1279 LLVMMetadataRef DebugLoc
,
1280 LLVMBasicBlockRef Block
);
1283 * Create a new descriptor for a local auto variable.
1284 * \param Builder The DIBuilder.
1285 * \param Scope The local scope the variable is declared in.
1286 * \param Name Variable name.
1287 * \param NameLen Length of variable name.
1288 * \param File File where this variable is defined.
1289 * \param LineNo Line number.
1290 * \param Ty Metadata describing the type of the variable.
1291 * \param AlwaysPreserve If true, this descriptor will survive optimizations.
1292 * \param Flags Flags.
1293 * \param AlignInBits Variable alignment.
1295 LLVMMetadataRef
LLVMDIBuilderCreateAutoVariable(
1296 LLVMDIBuilderRef Builder
, LLVMMetadataRef Scope
, const char *Name
,
1297 size_t NameLen
, LLVMMetadataRef File
, unsigned LineNo
, LLVMMetadataRef Ty
,
1298 LLVMBool AlwaysPreserve
, LLVMDIFlags Flags
, uint32_t AlignInBits
);
1301 * Create a new descriptor for a function parameter variable.
1302 * \param Builder The DIBuilder.
1303 * \param Scope The local scope the variable is declared in.
1304 * \param Name Variable name.
1305 * \param NameLen Length of variable name.
1306 * \param ArgNo Unique argument number for this variable; starts at 1.
1307 * \param File File where this variable is defined.
1308 * \param LineNo Line number.
1309 * \param Ty Metadata describing the type of the variable.
1310 * \param AlwaysPreserve If true, this descriptor will survive optimizations.
1311 * \param Flags Flags.
1313 LLVMMetadataRef
LLVMDIBuilderCreateParameterVariable(
1314 LLVMDIBuilderRef Builder
, LLVMMetadataRef Scope
, const char *Name
,
1315 size_t NameLen
, unsigned ArgNo
, LLVMMetadataRef File
, unsigned LineNo
,
1316 LLVMMetadataRef Ty
, LLVMBool AlwaysPreserve
, LLVMDIFlags Flags
);
1319 * Get the metadata of the subprogram attached to a function.
1321 * @see llvm::Function::getSubprogram()
1323 LLVMMetadataRef
LLVMGetSubprogram(LLVMValueRef Func
);
1326 * Set the subprogram attached to a function.
1328 * @see llvm::Function::setSubprogram()
1330 void LLVMSetSubprogram(LLVMValueRef Func
, LLVMMetadataRef SP
);
1333 * Get the line associated with a given subprogram.
1334 * \param Subprogram The subprogram object.
1336 * @see DISubprogram::getLine()
1338 unsigned LLVMDISubprogramGetLine(LLVMMetadataRef Subprogram
);
1341 * Get the debug location for the given instruction.
1343 * @see llvm::Instruction::getDebugLoc()
1345 LLVMMetadataRef
LLVMInstructionGetDebugLoc(LLVMValueRef Inst
);
1348 * Set the debug location for the given instruction.
1350 * To clear the location metadata of the given instruction, pass NULL to \p Loc.
1352 * @see llvm::Instruction::setDebugLoc()
1354 void LLVMInstructionSetDebugLoc(LLVMValueRef Inst
, LLVMMetadataRef Loc
);
1357 * Obtain the enumerated type of a Metadata instance.
1359 * @see llvm::Metadata::getMetadataID()
1361 LLVMMetadataKind
LLVMGetMetadataKind(LLVMMetadataRef Metadata
);