1 //===------------ DebugInfo.h - LLVM C API Debug Info API -----------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 /// This file declares the C API endpoints for generating DWARF Debug Info
12 /// Note: This interface is experimental. It is *NOT* stable, and may be
13 /// changed without warning.
15 //===----------------------------------------------------------------------===//
17 #ifndef LLVM_C_DEBUGINFO_H
18 #define LLVM_C_DEBUGINFO_H
20 #include "llvm-c/Core.h"
31 LLVMDIFlagPrivate = 1,
32 LLVMDIFlagProtected = 2,
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 LLVMDIFlagBigEndian = 1 << 27,
61 LLVMDIFlagLittleEndian = 1 << 28,
62 LLVMDIFlagIndirectVirtualBase = (1 << 2) | (1 << 5),
63 LLVMDIFlagAccessibility = LLVMDIFlagPrivate | LLVMDIFlagProtected |
65 LLVMDIFlagPtrToMemberRep = LLVMDIFlagSingleInheritance |
66 LLVMDIFlagMultipleInheritance |
67 LLVMDIFlagVirtualInheritance
71 * Source languages known by DWARF.
74 LLVMDWARFSourceLanguageC89,
75 LLVMDWARFSourceLanguageC,
76 LLVMDWARFSourceLanguageAda83,
77 LLVMDWARFSourceLanguageC_plus_plus,
78 LLVMDWARFSourceLanguageCobol74,
79 LLVMDWARFSourceLanguageCobol85,
80 LLVMDWARFSourceLanguageFortran77,
81 LLVMDWARFSourceLanguageFortran90,
82 LLVMDWARFSourceLanguagePascal83,
83 LLVMDWARFSourceLanguageModula2,
85 LLVMDWARFSourceLanguageJava,
86 LLVMDWARFSourceLanguageC99,
87 LLVMDWARFSourceLanguageAda95,
88 LLVMDWARFSourceLanguageFortran95,
89 LLVMDWARFSourceLanguagePLI,
90 LLVMDWARFSourceLanguageObjC,
91 LLVMDWARFSourceLanguageObjC_plus_plus,
92 LLVMDWARFSourceLanguageUPC,
93 LLVMDWARFSourceLanguageD,
95 LLVMDWARFSourceLanguagePython,
97 LLVMDWARFSourceLanguageOpenCL,
98 LLVMDWARFSourceLanguageGo,
99 LLVMDWARFSourceLanguageModula3,
100 LLVMDWARFSourceLanguageHaskell,
101 LLVMDWARFSourceLanguageC_plus_plus_03,
102 LLVMDWARFSourceLanguageC_plus_plus_11,
103 LLVMDWARFSourceLanguageOCaml,
104 LLVMDWARFSourceLanguageRust,
105 LLVMDWARFSourceLanguageC11,
106 LLVMDWARFSourceLanguageSwift,
107 LLVMDWARFSourceLanguageJulia,
108 LLVMDWARFSourceLanguageDylan,
109 LLVMDWARFSourceLanguageC_plus_plus_14,
110 LLVMDWARFSourceLanguageFortran03,
111 LLVMDWARFSourceLanguageFortran08,
112 LLVMDWARFSourceLanguageRenderScript,
113 LLVMDWARFSourceLanguageBLISS,
114 // Vendor extensions:
115 LLVMDWARFSourceLanguageMips_Assembler,
116 LLVMDWARFSourceLanguageGOOGLE_RenderScript,
117 LLVMDWARFSourceLanguageBORLAND_Delphi
118 } LLVMDWARFSourceLanguage;
121 * The amount of debug information to emit.
124 LLVMDWARFEmissionNone = 0,
125 LLVMDWARFEmissionFull,
126 LLVMDWARFEmissionLineTablesOnly
127 } LLVMDWARFEmissionKind;
130 * An LLVM DWARF type encoding.
132 typedef unsigned LLVMDWARFTypeEncoding;
135 * The current debug metadata version number.
137 unsigned LLVMDebugMetadataVersion(void);
140 * The version of debug metadata that's present in the provided \c Module.
142 unsigned LLVMGetModuleDebugMetadataVersion(LLVMModuleRef Module);
145 * Strip debug info in the module if it exists.
146 * To do this, we remove all calls to the debugger intrinsics and any named
147 * metadata for debugging. We also remove debug locations for instructions.
148 * Return true if module is modified.
150 LLVMBool LLVMStripModuleDebugInfo(LLVMModuleRef Module);
153 * Construct a builder for a module, and do not allow for unresolved nodes
154 * attached to the module.
156 LLVMDIBuilderRef LLVMCreateDIBuilderDisallowUnresolved(LLVMModuleRef M);
159 * Construct a builder for a module and collect unresolved nodes attached
160 * to the module in order to resolve cycles during a call to
161 * \c LLVMDIBuilderFinalize.
163 LLVMDIBuilderRef LLVMCreateDIBuilder(LLVMModuleRef M);
166 * Deallocates the \c DIBuilder and everything it owns.
167 * @note You must call \c LLVMDIBuilderFinalize before this
169 void LLVMDisposeDIBuilder(LLVMDIBuilderRef Builder);
172 * Construct any deferred debug info descriptors.
174 void LLVMDIBuilderFinalize(LLVMDIBuilderRef Builder);
177 * A CompileUnit provides an anchor for all debugging
178 * information generated during this instance of compilation.
179 * \param Lang Source programming language, eg.
180 * \c LLVMDWARFSourceLanguageC99
181 * \param FileRef File info.
182 * \param Producer Identify the producer of debugging information
183 * and code. Usually this is a compiler
185 * \param ProducerLen The length of the C string passed to \c Producer.
186 * \param isOptimized A boolean flag which indicates whether optimization
188 * \param Flags This string lists command line options. This
189 * string is directly embedded in debug info
190 * output which may be used by a tool
191 * analyzing generated debugging information.
192 * \param FlagsLen The length of the C string passed to \c Flags.
193 * \param RuntimeVer This indicates runtime version for languages like
195 * \param SplitName The name of the file that we'll split debug info
197 * \param SplitNameLen The length of the C string passed to \c SplitName.
198 * \param Kind The kind of debug information to generate.
199 * \param DWOId The DWOId if this is a split skeleton compile unit.
200 * \param SplitDebugInlining Whether to emit inline debug info.
201 * \param DebugInfoForProfiling Whether to emit extra debug info for
202 * profile collection.
204 LLVMMetadataRef LLVMDIBuilderCreateCompileUnit(
205 LLVMDIBuilderRef Builder, LLVMDWARFSourceLanguage Lang,
206 LLVMMetadataRef FileRef, const char *Producer, size_t ProducerLen,
207 LLVMBool isOptimized, const char *Flags, size_t FlagsLen,
208 unsigned RuntimeVer, const char *SplitName, size_t SplitNameLen,
209 LLVMDWARFEmissionKind Kind, unsigned DWOId, LLVMBool SplitDebugInlining,
210 LLVMBool DebugInfoForProfiling);
213 * Create a file descriptor to hold debugging information for a file.
214 * \param Builder The \c DIBuilder.
215 * \param Filename File name.
216 * \param FilenameLen The length of the C string passed to \c Filename.
217 * \param Directory Directory.
218 * \param DirectoryLen The length of the C string passed to \c Directory.
221 LLVMDIBuilderCreateFile(LLVMDIBuilderRef Builder, const char *Filename,
222 size_t FilenameLen, const char *Directory,
223 size_t DirectoryLen);
226 * Creates a new descriptor for a module with the specified parent scope.
227 * \param Builder The \c DIBuilder.
228 * \param ParentScope The parent scope containing this module declaration.
229 * \param Name Module name.
230 * \param NameLen The length of the C string passed to \c Name.
231 * \param ConfigMacros A space-separated shell-quoted list of -D macro
232 definitions as they would appear on a command line.
233 * \param ConfigMacrosLen The length of the C string passed to \c ConfigMacros.
234 * \param IncludePath The path to the module map file.
235 * \param IncludePathLen The length of the C string passed to \c IncludePath.
236 * \param ISysRoot The Clang system root (value of -isysroot).
237 * \param ISysRootLen The length of the C string passed to \c ISysRoot.
240 LLVMDIBuilderCreateModule(LLVMDIBuilderRef Builder, LLVMMetadataRef ParentScope,
241 const char *Name, size_t NameLen,
242 const char *ConfigMacros, size_t ConfigMacrosLen,
243 const char *IncludePath, size_t IncludePathLen,
244 const char *ISysRoot, size_t ISysRootLen);
247 * Creates a new descriptor for a namespace with the specified parent scope.
248 * \param Builder The \c DIBuilder.
249 * \param ParentScope The parent scope containing this module declaration.
250 * \param Name NameSpace name.
251 * \param NameLen The length of the C string passed to \c Name.
252 * \param ExportSymbols Whether or not the namespace exports symbols, e.g.
253 * this is true of C++ inline namespaces.
256 LLVMDIBuilderCreateNameSpace(LLVMDIBuilderRef Builder,
257 LLVMMetadataRef ParentScope,
258 const char *Name, size_t NameLen,
259 LLVMBool ExportSymbols);
262 * Create a new descriptor for the specified subprogram.
263 * \param Builder The \c DIBuilder.
264 * \param Scope Function scope.
265 * \param Name Function name.
266 * \param NameLen Length of enumeration name.
267 * \param LinkageName Mangled function name.
268 * \param LinkageNameLen Length of linkage name.
269 * \param File File where this variable is defined.
270 * \param LineNo Line number.
271 * \param Ty Function type.
272 * \param IsLocalToUnit True if this function is not externally visible.
273 * \param IsDefinition True if this is a function definition.
274 * \param ScopeLine Set to the beginning of the scope this starts
275 * \param Flags E.g.: \c LLVMDIFlagLValueReference. These flags are
276 * used to emit dwarf attributes.
277 * \param IsOptimized True if optimization is ON.
279 LLVMMetadataRef LLVMDIBuilderCreateFunction(
280 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
281 size_t NameLen, const char *LinkageName, size_t LinkageNameLen,
282 LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty,
283 LLVMBool IsLocalToUnit, LLVMBool IsDefinition,
284 unsigned ScopeLine, LLVMDIFlags Flags, LLVMBool IsOptimized);
287 * Create a descriptor for a lexical block with the specified parent context.
288 * \param Builder The \c DIBuilder.
289 * \param Scope Parent lexical block.
290 * \param File Source file.
291 * \param Line The line in the source file.
292 * \param Column The column in the source file.
294 LLVMMetadataRef LLVMDIBuilderCreateLexicalBlock(
295 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope,
296 LLVMMetadataRef File, unsigned Line, unsigned Column);
299 * Create a descriptor for a lexical block with a new file attached.
300 * \param Builder The \c DIBuilder.
301 * \param Scope Lexical block.
302 * \param File Source file.
303 * \param Discriminator DWARF path discriminator value.
306 LLVMDIBuilderCreateLexicalBlockFile(LLVMDIBuilderRef Builder,
307 LLVMMetadataRef Scope,
308 LLVMMetadataRef File,
309 unsigned Discriminator);
312 * Create a descriptor for an imported namespace. Suitable for e.g. C++
313 * using declarations.
314 * \param Builder The \c DIBuilder.
315 * \param Scope The scope this module is imported into
316 * \param File File where the declaration is located.
317 * \param Line Line number of the declaration.
320 LLVMDIBuilderCreateImportedModuleFromNamespace(LLVMDIBuilderRef Builder,
321 LLVMMetadataRef Scope,
323 LLVMMetadataRef File,
327 * Create a descriptor for an imported module that aliases another
328 * imported entity descriptor.
329 * \param Builder The \c DIBuilder.
330 * \param Scope The scope this module is imported into
331 * \param ImportedEntity Previous imported entity to alias.
332 * \param File File where the declaration is located.
333 * \param Line Line number of the declaration.
336 LLVMDIBuilderCreateImportedModuleFromAlias(LLVMDIBuilderRef Builder,
337 LLVMMetadataRef Scope,
338 LLVMMetadataRef ImportedEntity,
339 LLVMMetadataRef File,
343 * Create a descriptor for an imported module.
344 * \param Builder The \c DIBuilder.
345 * \param Scope The scope this module is imported into
346 * \param M The module being imported here
347 * \param File File where the declaration is located.
348 * \param Line Line number of the declaration.
351 LLVMDIBuilderCreateImportedModuleFromModule(LLVMDIBuilderRef Builder,
352 LLVMMetadataRef Scope,
354 LLVMMetadataRef File,
358 * Create a descriptor for an imported function, type, or variable. Suitable
359 * for e.g. FORTRAN-style USE declarations.
360 * \param Builder The DIBuilder.
361 * \param Scope The scope this module is imported into.
362 * \param Decl The declaration (or definition) of a function, type,
364 * \param File File where the declaration is located.
365 * \param Line Line number of the declaration.
366 * \param Name A name that uniquely identifies this imported declaration.
367 * \param NameLen The length of the C string passed to \c Name.
370 LLVMDIBuilderCreateImportedDeclaration(LLVMDIBuilderRef Builder,
371 LLVMMetadataRef Scope,
372 LLVMMetadataRef Decl,
373 LLVMMetadataRef File,
375 const char *Name, size_t NameLen);
378 * Creates a new DebugLocation that describes a source location.
379 * \param Line The line in the source file.
380 * \param Column The column in the source file.
381 * \param Scope The scope in which the location resides.
382 * \param InlinedAt The scope where this location was inlined, if at all.
384 * \note If the item to which this location is attached cannot be
385 * attributed to a source line, pass 0 for the line and column.
388 LLVMDIBuilderCreateDebugLocation(LLVMContextRef Ctx, unsigned Line,
389 unsigned Column, LLVMMetadataRef Scope,
390 LLVMMetadataRef InlinedAt);
393 * Get the line number of this debug location.
394 * \param Location The debug location.
396 * @see DILocation::getLine()
398 unsigned LLVMDILocationGetLine(LLVMMetadataRef Location);
401 * Get the column number of this debug location.
402 * \param Location The debug location.
404 * @see DILocation::getColumn()
406 unsigned LLVMDILocationGetColumn(LLVMMetadataRef Location);
409 * Get the local scope associated with this debug location.
410 * \param Location The debug location.
412 * @see DILocation::getScope()
414 LLVMMetadataRef LLVMDILocationGetScope(LLVMMetadataRef Location);
417 * Create a type array.
418 * \param Builder The DIBuilder.
419 * \param Data The type elements.
420 * \param NumElements Number of type elements.
422 LLVMMetadataRef LLVMDIBuilderGetOrCreateTypeArray(LLVMDIBuilderRef Builder,
423 LLVMMetadataRef *Data,
427 * Create subroutine type.
428 * \param Builder The DIBuilder.
429 * \param File The file in which the subroutine resides.
430 * \param ParameterTypes An array of subroutine parameter types. This
431 * includes return type at 0th index.
432 * \param NumParameterTypes The number of parameter types in \c ParameterTypes
433 * \param Flags E.g.: \c LLVMDIFlagLValueReference.
434 * These flags are used to emit dwarf attributes.
437 LLVMDIBuilderCreateSubroutineType(LLVMDIBuilderRef Builder,
438 LLVMMetadataRef File,
439 LLVMMetadataRef *ParameterTypes,
440 unsigned NumParameterTypes,
444 * Create debugging information entry for an enumeration.
445 * \param Builder The DIBuilder.
446 * \param Scope Scope in which this enumeration is defined.
447 * \param Name Enumeration name.
448 * \param NameLen Length of enumeration name.
449 * \param File File where this member is defined.
450 * \param LineNumber Line number.
451 * \param SizeInBits Member size.
452 * \param AlignInBits Member alignment.
453 * \param Elements Enumeration elements.
454 * \param NumElements Number of enumeration elements.
455 * \param ClassTy Underlying type of a C++11/ObjC fixed enum.
457 LLVMMetadataRef LLVMDIBuilderCreateEnumerationType(
458 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
459 size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,
460 uint64_t SizeInBits, uint32_t AlignInBits, LLVMMetadataRef *Elements,
461 unsigned NumElements, LLVMMetadataRef ClassTy);
464 * Create debugging information entry for a union.
465 * \param Builder The DIBuilder.
466 * \param Scope Scope in which this union is defined.
467 * \param Name Union name.
468 * \param NameLen Length of union name.
469 * \param File File where this member is defined.
470 * \param LineNumber Line number.
471 * \param SizeInBits Member size.
472 * \param AlignInBits Member alignment.
473 * \param Flags Flags to encode member attribute, e.g. private
474 * \param Elements Union elements.
475 * \param NumElements Number of union elements.
476 * \param RunTimeLang Optional parameter, Objective-C runtime version.
477 * \param UniqueId A unique identifier for the union.
478 * \param UniqueIdLen Length of unique identifier.
480 LLVMMetadataRef LLVMDIBuilderCreateUnionType(
481 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
482 size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,
483 uint64_t SizeInBits, uint32_t AlignInBits, LLVMDIFlags Flags,
484 LLVMMetadataRef *Elements, unsigned NumElements, unsigned RunTimeLang,
485 const char *UniqueId, size_t UniqueIdLen);
489 * Create debugging information entry for an array.
490 * \param Builder The DIBuilder.
491 * \param Size Array size.
492 * \param AlignInBits Alignment.
493 * \param Ty Element type.
494 * \param Subscripts Subscripts.
495 * \param NumSubscripts Number of subscripts.
498 LLVMDIBuilderCreateArrayType(LLVMDIBuilderRef Builder, uint64_t Size,
499 uint32_t AlignInBits, LLVMMetadataRef Ty,
500 LLVMMetadataRef *Subscripts,
501 unsigned NumSubscripts);
504 * Create debugging information entry for a vector type.
505 * \param Builder The DIBuilder.
506 * \param Size Vector size.
507 * \param AlignInBits Alignment.
508 * \param Ty Element type.
509 * \param Subscripts Subscripts.
510 * \param NumSubscripts Number of subscripts.
513 LLVMDIBuilderCreateVectorType(LLVMDIBuilderRef Builder, uint64_t Size,
514 uint32_t AlignInBits, LLVMMetadataRef Ty,
515 LLVMMetadataRef *Subscripts,
516 unsigned NumSubscripts);
519 * Create a DWARF unspecified type.
520 * \param Builder The DIBuilder.
521 * \param Name The unspecified type's name.
522 * \param NameLen Length of type name.
525 LLVMDIBuilderCreateUnspecifiedType(LLVMDIBuilderRef Builder, const char *Name,
529 * Create debugging information entry for a basic
531 * \param Builder The DIBuilder.
532 * \param Name Type name.
533 * \param NameLen Length of type name.
534 * \param SizeInBits Size of the type.
535 * \param Encoding DWARF encoding code, e.g. \c LLVMDWARFTypeEncoding_float.
536 * \param Flags Flags to encode optional attribute like endianity
539 LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef Builder, const char *Name,
540 size_t NameLen, uint64_t SizeInBits,
541 LLVMDWARFTypeEncoding Encoding,
545 * Create debugging information entry for a pointer.
546 * \param Builder The DIBuilder.
547 * \param PointeeTy Type pointed by this pointer.
548 * \param SizeInBits Size.
549 * \param AlignInBits Alignment. (optional, pass 0 to ignore)
550 * \param AddressSpace DWARF address space. (optional, pass 0 to ignore)
551 * \param Name Pointer type name. (optional)
552 * \param NameLen Length of pointer type name. (optional)
554 LLVMMetadataRef LLVMDIBuilderCreatePointerType(
555 LLVMDIBuilderRef Builder, LLVMMetadataRef PointeeTy,
556 uint64_t SizeInBits, uint32_t AlignInBits, unsigned AddressSpace,
557 const char *Name, size_t NameLen);
560 * Create debugging information entry for a struct.
561 * \param Builder The DIBuilder.
562 * \param Scope Scope in which this struct is defined.
563 * \param Name Struct name.
564 * \param NameLen Struct name length.
565 * \param File File where this member is defined.
566 * \param LineNumber Line number.
567 * \param SizeInBits Member size.
568 * \param AlignInBits Member alignment.
569 * \param Flags Flags to encode member attribute, e.g. private
570 * \param Elements Struct elements.
571 * \param NumElements Number of struct elements.
572 * \param RunTimeLang Optional parameter, Objective-C runtime version.
573 * \param VTableHolder The object containing the vtable for the struct.
574 * \param UniqueId A unique identifier for the struct.
575 * \param UniqueIdLen Length of the unique identifier for the struct.
577 LLVMMetadataRef LLVMDIBuilderCreateStructType(
578 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
579 size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,
580 uint64_t SizeInBits, uint32_t AlignInBits, LLVMDIFlags Flags,
581 LLVMMetadataRef DerivedFrom, LLVMMetadataRef *Elements,
582 unsigned NumElements, unsigned RunTimeLang, LLVMMetadataRef VTableHolder,
583 const char *UniqueId, size_t UniqueIdLen);
586 * Create debugging information entry for a member.
587 * \param Builder The DIBuilder.
588 * \param Scope Member scope.
589 * \param Name Member name.
590 * \param NameLen Length of member name.
591 * \param File File where this member is defined.
592 * \param LineNo Line number.
593 * \param SizeInBits Member size.
594 * \param AlignInBits Member alignment.
595 * \param OffsetInBits Member offset.
596 * \param Flags Flags to encode member attribute, e.g. private
597 * \param Ty Parent type.
599 LLVMMetadataRef LLVMDIBuilderCreateMemberType(
600 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
601 size_t NameLen, LLVMMetadataRef File, unsigned LineNo,
602 uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
603 LLVMDIFlags Flags, LLVMMetadataRef Ty);
606 * Create debugging information entry for a
607 * C++ static data member.
608 * \param Builder The DIBuilder.
609 * \param Scope Member scope.
610 * \param Name Member name.
611 * \param NameLen Length of member name.
612 * \param File File where this member is declared.
613 * \param LineNumber Line number.
614 * \param Type Type of the static member.
615 * \param Flags Flags to encode member attribute, e.g. private.
616 * \param ConstantVal Const initializer of the member.
617 * \param AlignInBits Member alignment.
620 LLVMDIBuilderCreateStaticMemberType(
621 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
622 size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,
623 LLVMMetadataRef Type, LLVMDIFlags Flags, LLVMValueRef ConstantVal,
624 uint32_t AlignInBits);
627 * Create debugging information entry for a pointer to member.
628 * \param Builder The DIBuilder.
629 * \param PointeeType Type pointed to by this pointer.
630 * \param ClassType Type for which this pointer points to members of.
631 * \param SizeInBits Size.
632 * \param AlignInBits Alignment.
633 * \param Flags Flags.
636 LLVMDIBuilderCreateMemberPointerType(LLVMDIBuilderRef Builder,
637 LLVMMetadataRef PointeeType,
638 LLVMMetadataRef ClassType,
640 uint32_t AlignInBits,
643 * Create debugging information entry for Objective-C instance variable.
644 * \param Builder The DIBuilder.
645 * \param Name Member name.
646 * \param NameLen The length of the C string passed to \c Name.
647 * \param File File where this member is defined.
648 * \param LineNo Line number.
649 * \param SizeInBits Member size.
650 * \param AlignInBits Member alignment.
651 * \param OffsetInBits Member offset.
652 * \param Flags Flags to encode member attribute, e.g. private
653 * \param Ty Parent type.
654 * \param PropertyNode Property associated with this ivar.
657 LLVMDIBuilderCreateObjCIVar(LLVMDIBuilderRef Builder,
658 const char *Name, size_t NameLen,
659 LLVMMetadataRef File, unsigned LineNo,
660 uint64_t SizeInBits, uint32_t AlignInBits,
661 uint64_t OffsetInBits, LLVMDIFlags Flags,
662 LLVMMetadataRef Ty, LLVMMetadataRef PropertyNode);
665 * Create debugging information entry for Objective-C property.
666 * \param Builder The DIBuilder.
667 * \param Name Property name.
668 * \param NameLen The length of the C string passed to \c Name.
669 * \param File File where this property is defined.
670 * \param LineNo Line number.
671 * \param GetterName Name of the Objective C property getter selector.
672 * \param GetterNameLen The length of the C string passed to \c GetterName.
673 * \param SetterName Name of the Objective C property setter selector.
674 * \param SetterNameLen The length of the C string passed to \c SetterName.
675 * \param PropertyAttributes Objective C property attributes.
679 LLVMDIBuilderCreateObjCProperty(LLVMDIBuilderRef Builder,
680 const char *Name, size_t NameLen,
681 LLVMMetadataRef File, unsigned LineNo,
682 const char *GetterName, size_t GetterNameLen,
683 const char *SetterName, size_t SetterNameLen,
684 unsigned PropertyAttributes,
688 * Create a uniqued DIType* clone with FlagObjectPointer and FlagArtificial set.
689 * \param Builder The DIBuilder.
690 * \param Type The underlying type to which this pointer points.
693 LLVMDIBuilderCreateObjectPointerType(LLVMDIBuilderRef Builder,
694 LLVMMetadataRef Type);
697 * Create debugging information entry for a qualified
698 * type, e.g. 'const int'.
699 * \param Builder The DIBuilder.
700 * \param Tag Tag identifying type,
701 * e.g. LLVMDWARFTypeQualifier_volatile_type
702 * \param Type Base Type.
705 LLVMDIBuilderCreateQualifiedType(LLVMDIBuilderRef Builder, unsigned Tag,
706 LLVMMetadataRef Type);
709 * Create debugging information entry for a c++
710 * style reference or rvalue reference type.
711 * \param Builder The DIBuilder.
712 * \param Tag Tag identifying type,
713 * \param Type Base Type.
716 LLVMDIBuilderCreateReferenceType(LLVMDIBuilderRef Builder, unsigned Tag,
717 LLVMMetadataRef Type);
720 * Create C++11 nullptr type.
721 * \param Builder The DIBuilder.
724 LLVMDIBuilderCreateNullPtrType(LLVMDIBuilderRef Builder);
727 * Create debugging information entry for a typedef.
728 * \param Builder The DIBuilder.
729 * \param Type Original type.
730 * \param Name Typedef name.
731 * \param File File where this type is defined.
732 * \param LineNo Line number.
733 * \param Scope The surrounding context for the typedef.
736 LLVMDIBuilderCreateTypedef(LLVMDIBuilderRef Builder, LLVMMetadataRef Type,
737 const char *Name, size_t NameLen,
738 LLVMMetadataRef File, unsigned LineNo,
739 LLVMMetadataRef Scope);
742 * Create debugging information entry to establish inheritance relationship
744 * \param Builder The DIBuilder.
745 * \param Ty Original type.
746 * \param BaseTy Base type. Ty is inherits from base.
747 * \param BaseOffset Base offset.
748 * \param VBPtrOffset Virtual base pointer offset.
749 * \param Flags Flags to describe inheritance attribute, e.g. private
752 LLVMDIBuilderCreateInheritance(LLVMDIBuilderRef Builder,
753 LLVMMetadataRef Ty, LLVMMetadataRef BaseTy,
754 uint64_t BaseOffset, uint32_t VBPtrOffset,
758 * Create a permanent forward-declared type.
759 * \param Builder The DIBuilder.
760 * \param Tag A unique tag for this type.
761 * \param Name Type name.
762 * \param NameLen Length of type name.
763 * \param Scope Type scope.
764 * \param File File where this type is defined.
765 * \param Line Line number where this type is defined.
766 * \param RuntimeLang Indicates runtime version for languages like
768 * \param SizeInBits Member size.
769 * \param AlignInBits Member alignment.
770 * \param UniqueIdentifier A unique identifier for the type.
771 * \param UniqueIdentifierLen Length of the unique identifier.
773 LLVMMetadataRef LLVMDIBuilderCreateForwardDecl(
774 LLVMDIBuilderRef Builder, unsigned Tag, const char *Name,
775 size_t NameLen, LLVMMetadataRef Scope, LLVMMetadataRef File, unsigned Line,
776 unsigned RuntimeLang, uint64_t SizeInBits, uint32_t AlignInBits,
777 const char *UniqueIdentifier, size_t UniqueIdentifierLen);
780 * Create a temporary forward-declared type.
781 * \param Builder The DIBuilder.
782 * \param Tag A unique tag for this type.
783 * \param Name Type name.
784 * \param NameLen Length of type name.
785 * \param Scope Type scope.
786 * \param File File where this type is defined.
787 * \param Line Line number where this type is defined.
788 * \param RuntimeLang Indicates runtime version for languages like
790 * \param SizeInBits Member size.
791 * \param AlignInBits Member alignment.
792 * \param Flags Flags.
793 * \param UniqueIdentifier A unique identifier for the type.
794 * \param UniqueIdentifierLen Length of the unique identifier.
797 LLVMDIBuilderCreateReplaceableCompositeType(
798 LLVMDIBuilderRef Builder, unsigned Tag, const char *Name,
799 size_t NameLen, LLVMMetadataRef Scope, LLVMMetadataRef File, unsigned Line,
800 unsigned RuntimeLang, uint64_t SizeInBits, uint32_t AlignInBits,
801 LLVMDIFlags Flags, const char *UniqueIdentifier,
802 size_t UniqueIdentifierLen);
805 * Create debugging information entry for a bit field member.
806 * \param Builder The DIBuilder.
807 * \param Scope Member scope.
808 * \param Name Member name.
809 * \param NameLen Length of member name.
810 * \param File File where this member is defined.
811 * \param LineNumber Line number.
812 * \param SizeInBits Member size.
813 * \param OffsetInBits Member offset.
814 * \param StorageOffsetInBits Member storage offset.
815 * \param Flags Flags to encode member attribute.
816 * \param Type Parent type.
819 LLVMDIBuilderCreateBitFieldMemberType(LLVMDIBuilderRef Builder,
820 LLVMMetadataRef Scope,
821 const char *Name, size_t NameLen,
822 LLVMMetadataRef File, unsigned LineNumber,
824 uint64_t OffsetInBits,
825 uint64_t StorageOffsetInBits,
826 LLVMDIFlags Flags, LLVMMetadataRef Type);
829 * Create debugging information entry for a class.
830 * \param Scope Scope in which this class is defined.
831 * \param Name Class name.
832 * \param NameLen The length of the C string passed to \c Name.
833 * \param File File where this member is defined.
834 * \param LineNumber Line number.
835 * \param SizeInBits Member size.
836 * \param AlignInBits Member alignment.
837 * \param OffsetInBits Member offset.
838 * \param Flags Flags to encode member attribute, e.g. private.
839 * \param DerivedFrom Debug info of the base class of this type.
840 * \param Elements Class members.
841 * \param NumElements Number of class elements.
842 * \param VTableHolder Debug info of the base class that contains vtable
843 * for this type. This is used in
844 * DW_AT_containing_type. See DWARF documentation
846 * \param TemplateParamsNode Template type parameters.
847 * \param UniqueIdentifier A unique identifier for the type.
848 * \param UniqueIdentifierLen Length of the unique identifier.
850 LLVMMetadataRef LLVMDIBuilderCreateClassType(LLVMDIBuilderRef Builder,
851 LLVMMetadataRef Scope, const char *Name, size_t NameLen,
852 LLVMMetadataRef File, unsigned LineNumber, uint64_t SizeInBits,
853 uint32_t AlignInBits, uint64_t OffsetInBits, LLVMDIFlags Flags,
854 LLVMMetadataRef DerivedFrom,
855 LLVMMetadataRef *Elements, unsigned NumElements,
856 LLVMMetadataRef VTableHolder, LLVMMetadataRef TemplateParamsNode,
857 const char *UniqueIdentifier, size_t UniqueIdentifierLen);
860 * Create a uniqued DIType* clone with FlagArtificial set.
861 * \param Builder The DIBuilder.
862 * \param Type The underlying type.
865 LLVMDIBuilderCreateArtificialType(LLVMDIBuilderRef Builder,
866 LLVMMetadataRef Type);
869 * Get the name of this DIType.
870 * \param DType The DIType.
871 * \param Length The length of the returned string.
873 * @see DIType::getName()
875 const char *LLVMDITypeGetName(LLVMMetadataRef DType, size_t *Length);
878 * Get the size of this DIType in bits.
879 * \param DType The DIType.
881 * @see DIType::getSizeInBits()
883 uint64_t LLVMDITypeGetSizeInBits(LLVMMetadataRef DType);
886 * Get the offset of this DIType in bits.
887 * \param DType The DIType.
889 * @see DIType::getOffsetInBits()
891 uint64_t LLVMDITypeGetOffsetInBits(LLVMMetadataRef DType);
894 * Get the alignment of this DIType in bits.
895 * \param DType The DIType.
897 * @see DIType::getAlignInBits()
899 uint32_t LLVMDITypeGetAlignInBits(LLVMMetadataRef DType);
902 * Get the source line where this DIType is declared.
903 * \param DType The DIType.
905 * @see DIType::getLine()
907 unsigned LLVMDITypeGetLine(LLVMMetadataRef DType);
910 * Get the flags associated with this DIType.
911 * \param DType The DIType.
913 * @see DIType::getFlags()
915 LLVMDIFlags LLVMDITypeGetFlags(LLVMMetadataRef DType);
918 * Create a descriptor for a value range.
919 * \param Builder The DIBuilder.
920 * \param LowerBound Lower bound of the subrange, e.g. 0 for C, 1 for Fortran.
921 * \param Count Count of elements in the subrange.
923 LLVMMetadataRef LLVMDIBuilderGetOrCreateSubrange(LLVMDIBuilderRef Builder,
928 * Create an array of DI Nodes.
929 * \param Builder The DIBuilder.
930 * \param Data The DI Node elements.
931 * \param NumElements Number of DI Node elements.
933 LLVMMetadataRef LLVMDIBuilderGetOrCreateArray(LLVMDIBuilderRef Builder,
934 LLVMMetadataRef *Data,
938 * Create a new descriptor for the specified variable which has a complex
939 * address expression for its address.
940 * \param Builder The DIBuilder.
941 * \param Addr An array of complex address operations.
942 * \param Length Length of the address operation array.
944 LLVMMetadataRef LLVMDIBuilderCreateExpression(LLVMDIBuilderRef Builder,
945 int64_t *Addr, size_t Length);
948 * Create a new descriptor for the specified variable that does not have an
949 * address, but does have a constant value.
950 * \param Builder The DIBuilder.
951 * \param Value The constant value.
954 LLVMDIBuilderCreateConstantValueExpression(LLVMDIBuilderRef Builder,
958 * Create a new descriptor for the specified variable.
959 * \param Scope Variable scope.
960 * \param Name Name of the variable.
961 * \param NameLen The length of the C string passed to \c Name.
962 * \param Linkage Mangled name of the variable.
963 * \param LinkLen The length of the C string passed to \c Linkage.
964 * \param File File where this variable is defined.
965 * \param LineNo Line number.
966 * \param Ty Variable Type.
967 * \param LocalToUnit Boolean flag indicate whether this variable is
968 * externally visible or not.
969 * \param Expr The location of the global relative to the attached
971 * \param Decl Reference to the corresponding declaration.
972 * \param AlignInBits Variable alignment(or 0 if no alignment attr was
976 LLVMDIBuilderCreateGlobalVariableExpression(LLVMDIBuilderRef Builder,
977 LLVMMetadataRef Scope,
978 const char *Name, size_t NameLen,
979 const char *Linkage, size_t LinkLen,
980 LLVMMetadataRef File,
983 LLVMBool LocalToUnit,
984 LLVMMetadataRef Expr,
985 LLVMMetadataRef Decl,
986 uint32_t AlignInBits);
988 * Create a new temporary \c MDNode. Suitable for use in constructing cyclic
989 * \c MDNode structures. A temporary \c MDNode is not uniqued, may be RAUW'd,
990 * and must be manually deleted with \c LLVMDisposeTemporaryMDNode.
991 * \param Ctx The context in which to construct the temporary node.
992 * \param Data The metadata elements.
993 * \param NumElements Number of metadata elements.
995 LLVMMetadataRef LLVMTemporaryMDNode(LLVMContextRef Ctx, LLVMMetadataRef *Data,
999 * Deallocate a temporary node.
1001 * Calls \c replaceAllUsesWith(nullptr) before deleting, so any remaining
1002 * references will be reset.
1003 * \param TempNode The temporary metadata node.
1005 void LLVMDisposeTemporaryMDNode(LLVMMetadataRef TempNode);
1008 * Replace all uses of temporary metadata.
1009 * \param TempTargetMetadata The temporary metadata node.
1010 * \param Replacement The replacement metadata node.
1012 void LLVMMetadataReplaceAllUsesWith(LLVMMetadataRef TempTargetMetadata,
1013 LLVMMetadataRef Replacement);
1016 * Create a new descriptor for the specified global variable that is temporary
1017 * and meant to be RAUWed.
1018 * \param Scope Variable scope.
1019 * \param Name Name of the variable.
1020 * \param NameLen The length of the C string passed to \c Name.
1021 * \param Linkage Mangled name of the variable.
1022 * \param LnkLen The length of the C string passed to \c Linkage.
1023 * \param File File where this variable is defined.
1024 * \param LineNo Line number.
1025 * \param Ty Variable Type.
1026 * \param LocalToUnit Boolean flag indicate whether this variable is
1027 * externally visible or not.
1028 * \param Decl Reference to the corresponding declaration.
1029 * \param AlignInBits Variable alignment(or 0 if no alignment attr was
1033 LLVMDIBuilderCreateTempGlobalVariableFwdDecl(LLVMDIBuilderRef Builder,
1034 LLVMMetadataRef Scope,
1035 const char *Name, size_t NameLen,
1036 const char *Linkage, size_t LnkLen,
1037 LLVMMetadataRef File,
1040 LLVMBool LocalToUnit,
1041 LLVMMetadataRef Decl,
1042 uint32_t AlignInBits);
1045 * Insert a new llvm.dbg.declare intrinsic call before the given instruction.
1046 * \param Builder The DIBuilder.
1047 * \param Storage The storage of the variable to declare.
1048 * \param VarInfo The variable's debug info descriptor.
1049 * \param Expr A complex location expression for the variable.
1050 * \param DebugLoc Debug info location.
1051 * \param Instr Instruction acting as a location for the new intrinsic.
1053 LLVMValueRef LLVMDIBuilderInsertDeclareBefore(
1054 LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
1055 LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr);
1058 * Insert a new llvm.dbg.declare intrinsic call at the end of the given basic
1059 * block. If the basic block has a terminator instruction, the intrinsic is
1060 * inserted before that terminator instruction.
1061 * \param Builder The DIBuilder.
1062 * \param Storage The storage of the variable to declare.
1063 * \param VarInfo The variable's debug info descriptor.
1064 * \param Expr A complex location expression for the variable.
1065 * \param DebugLoc Debug info location.
1066 * \param Block Basic block acting as a location for the new intrinsic.
1068 LLVMValueRef LLVMDIBuilderInsertDeclareAtEnd(
1069 LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
1070 LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block);
1073 * Insert a new llvm.dbg.value intrinsic call before the given instruction.
1074 * \param Builder The DIBuilder.
1075 * \param Val The value of the variable.
1076 * \param VarInfo The variable's debug info descriptor.
1077 * \param Expr A complex location expression for the variable.
1078 * \param DebugLoc Debug info location.
1079 * \param Instr Instruction acting as a location for the new intrinsic.
1081 LLVMValueRef LLVMDIBuilderInsertDbgValueBefore(LLVMDIBuilderRef Builder,
1083 LLVMMetadataRef VarInfo,
1084 LLVMMetadataRef Expr,
1085 LLVMMetadataRef DebugLoc,
1086 LLVMValueRef Instr);
1089 * Insert a new llvm.dbg.value intrinsic call at the end of the given basic
1090 * block. If the basic block has a terminator instruction, the intrinsic is
1091 * inserted before that terminator instruction.
1092 * \param Builder The DIBuilder.
1093 * \param Val The value of the variable.
1094 * \param VarInfo The variable's debug info descriptor.
1095 * \param Expr A complex location expression for the variable.
1096 * \param DebugLoc Debug info location.
1097 * \param Block Basic block acting as a location for the new intrinsic.
1099 LLVMValueRef LLVMDIBuilderInsertDbgValueAtEnd(LLVMDIBuilderRef Builder,
1101 LLVMMetadataRef VarInfo,
1102 LLVMMetadataRef Expr,
1103 LLVMMetadataRef DebugLoc,
1104 LLVMBasicBlockRef Block);
1107 * Create a new descriptor for a local auto variable.
1108 * \param Builder The DIBuilder.
1109 * \param Scope The local scope the variable is declared in.
1110 * \param Name Variable name.
1111 * \param NameLen Length of variable name.
1112 * \param File File where this variable is defined.
1113 * \param LineNo Line number.
1114 * \param Ty Metadata describing the type of the variable.
1115 * \param AlwaysPreserve If true, this descriptor will survive optimizations.
1116 * \param Flags Flags.
1117 * \param AlignInBits Variable alignment.
1119 LLVMMetadataRef LLVMDIBuilderCreateAutoVariable(
1120 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
1121 size_t NameLen, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty,
1122 LLVMBool AlwaysPreserve, LLVMDIFlags Flags, uint32_t AlignInBits);
1125 * Create a new descriptor for a function parameter variable.
1126 * \param Builder The DIBuilder.
1127 * \param Scope The local scope the variable is declared in.
1128 * \param Name Variable name.
1129 * \param NameLen Length of variable name.
1130 * \param ArgNo Unique argument number for this variable; starts at 1.
1131 * \param File File where this variable is defined.
1132 * \param LineNo Line number.
1133 * \param Ty Metadata describing the type of the variable.
1134 * \param AlwaysPreserve If true, this descriptor will survive optimizations.
1135 * \param Flags Flags.
1137 LLVMMetadataRef LLVMDIBuilderCreateParameterVariable(
1138 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
1139 size_t NameLen, unsigned ArgNo, LLVMMetadataRef File, unsigned LineNo,
1140 LLVMMetadataRef Ty, LLVMBool AlwaysPreserve, LLVMDIFlags Flags);
1143 * Get the metadata of the subprogram attached to a function.
1145 * @see llvm::Function::getSubprogram()
1147 LLVMMetadataRef LLVMGetSubprogram(LLVMValueRef Func);
1150 * Set the subprogram attached to a function.
1152 * @see llvm::Function::setSubprogram()
1154 void LLVMSetSubprogram(LLVMValueRef Func, LLVMMetadataRef SP);
1157 } /* end extern "C" */