1565 lines · c
1//===------------ DebugInfo.h - LLVM C API Debug Info API -----------------===//2//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-exception6//7//===----------------------------------------------------------------------===//8///9/// This file declares the C API endpoints for generating DWARF Debug Info10///11/// Note: This interface is experimental. It is *NOT* stable, and may be12/// changed without warning.13///14//===----------------------------------------------------------------------===//15 16#ifndef LLVM_C_DEBUGINFO_H17#define LLVM_C_DEBUGINFO_H18 19#include "llvm-c/ExternC.h"20#include "llvm-c/Types.h"21#include "llvm-c/Visibility.h"22 23LLVM_C_EXTERN_C_BEGIN24 25/**26 * @defgroup LLVMCCoreDebugInfo Debug Information27 * @ingroup LLVMCCore28 *29 * @{30 */31 32/**33 * Debug info flags.34 */35typedef enum {36 LLVMDIFlagZero = 0,37 LLVMDIFlagPrivate = 1,38 LLVMDIFlagProtected = 2,39 LLVMDIFlagPublic = 3,40 LLVMDIFlagFwdDecl = 1 << 2,41 LLVMDIFlagAppleBlock = 1 << 3,42 LLVMDIFlagReservedBit4 = 1 << 4,43 LLVMDIFlagVirtual = 1 << 5,44 LLVMDIFlagArtificial = 1 << 6,45 LLVMDIFlagExplicit = 1 << 7,46 LLVMDIFlagPrototyped = 1 << 8,47 LLVMDIFlagObjcClassComplete = 1 << 9,48 LLVMDIFlagObjectPointer = 1 << 10,49 LLVMDIFlagVector = 1 << 11,50 LLVMDIFlagStaticMember = 1 << 12,51 LLVMDIFlagLValueReference = 1 << 13,52 LLVMDIFlagRValueReference = 1 << 14,53 LLVMDIFlagReserved = 1 << 15,54 LLVMDIFlagSingleInheritance = 1 << 16,55 LLVMDIFlagMultipleInheritance = 2 << 16,56 LLVMDIFlagVirtualInheritance = 3 << 16,57 LLVMDIFlagIntroducedVirtual = 1 << 18,58 LLVMDIFlagBitField = 1 << 19,59 LLVMDIFlagNoReturn = 1 << 20,60 LLVMDIFlagTypePassByValue = 1 << 22,61 LLVMDIFlagTypePassByReference = 1 << 23,62 LLVMDIFlagEnumClass = 1 << 24,63 LLVMDIFlagFixedEnum = LLVMDIFlagEnumClass, // Deprecated.64 LLVMDIFlagThunk = 1 << 25,65 LLVMDIFlagNonTrivial = 1 << 26,66 LLVMDIFlagBigEndian = 1 << 27,67 LLVMDIFlagLittleEndian = 1 << 28,68 LLVMDIFlagIndirectVirtualBase = (1 << 2) | (1 << 5),69 LLVMDIFlagAccessibility = LLVMDIFlagPrivate | LLVMDIFlagProtected |70 LLVMDIFlagPublic,71 LLVMDIFlagPtrToMemberRep = LLVMDIFlagSingleInheritance |72 LLVMDIFlagMultipleInheritance |73 LLVMDIFlagVirtualInheritance74} LLVMDIFlags;75 76/**77 * Source languages known by DWARF.78 */79typedef enum {80 LLVMDWARFSourceLanguageC89,81 LLVMDWARFSourceLanguageC,82 LLVMDWARFSourceLanguageAda83,83 LLVMDWARFSourceLanguageC_plus_plus,84 LLVMDWARFSourceLanguageCobol74,85 LLVMDWARFSourceLanguageCobol85,86 LLVMDWARFSourceLanguageFortran77,87 LLVMDWARFSourceLanguageFortran90,88 LLVMDWARFSourceLanguagePascal83,89 LLVMDWARFSourceLanguageModula2,90 // New in DWARF v3:91 LLVMDWARFSourceLanguageJava,92 LLVMDWARFSourceLanguageC99,93 LLVMDWARFSourceLanguageAda95,94 LLVMDWARFSourceLanguageFortran95,95 LLVMDWARFSourceLanguagePLI,96 LLVMDWARFSourceLanguageObjC,97 LLVMDWARFSourceLanguageObjC_plus_plus,98 LLVMDWARFSourceLanguageUPC,99 LLVMDWARFSourceLanguageD,100 // New in DWARF v4:101 LLVMDWARFSourceLanguagePython,102 // New in DWARF v5:103 LLVMDWARFSourceLanguageOpenCL,104 LLVMDWARFSourceLanguageGo,105 LLVMDWARFSourceLanguageModula3,106 LLVMDWARFSourceLanguageHaskell,107 LLVMDWARFSourceLanguageC_plus_plus_03,108 LLVMDWARFSourceLanguageC_plus_plus_11,109 LLVMDWARFSourceLanguageOCaml,110 LLVMDWARFSourceLanguageRust,111 LLVMDWARFSourceLanguageC11,112 LLVMDWARFSourceLanguageSwift,113 LLVMDWARFSourceLanguageJulia,114 LLVMDWARFSourceLanguageDylan,115 LLVMDWARFSourceLanguageC_plus_plus_14,116 LLVMDWARFSourceLanguageFortran03,117 LLVMDWARFSourceLanguageFortran08,118 LLVMDWARFSourceLanguageRenderScript,119 LLVMDWARFSourceLanguageBLISS,120 LLVMDWARFSourceLanguageKotlin,121 LLVMDWARFSourceLanguageZig,122 LLVMDWARFSourceLanguageCrystal,123 LLVMDWARFSourceLanguageC_plus_plus_17,124 LLVMDWARFSourceLanguageC_plus_plus_20,125 LLVMDWARFSourceLanguageC17,126 LLVMDWARFSourceLanguageFortran18,127 LLVMDWARFSourceLanguageAda2005,128 LLVMDWARFSourceLanguageAda2012,129 LLVMDWARFSourceLanguageHIP,130 LLVMDWARFSourceLanguageAssembly,131 LLVMDWARFSourceLanguageC_sharp,132 LLVMDWARFSourceLanguageMojo,133 LLVMDWARFSourceLanguageGLSL,134 LLVMDWARFSourceLanguageGLSL_ES,135 LLVMDWARFSourceLanguageHLSL,136 LLVMDWARFSourceLanguageOpenCL_CPP,137 LLVMDWARFSourceLanguageCPP_for_OpenCL,138 LLVMDWARFSourceLanguageSYCL,139 LLVMDWARFSourceLanguageRuby,140 LLVMDWARFSourceLanguageMove,141 LLVMDWARFSourceLanguageHylo,142 LLVMDWARFSourceLanguageMetal,143 144 // Vendor extensions:145 LLVMDWARFSourceLanguageMips_Assembler,146 LLVMDWARFSourceLanguageGOOGLE_RenderScript,147 LLVMDWARFSourceLanguageBORLAND_Delphi148} LLVMDWARFSourceLanguage;149 150/**151 * The amount of debug information to emit.152 */153typedef enum {154 LLVMDWARFEmissionNone = 0,155 LLVMDWARFEmissionFull,156 LLVMDWARFEmissionLineTablesOnly157} LLVMDWARFEmissionKind;158 159/**160 * The kind of metadata nodes.161 */162// NOTE: New entries should always be appended instead of matching the order163// in Metadata.def.164enum {165 LLVMMDStringMetadataKind,166 LLVMConstantAsMetadataMetadataKind,167 LLVMLocalAsMetadataMetadataKind,168 LLVMDistinctMDOperandPlaceholderMetadataKind,169 LLVMMDTupleMetadataKind,170 LLVMDILocationMetadataKind,171 LLVMDIExpressionMetadataKind,172 LLVMDIGlobalVariableExpressionMetadataKind,173 LLVMGenericDINodeMetadataKind,174 LLVMDISubrangeMetadataKind,175 LLVMDIEnumeratorMetadataKind,176 LLVMDIBasicTypeMetadataKind,177 LLVMDIDerivedTypeMetadataKind,178 LLVMDICompositeTypeMetadataKind,179 LLVMDISubroutineTypeMetadataKind,180 LLVMDIFileMetadataKind,181 LLVMDICompileUnitMetadataKind,182 LLVMDISubprogramMetadataKind,183 LLVMDILexicalBlockMetadataKind,184 LLVMDILexicalBlockFileMetadataKind,185 LLVMDINamespaceMetadataKind,186 LLVMDIModuleMetadataKind,187 LLVMDITemplateTypeParameterMetadataKind,188 LLVMDITemplateValueParameterMetadataKind,189 LLVMDIGlobalVariableMetadataKind,190 LLVMDILocalVariableMetadataKind,191 LLVMDILabelMetadataKind,192 LLVMDIObjCPropertyMetadataKind,193 LLVMDIImportedEntityMetadataKind,194 LLVMDIMacroMetadataKind,195 LLVMDIMacroFileMetadataKind,196 LLVMDICommonBlockMetadataKind,197 LLVMDIStringTypeMetadataKind,198 LLVMDIGenericSubrangeMetadataKind,199 LLVMDIArgListMetadataKind,200 LLVMDIAssignIDMetadataKind,201 LLVMDISubrangeTypeMetadataKind,202 LLVMDIFixedPointTypeMetadataKind,203};204typedef unsigned LLVMMetadataKind;205 206/**207 * The kind of checksum to emit.208 */209typedef enum { CSK_MD5, CSK_SHA1, CSK_SHA256 } LLVMChecksumKind;210 211/**212 * An LLVM DWARF type encoding.213 */214typedef unsigned LLVMDWARFTypeEncoding;215 216/**217 * Describes the kind of macro declaration used for LLVMDIBuilderCreateMacro.218 * @see llvm::dwarf::MacinfoRecordType219 * @note Values are from DW_MACINFO_* constants in the DWARF specification.220 */221typedef enum {222 LLVMDWARFMacinfoRecordTypeDefine = 0x01,223 LLVMDWARFMacinfoRecordTypeMacro = 0x02,224 LLVMDWARFMacinfoRecordTypeStartFile = 0x03,225 LLVMDWARFMacinfoRecordTypeEndFile = 0x04,226 LLVMDWARFMacinfoRecordTypeVendorExt = 0xff227} LLVMDWARFMacinfoRecordType;228 229/**230 * The current debug metadata version number.231 */232LLVM_C_ABI unsigned LLVMDebugMetadataVersion(void);233 234/**235 * The version of debug metadata that's present in the provided \c Module.236 */237LLVM_C_ABI unsigned LLVMGetModuleDebugMetadataVersion(LLVMModuleRef Module);238 239/**240 * Strip debug info in the module if it exists.241 * To do this, we remove all calls to the debugger intrinsics and any named242 * metadata for debugging. We also remove debug locations for instructions.243 * Return true if module is modified.244 */245LLVM_C_ABI LLVMBool LLVMStripModuleDebugInfo(LLVMModuleRef Module);246 247/**248 * Construct a builder for a module, and do not allow for unresolved nodes249 * attached to the module.250 */251LLVM_C_ABI LLVMDIBuilderRef252LLVMCreateDIBuilderDisallowUnresolved(LLVMModuleRef M);253 254/**255 * Construct a builder for a module and collect unresolved nodes attached256 * to the module in order to resolve cycles during a call to257 * \c LLVMDIBuilderFinalize.258 */259LLVM_C_ABI LLVMDIBuilderRef LLVMCreateDIBuilder(LLVMModuleRef M);260 261/**262 * Deallocates the \c DIBuilder and everything it owns.263 * @note You must call \c LLVMDIBuilderFinalize before this264 */265LLVM_C_ABI void LLVMDisposeDIBuilder(LLVMDIBuilderRef Builder);266 267/**268 * Construct any deferred debug info descriptors.269 */270LLVM_C_ABI void LLVMDIBuilderFinalize(LLVMDIBuilderRef Builder);271 272/**273 * Finalize a specific subprogram.274 * No new variables may be added to this subprogram afterwards.275 */276LLVM_C_ABI void LLVMDIBuilderFinalizeSubprogram(LLVMDIBuilderRef Builder,277 LLVMMetadataRef Subprogram);278 279/**280 * A CompileUnit provides an anchor for all debugging281 * information generated during this instance of compilation.282 * \param Lang Source programming language, eg.283 * \c LLVMDWARFSourceLanguageC99284 * \param FileRef File info.285 * \param Producer Identify the producer of debugging information286 * and code. Usually this is a compiler287 * version string.288 * \param ProducerLen The length of the C string passed to \c Producer.289 * \param isOptimized A boolean flag which indicates whether optimization290 * is enabled or not.291 * \param Flags This string lists command line options. This292 * string is directly embedded in debug info293 * output which may be used by a tool294 * analyzing generated debugging information.295 * \param FlagsLen The length of the C string passed to \c Flags.296 * \param RuntimeVer This indicates runtime version for languages like297 * Objective-C.298 * \param SplitName The name of the file that we'll split debug info299 * out into.300 * \param SplitNameLen The length of the C string passed to \c SplitName.301 * \param Kind The kind of debug information to generate.302 * \param DWOId The DWOId if this is a split skeleton compile unit.303 * \param SplitDebugInlining Whether to emit inline debug info.304 * \param DebugInfoForProfiling Whether to emit extra debug info for305 * profile collection.306 * \param SysRoot The Clang system root (value of -isysroot).307 * \param SysRootLen The length of the C string passed to \c SysRoot.308 * \param SDK The SDK. On Darwin, the last component of the sysroot.309 * \param SDKLen The length of the C string passed to \c SDK.310 */311LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateCompileUnit(312 LLVMDIBuilderRef Builder, LLVMDWARFSourceLanguage Lang,313 LLVMMetadataRef FileRef, const char *Producer, size_t ProducerLen,314 LLVMBool isOptimized, const char *Flags, size_t FlagsLen,315 unsigned RuntimeVer, const char *SplitName, size_t SplitNameLen,316 LLVMDWARFEmissionKind Kind, unsigned DWOId, LLVMBool SplitDebugInlining,317 LLVMBool DebugInfoForProfiling, const char *SysRoot, size_t SysRootLen,318 const char *SDK, size_t SDKLen);319 320/**321 * Create a file descriptor to hold debugging information for a file.322 * \param Builder The \c DIBuilder.323 * \param Filename File name.324 * \param FilenameLen The length of the C string passed to \c Filename.325 * \param Directory Directory.326 * \param DirectoryLen The length of the C string passed to \c Directory.327 */328LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateFile(LLVMDIBuilderRef Builder,329 const char *Filename,330 size_t FilenameLen,331 const char *Directory,332 size_t DirectoryLen);333 334/**335 * Create a file descriptor to hold debugging information for a file.336 * \param Builder The \c DIBuilder.337 * \param Filename File name.338 * \param FilenameLen The length of the C string passed to \c Filename.339 * \param Directory Directory.340 * \param DirectoryLen The length of the C string passed to \c Directory.341 * \param ChecksumKind The kind of checksum. eg MD5, SHA256342 * \param Checksum The checksum.343 * \param ChecksumLen The length of the checksum.344 * \param Souce The embedded source.345 * \param SourceLen The length of the source.346 */347LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateFileWithChecksum(348 LLVMDIBuilderRef Builder, const char *Filename, size_t FilenameLen,349 const char *Directory, size_t DirectoryLen, LLVMChecksumKind ChecksumKind,350 const char *Checksum, size_t ChecksumLen, const char *Source,351 size_t SourceLen);352 353/**354 * Creates a new descriptor for a module with the specified parent scope.355 * \param Builder The \c DIBuilder.356 * \param ParentScope The parent scope containing this module declaration.357 * \param Name Module name.358 * \param NameLen The length of the C string passed to \c Name.359 * \param ConfigMacros A space-separated shell-quoted list of -D macro360 definitions as they would appear on a command line.361 * \param ConfigMacrosLen The length of the C string passed to \c ConfigMacros.362 * \param IncludePath The path to the module map file.363 * \param IncludePathLen The length of the C string passed to \c IncludePath.364 * \param APINotesFile The path to an API notes file for the module.365 * \param APINotesFileLen The length of the C string passed to \c APINotestFile.366 */367LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateModule(368 LLVMDIBuilderRef Builder, LLVMMetadataRef ParentScope, const char *Name,369 size_t NameLen, const char *ConfigMacros, size_t ConfigMacrosLen,370 const char *IncludePath, size_t IncludePathLen, const char *APINotesFile,371 size_t APINotesFileLen);372 373/**374 * Creates a new descriptor for a namespace with the specified parent scope.375 * \param Builder The \c DIBuilder.376 * \param ParentScope The parent scope containing this module declaration.377 * \param Name NameSpace name.378 * \param NameLen The length of the C string passed to \c Name.379 * \param ExportSymbols Whether or not the namespace exports symbols, e.g.380 * this is true of C++ inline namespaces.381 */382LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateNameSpace(383 LLVMDIBuilderRef Builder, LLVMMetadataRef ParentScope, const char *Name,384 size_t NameLen, LLVMBool ExportSymbols);385 386/**387 * Create a new descriptor for the specified subprogram.388 * \param Builder The \c DIBuilder.389 * \param Scope Function scope.390 * \param Name Function name.391 * \param NameLen Length of enumeration name.392 * \param LinkageName Mangled function name.393 * \param LinkageNameLen Length of linkage name.394 * \param File File where this variable is defined.395 * \param LineNo Line number.396 * \param Ty Function type.397 * \param IsLocalToUnit True if this function is not externally visible.398 * \param IsDefinition True if this is a function definition.399 * \param ScopeLine Set to the beginning of the scope this starts400 * \param Flags E.g.: \c LLVMDIFlagLValueReference. These flags are401 * used to emit dwarf attributes.402 * \param IsOptimized True if optimization is ON.403 */404LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateFunction(405 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,406 size_t NameLen, const char *LinkageName, size_t LinkageNameLen,407 LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty,408 LLVMBool IsLocalToUnit, LLVMBool IsDefinition, unsigned ScopeLine,409 LLVMDIFlags Flags, LLVMBool IsOptimized);410 411/**412 * Create a descriptor for a lexical block with the specified parent context.413 * \param Builder The \c DIBuilder.414 * \param Scope Parent lexical block.415 * \param File Source file.416 * \param Line The line in the source file.417 * \param Column The column in the source file.418 */419LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateLexicalBlock(420 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, LLVMMetadataRef File,421 unsigned Line, unsigned Column);422 423/**424 * Create a descriptor for a lexical block with a new file attached.425 * \param Builder The \c DIBuilder.426 * \param Scope Lexical block.427 * \param File Source file.428 * \param Discriminator DWARF path discriminator value.429 */430LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateLexicalBlockFile(431 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, LLVMMetadataRef File,432 unsigned Discriminator);433 434/**435 * Create a descriptor for an imported namespace. Suitable for e.g. C++436 * using declarations.437 * \param Builder The \c DIBuilder.438 * \param Scope The scope this module is imported into439 * \param File File where the declaration is located.440 * \param Line Line number of the declaration.441 */442LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateImportedModuleFromNamespace(443 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, LLVMMetadataRef NS,444 LLVMMetadataRef File, unsigned Line);445 446/**447 * Create a descriptor for an imported module that aliases another448 * imported entity descriptor.449 * \param Builder The \c DIBuilder.450 * \param Scope The scope this module is imported into451 * \param ImportedEntity Previous imported entity to alias.452 * \param File File where the declaration is located.453 * \param Line Line number of the declaration.454 * \param Elements Renamed elements.455 * \param NumElements Number of renamed elements.456 */457LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateImportedModuleFromAlias(458 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope,459 LLVMMetadataRef ImportedEntity, LLVMMetadataRef File, unsigned Line,460 LLVMMetadataRef *Elements, unsigned NumElements);461 462/**463 * Create a descriptor for an imported module.464 * \param Builder The \c DIBuilder.465 * \param Scope The scope this module is imported into466 * \param M The module being imported here467 * \param File File where the declaration is located.468 * \param Line Line number of the declaration.469 * \param Elements Renamed elements.470 * \param NumElements Number of renamed elements.471 */472LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateImportedModuleFromModule(473 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, LLVMMetadataRef M,474 LLVMMetadataRef File, unsigned Line, LLVMMetadataRef *Elements,475 unsigned NumElements);476 477/**478 * Create a descriptor for an imported function, type, or variable. Suitable479 * for e.g. FORTRAN-style USE declarations.480 * \param Builder The DIBuilder.481 * \param Scope The scope this module is imported into.482 * \param Decl The declaration (or definition) of a function, type,483 or variable.484 * \param File File where the declaration is located.485 * \param Line Line number of the declaration.486 * \param Name A name that uniquely identifies this imported487 declaration.488 * \param NameLen The length of the C string passed to \c Name.489 * \param Elements Renamed elements.490 * \param NumElements Number of renamed elements.491 */492LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateImportedDeclaration(493 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, LLVMMetadataRef Decl,494 LLVMMetadataRef File, unsigned Line, const char *Name, size_t NameLen,495 LLVMMetadataRef *Elements, unsigned NumElements);496 497/**498 * Creates a new DebugLocation that describes a source location.499 * \param Line The line in the source file.500 * \param Column The column in the source file.501 * \param Scope The scope in which the location resides.502 * \param InlinedAt The scope where this location was inlined, if at all.503 * (optional).504 * \note If the item to which this location is attached cannot be505 * attributed to a source line, pass 0 for the line and column.506 */507LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateDebugLocation(508 LLVMContextRef Ctx, unsigned Line, unsigned Column, LLVMMetadataRef Scope,509 LLVMMetadataRef InlinedAt);510 511/**512 * Get the line number of this debug location.513 * \param Location The debug location.514 *515 * @see DILocation::getLine()516 */517LLVM_C_ABI unsigned LLVMDILocationGetLine(LLVMMetadataRef Location);518 519/**520 * Get the column number of this debug location.521 * \param Location The debug location.522 *523 * @see DILocation::getColumn()524 */525LLVM_C_ABI unsigned LLVMDILocationGetColumn(LLVMMetadataRef Location);526 527/**528 * Get the local scope associated with this debug location.529 * \param Location The debug location.530 *531 * @see DILocation::getScope()532 */533LLVM_C_ABI LLVMMetadataRef LLVMDILocationGetScope(LLVMMetadataRef Location);534 535/**536 * Get the "inline at" location associated with this debug location.537 * \param Location The debug location.538 *539 * @see DILocation::getInlinedAt()540 */541LLVM_C_ABI LLVMMetadataRef LLVMDILocationGetInlinedAt(LLVMMetadataRef Location);542 543/**544 * Get the metadata of the file associated with a given scope.545 * \param Scope The scope object.546 *547 * @see DIScope::getFile()548 */549LLVM_C_ABI LLVMMetadataRef LLVMDIScopeGetFile(LLVMMetadataRef Scope);550 551/**552 * Get the directory of a given file.553 * \param File The file object.554 * \param Len The length of the returned string.555 *556 * @see DIFile::getDirectory()557 */558LLVM_C_ABI const char *LLVMDIFileGetDirectory(LLVMMetadataRef File,559 unsigned *Len);560 561/**562 * Get the name of a given file.563 * \param File The file object.564 * \param Len The length of the returned string.565 *566 * @see DIFile::getFilename()567 */568LLVM_C_ABI const char *LLVMDIFileGetFilename(LLVMMetadataRef File,569 unsigned *Len);570 571/**572 * Get the source of a given file.573 * \param File The file object.574 * \param Len The length of the returned string.575 *576 * @see DIFile::getSource()577 */578LLVM_C_ABI const char *LLVMDIFileGetSource(LLVMMetadataRef File, unsigned *Len);579 580/**581 * Create a type array.582 * \param Builder The DIBuilder.583 * \param Data The type elements.584 * \param NumElements Number of type elements.585 */586LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderGetOrCreateTypeArray(587 LLVMDIBuilderRef Builder, LLVMMetadataRef *Data, size_t NumElements);588 589/**590 * Create subroutine type.591 * \param Builder The DIBuilder.592 * \param File The file in which the subroutine resides.593 * \param ParameterTypes An array of subroutine parameter types. This594 * includes return type at 0th index.595 * \param NumParameterTypes The number of parameter types in \c ParameterTypes596 * \param Flags E.g.: \c LLVMDIFlagLValueReference.597 * These flags are used to emit dwarf attributes.598 */599LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateSubroutineType(600 LLVMDIBuilderRef Builder, LLVMMetadataRef File,601 LLVMMetadataRef *ParameterTypes, unsigned NumParameterTypes,602 LLVMDIFlags Flags);603 604/**605 * Create debugging information entry for a macro.606 * @param Builder The DIBuilder.607 * @param ParentMacroFile Macro parent (could be NULL).608 * @param Line Source line number where the macro is defined.609 * @param RecordType DW_MACINFO_define or DW_MACINFO_undef.610 * @param Name Macro name.611 * @param NameLen Macro name length.612 * @param Value Macro value.613 * @param ValueLen Macro value length.614 */615LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateMacro(616 LLVMDIBuilderRef Builder, LLVMMetadataRef ParentMacroFile, unsigned Line,617 LLVMDWARFMacinfoRecordType RecordType, const char *Name, size_t NameLen,618 const char *Value, size_t ValueLen);619 620/**621 * Create debugging information temporary entry for a macro file.622 * List of macro node direct children will be calculated by DIBuilder,623 * using the \p ParentMacroFile relationship.624 * @param Builder The DIBuilder.625 * @param ParentMacroFile Macro parent (could be NULL).626 * @param Line Source line number where the macro file is included.627 * @param File File descriptor containing the name of the macro file.628 */629LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateTempMacroFile(630 LLVMDIBuilderRef Builder, LLVMMetadataRef ParentMacroFile, unsigned Line,631 LLVMMetadataRef File);632 633/**634 * Create debugging information entry for an enumerator.635 * @param Builder The DIBuilder.636 * @param Name Enumerator name.637 * @param NameLen Length of enumerator name.638 * @param Value Enumerator value.639 * @param IsUnsigned True if the value is unsigned.640 */641LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateEnumerator(642 LLVMDIBuilderRef Builder, const char *Name, size_t NameLen, int64_t Value,643 LLVMBool IsUnsigned);644 645/**646 * Create debugging information entry for an enumerator of arbitrary precision.647 * @param Builder The DIBuilder.648 * @param Name Enumerator name.649 * @param NameLen Length of enumerator name.650 * @param SizeInBits Number of bits of the value.651 * @param Words The words that make up the value.652 * @param IsUnsigned True if the value is unsigned.653 */654LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateEnumeratorOfArbitraryPrecision(655 LLVMDIBuilderRef Builder, const char *Name, size_t NameLen,656 uint64_t SizeInBits, const uint64_t Words[], LLVMBool IsUnsigned);657 658/**659 * Create debugging information entry for an enumeration.660 * \param Builder The DIBuilder.661 * \param Scope Scope in which this enumeration is defined.662 * \param Name Enumeration name.663 * \param NameLen Length of enumeration name.664 * \param File File where this member is defined.665 * \param LineNumber Line number.666 * \param SizeInBits Member size.667 * \param AlignInBits Member alignment.668 * \param Elements Enumeration elements.669 * \param NumElements Number of enumeration elements.670 * \param ClassTy Underlying type of a C++11/ObjC fixed enum.671 */672LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateEnumerationType(673 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,674 size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,675 uint64_t SizeInBits, uint32_t AlignInBits, LLVMMetadataRef *Elements,676 unsigned NumElements, LLVMMetadataRef ClassTy);677 678/**679 * Create debugging information entry for a union.680 * \param Builder The DIBuilder.681 * \param Scope Scope in which this union is defined.682 * \param Name Union name.683 * \param NameLen Length of union name.684 * \param File File where this member is defined.685 * \param LineNumber Line number.686 * \param SizeInBits Member size.687 * \param AlignInBits Member alignment.688 * \param Flags Flags to encode member attribute, e.g. private689 * \param Elements Union elements.690 * \param NumElements Number of union elements.691 * \param RunTimeLang Optional parameter, Objective-C runtime version.692 * \param UniqueId A unique identifier for the union.693 * \param UniqueIdLen Length of unique identifier.694 */695LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateUnionType(696 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,697 size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,698 uint64_t SizeInBits, uint32_t AlignInBits, LLVMDIFlags Flags,699 LLVMMetadataRef *Elements, unsigned NumElements, unsigned RunTimeLang,700 const char *UniqueId, size_t UniqueIdLen);701 702/**703 * Create debugging information entry for an array.704 * \param Builder The DIBuilder.705 * \param Size Array size.706 * \param AlignInBits Alignment.707 * \param Ty Element type.708 * \param Subscripts Subscripts.709 * \param NumSubscripts Number of subscripts.710 */711LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateArrayType(712 LLVMDIBuilderRef Builder, uint64_t Size, uint32_t AlignInBits,713 LLVMMetadataRef Ty, LLVMMetadataRef *Subscripts, unsigned NumSubscripts);714 715/**716 * Create debugging information entry for a set.717 * \param Builder The DIBuilder.718 * \param Scope The scope in which the set is defined.719 * \param Name A name that uniquely identifies this set.720 * \param NameLen The length of the C string passed to \c Name.721 * \param File File where the set is located.722 * \param Line Line number of the declaration.723 * \param SizeInBits Set size.724 * \param AlignInBits Set alignment.725 * \param BaseTy The base type of the set.726 */727LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateSetType(728 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,729 size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,730 uint64_t SizeInBits, uint32_t AlignInBits, LLVMMetadataRef BaseTy);731 732/**733 * Create a descriptor for a subrange with dynamic bounds.734 * \param Builder The DIBuilder.735 * \param Scope The scope in which the subrange is defined.736 * \param Name A name that uniquely identifies this subrange.737 * \param NameLen The length of the C string passed to \c Name.738 * \param LineNo Line number.739 * \param File File where the subrange is located.740 * \param SizeInBits Member size.741 * \param AlignInBits Member alignment.742 * \param Flags Flags.743 * \param BaseTy The base type of the subrange. eg integer or enumeration744 * \param LowerBound Lower bound of the subrange.745 * \param UpperBound Upper bound of the subrange.746 * \param Stride Stride of the subrange.747 * \param Bias Bias of the subrange.748 */749LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateSubrangeType(750 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,751 size_t NameLen, unsigned LineNo, LLVMMetadataRef File, uint64_t SizeInBits,752 uint32_t AlignInBits, LLVMDIFlags Flags, LLVMMetadataRef BaseTy,753 LLVMMetadataRef LowerBound, LLVMMetadataRef UpperBound,754 LLVMMetadataRef Stride, LLVMMetadataRef Bias);755 756/**757 * Create debugging information entry for a dynamic array.758 * \param Builder The DIBuilder.759 * \param Size Array size.760 * \param AlignInBits Alignment.761 * \param Ty Element type.762 * \param Subscripts Subscripts.763 * \param NumSubscripts Number of subscripts.764 * \param DataLocation DataLocation. (DIVariable, DIExpression or NULL)765 * \param Associated Associated. (DIVariable, DIExpression or NULL)766 * \param Allocated Allocated. (DIVariable, DIExpression or NULL)767 * \param Rank Rank. (DIVariable, DIExpression or NULL)768 * \param BitStride BitStride.769 */770LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateDynamicArrayType(771 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,772 size_t NameLen, unsigned LineNo, LLVMMetadataRef File, uint64_t Size,773 uint32_t AlignInBits, LLVMMetadataRef Ty, LLVMMetadataRef *Subscripts,774 unsigned NumSubscripts, LLVMMetadataRef DataLocation,775 LLVMMetadataRef Associated, LLVMMetadataRef Allocated, LLVMMetadataRef Rank,776 LLVMMetadataRef BitStride);777 778/**779 * Replace arrays.780 *781 * @see DIBuilder::replaceArrays()782 */783LLVM_C_ABI void LLVMReplaceArrays(LLVMDIBuilderRef Builder, LLVMMetadataRef *T,784 LLVMMetadataRef *Elements,785 unsigned NumElements);786 787/**788 * Create debugging information entry for a vector type.789 * \param Builder The DIBuilder.790 * \param Size Vector size.791 * \param AlignInBits Alignment.792 * \param Ty Element type.793 * \param Subscripts Subscripts.794 * \param NumSubscripts Number of subscripts.795 */796LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateVectorType(797 LLVMDIBuilderRef Builder, uint64_t Size, uint32_t AlignInBits,798 LLVMMetadataRef Ty, LLVMMetadataRef *Subscripts, unsigned NumSubscripts);799 800/**801 * Create a DWARF unspecified type.802 * \param Builder The DIBuilder.803 * \param Name The unspecified type's name.804 * \param NameLen Length of type name.805 */806LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateUnspecifiedType(807 LLVMDIBuilderRef Builder, const char *Name, size_t NameLen);808 809/**810 * Create debugging information entry for a basic811 * type.812 * \param Builder The DIBuilder.813 * \param Name Type name.814 * \param NameLen Length of type name.815 * \param SizeInBits Size of the type.816 * \param Encoding DWARF encoding code, e.g. \c LLVMDWARFTypeEncoding_float.817 * \param Flags Flags to encode optional attribute like endianity818 */819LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateBasicType(820 LLVMDIBuilderRef Builder, const char *Name, size_t NameLen,821 uint64_t SizeInBits, LLVMDWARFTypeEncoding Encoding, LLVMDIFlags Flags);822 823/**824 * Create debugging information entry for a pointer.825 * \param Builder The DIBuilder.826 * \param PointeeTy Type pointed by this pointer.827 * \param SizeInBits Size.828 * \param AlignInBits Alignment. (optional, pass 0 to ignore)829 * \param AddressSpace DWARF address space. (optional, pass 0 to ignore)830 * \param Name Pointer type name. (optional)831 * \param NameLen Length of pointer type name. (optional)832 */833LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreatePointerType(834 LLVMDIBuilderRef Builder, LLVMMetadataRef PointeeTy, uint64_t SizeInBits,835 uint32_t AlignInBits, unsigned AddressSpace, const char *Name,836 size_t NameLen);837 838/**839 * Create debugging information entry for a struct.840 * \param Builder The DIBuilder.841 * \param Scope Scope in which this struct is defined.842 * \param Name Struct name.843 * \param NameLen Struct name length.844 * \param File File where this member is defined.845 * \param LineNumber Line number.846 * \param SizeInBits Member size.847 * \param AlignInBits Member alignment.848 * \param Flags Flags to encode member attribute, e.g. private849 * \param Elements Struct elements.850 * \param NumElements Number of struct elements.851 * \param RunTimeLang Optional parameter, Objective-C runtime version.852 * \param VTableHolder The object containing the vtable for the struct.853 * \param UniqueId A unique identifier for the struct.854 * \param UniqueIdLen Length of the unique identifier for the struct.855 */856LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateStructType(857 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,858 size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,859 uint64_t SizeInBits, uint32_t AlignInBits, LLVMDIFlags Flags,860 LLVMMetadataRef DerivedFrom, LLVMMetadataRef *Elements,861 unsigned NumElements, unsigned RunTimeLang, LLVMMetadataRef VTableHolder,862 const char *UniqueId, size_t UniqueIdLen);863 864/**865 * Create debugging information entry for a member.866 * \param Builder The DIBuilder.867 * \param Scope Member scope.868 * \param Name Member name.869 * \param NameLen Length of member name.870 * \param File File where this member is defined.871 * \param LineNo Line number.872 * \param SizeInBits Member size.873 * \param AlignInBits Member alignment.874 * \param OffsetInBits Member offset.875 * \param Flags Flags to encode member attribute, e.g. private876 * \param Ty Parent type.877 */878LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateMemberType(879 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,880 size_t NameLen, LLVMMetadataRef File, unsigned LineNo, uint64_t SizeInBits,881 uint32_t AlignInBits, uint64_t OffsetInBits, LLVMDIFlags Flags,882 LLVMMetadataRef Ty);883 884/**885 * Create debugging information entry for a886 * C++ static data member.887 * \param Builder The DIBuilder.888 * \param Scope Member scope.889 * \param Name Member name.890 * \param NameLen Length of member name.891 * \param File File where this member is declared.892 * \param LineNumber Line number.893 * \param Type Type of the static member.894 * \param Flags Flags to encode member attribute, e.g. private.895 * \param ConstantVal Const initializer of the member.896 * \param AlignInBits Member alignment.897 */898LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateStaticMemberType(899 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,900 size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,901 LLVMMetadataRef Type, LLVMDIFlags Flags, LLVMValueRef ConstantVal,902 uint32_t AlignInBits);903 904/**905 * Create debugging information entry for a pointer to member.906 * \param Builder The DIBuilder.907 * \param PointeeType Type pointed to by this pointer.908 * \param ClassType Type for which this pointer points to members of.909 * \param SizeInBits Size.910 * \param AlignInBits Alignment.911 * \param Flags Flags.912 */913LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateMemberPointerType(914 LLVMDIBuilderRef Builder, LLVMMetadataRef PointeeType,915 LLVMMetadataRef ClassType, uint64_t SizeInBits, uint32_t AlignInBits,916 LLVMDIFlags Flags);917/**918 * Create debugging information entry for Objective-C instance variable.919 * \param Builder The DIBuilder.920 * \param Name Member name.921 * \param NameLen The length of the C string passed to \c Name.922 * \param File File where this member is defined.923 * \param LineNo Line number.924 * \param SizeInBits Member size.925 * \param AlignInBits Member alignment.926 * \param OffsetInBits Member offset.927 * \param Flags Flags to encode member attribute, e.g. private928 * \param Ty Parent type.929 * \param PropertyNode Property associated with this ivar.930 */931LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateObjCIVar(932 LLVMDIBuilderRef Builder, const char *Name, size_t NameLen,933 LLVMMetadataRef File, unsigned LineNo, uint64_t SizeInBits,934 uint32_t AlignInBits, uint64_t OffsetInBits, LLVMDIFlags Flags,935 LLVMMetadataRef Ty, LLVMMetadataRef PropertyNode);936 937/**938 * Create debugging information entry for Objective-C property.939 * \param Builder The DIBuilder.940 * \param Name Property name.941 * \param NameLen The length of the C string passed to \c Name.942 * \param File File where this property is defined.943 * \param LineNo Line number.944 * \param GetterName Name of the Objective C property getter selector.945 * \param GetterNameLen The length of the C string passed to \c GetterName.946 * \param SetterName Name of the Objective C property setter selector.947 * \param SetterNameLen The length of the C string passed to \c SetterName.948 * \param PropertyAttributes Objective C property attributes.949 * \param Ty Type.950 */951LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateObjCProperty(952 LLVMDIBuilderRef Builder, const char *Name, size_t NameLen,953 LLVMMetadataRef File, unsigned LineNo, const char *GetterName,954 size_t GetterNameLen, const char *SetterName, size_t SetterNameLen,955 unsigned PropertyAttributes, LLVMMetadataRef Ty);956 957/**958 * Create a uniqued DIType* clone with FlagObjectPointer. If \c Implicit959 * is true, then also set FlagArtificial.960 * \param Builder The DIBuilder.961 * \param Type The underlying type to which this pointer points.962 * \param Implicit Indicates whether this pointer was implicitly generated963 * (i.e., not spelled out in source).964 */965LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateObjectPointerType(966 LLVMDIBuilderRef Builder, LLVMMetadataRef Type, LLVMBool Implicit);967 968/**969 * Create debugging information entry for a qualified970 * type, e.g. 'const int'.971 * \param Builder The DIBuilder.972 * \param Tag Tag identifying type,973 * e.g. LLVMDWARFTypeQualifier_volatile_type974 * \param Type Base Type.975 */976LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateQualifiedType(977 LLVMDIBuilderRef Builder, unsigned Tag, LLVMMetadataRef Type);978 979/**980 * Create debugging information entry for a c++981 * style reference or rvalue reference type.982 * \param Builder The DIBuilder.983 * \param Tag Tag identifying type,984 * \param Type Base Type.985 */986LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateReferenceType(987 LLVMDIBuilderRef Builder, unsigned Tag, LLVMMetadataRef Type);988 989/**990 * Create C++11 nullptr type.991 * \param Builder The DIBuilder.992 */993LLVM_C_ABI LLVMMetadataRef994LLVMDIBuilderCreateNullPtrType(LLVMDIBuilderRef Builder);995 996/**997 * Create debugging information entry for a typedef.998 * \param Builder The DIBuilder.999 * \param Type Original type.1000 * \param Name Typedef name.1001 * \param File File where this type is defined.1002 * \param LineNo Line number.1003 * \param Scope The surrounding context for the typedef.1004 */1005LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateTypedef(1006 LLVMDIBuilderRef Builder, LLVMMetadataRef Type, const char *Name,1007 size_t NameLen, LLVMMetadataRef File, unsigned LineNo,1008 LLVMMetadataRef Scope, uint32_t AlignInBits);1009 1010/**1011 * Create debugging information entry to establish inheritance relationship1012 * between two types.1013 * \param Builder The DIBuilder.1014 * \param Ty Original type.1015 * \param BaseTy Base type. Ty is inherits from base.1016 * \param BaseOffset Base offset.1017 * \param VBPtrOffset Virtual base pointer offset.1018 * \param Flags Flags to describe inheritance attribute, e.g. private1019 */1020LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateInheritance(1021 LLVMDIBuilderRef Builder, LLVMMetadataRef Ty, LLVMMetadataRef BaseTy,1022 uint64_t BaseOffset, uint32_t VBPtrOffset, LLVMDIFlags Flags);1023 1024/**1025 * Create a permanent forward-declared type.1026 * \param Builder The DIBuilder.1027 * \param Tag A unique tag for this type.1028 * \param Name Type name.1029 * \param NameLen Length of type name.1030 * \param Scope Type scope.1031 * \param File File where this type is defined.1032 * \param Line Line number where this type is defined.1033 * \param RuntimeLang Indicates runtime version for languages like1034 * Objective-C.1035 * \param SizeInBits Member size.1036 * \param AlignInBits Member alignment.1037 * \param UniqueIdentifier A unique identifier for the type.1038 * \param UniqueIdentifierLen Length of the unique identifier.1039 */1040LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateForwardDecl(1041 LLVMDIBuilderRef Builder, unsigned Tag, const char *Name, size_t NameLen,1042 LLVMMetadataRef Scope, LLVMMetadataRef File, unsigned Line,1043 unsigned RuntimeLang, uint64_t SizeInBits, uint32_t AlignInBits,1044 const char *UniqueIdentifier, size_t UniqueIdentifierLen);1045 1046/**1047 * Create a temporary forward-declared type.1048 * \param Builder The DIBuilder.1049 * \param Tag A unique tag for this type.1050 * \param Name Type name.1051 * \param NameLen Length of type name.1052 * \param Scope Type scope.1053 * \param File File where this type is defined.1054 * \param Line Line number where this type is defined.1055 * \param RuntimeLang Indicates runtime version for languages like1056 * Objective-C.1057 * \param SizeInBits Member size.1058 * \param AlignInBits Member alignment.1059 * \param Flags Flags.1060 * \param UniqueIdentifier A unique identifier for the type.1061 * \param UniqueIdentifierLen Length of the unique identifier.1062 */1063LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateReplaceableCompositeType(1064 LLVMDIBuilderRef Builder, unsigned Tag, const char *Name, size_t NameLen,1065 LLVMMetadataRef Scope, LLVMMetadataRef File, unsigned Line,1066 unsigned RuntimeLang, uint64_t SizeInBits, uint32_t AlignInBits,1067 LLVMDIFlags Flags, const char *UniqueIdentifier,1068 size_t UniqueIdentifierLen);1069 1070/**1071 * Create debugging information entry for a bit field member.1072 * \param Builder The DIBuilder.1073 * \param Scope Member scope.1074 * \param Name Member name.1075 * \param NameLen Length of member name.1076 * \param File File where this member is defined.1077 * \param LineNumber Line number.1078 * \param SizeInBits Member size.1079 * \param OffsetInBits Member offset.1080 * \param StorageOffsetInBits Member storage offset.1081 * \param Flags Flags to encode member attribute.1082 * \param Type Parent type.1083 */1084LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateBitFieldMemberType(1085 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,1086 size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,1087 uint64_t SizeInBits, uint64_t OffsetInBits, uint64_t StorageOffsetInBits,1088 LLVMDIFlags Flags, LLVMMetadataRef Type);1089 1090/**1091 * Create debugging information entry for a class.1092 * \param Scope Scope in which this class is defined.1093 * \param Name Class name.1094 * \param NameLen The length of the C string passed to \c Name.1095 * \param File File where this member is defined.1096 * \param LineNumber Line number.1097 * \param SizeInBits Member size.1098 * \param AlignInBits Member alignment.1099 * \param OffsetInBits Member offset.1100 * \param Flags Flags to encode member attribute, e.g. private.1101 * \param DerivedFrom Debug info of the base class of this type.1102 * \param Elements Class members.1103 * \param NumElements Number of class elements.1104 * \param VTableHolder Debug info of the base class that contains vtable1105 * for this type. This is used in1106 * DW_AT_containing_type. See DWARF documentation1107 * for more info.1108 * \param TemplateParamsNode Template type parameters.1109 * \param UniqueIdentifier A unique identifier for the type.1110 * \param UniqueIdentifierLen Length of the unique identifier.1111 */1112LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateClassType(1113 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,1114 size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,1115 uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,1116 LLVMDIFlags Flags, LLVMMetadataRef DerivedFrom, LLVMMetadataRef *Elements,1117 unsigned NumElements, LLVMMetadataRef VTableHolder,1118 LLVMMetadataRef TemplateParamsNode, const char *UniqueIdentifier,1119 size_t UniqueIdentifierLen);1120 1121/**1122 * Create a uniqued DIType* clone with FlagArtificial set.1123 * \param Builder The DIBuilder.1124 * \param Type The underlying type.1125 */1126LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateArtificialType(1127 LLVMDIBuilderRef Builder, LLVMMetadataRef Type);1128 1129/**1130 * Get the name of this DIType.1131 * \param DType The DIType.1132 * \param Length The length of the returned string.1133 *1134 * @see DIType::getName()1135 */1136LLVM_C_ABI const char *LLVMDITypeGetName(LLVMMetadataRef DType, size_t *Length);1137 1138/**1139 * Get the size of this DIType in bits.1140 * \param DType The DIType.1141 *1142 * @see DIType::getSizeInBits()1143 */1144LLVM_C_ABI uint64_t LLVMDITypeGetSizeInBits(LLVMMetadataRef DType);1145 1146/**1147 * Get the offset of this DIType in bits.1148 * \param DType The DIType.1149 *1150 * @see DIType::getOffsetInBits()1151 */1152LLVM_C_ABI uint64_t LLVMDITypeGetOffsetInBits(LLVMMetadataRef DType);1153 1154/**1155 * Get the alignment of this DIType in bits.1156 * \param DType The DIType.1157 *1158 * @see DIType::getAlignInBits()1159 */1160LLVM_C_ABI uint32_t LLVMDITypeGetAlignInBits(LLVMMetadataRef DType);1161 1162/**1163 * Get the source line where this DIType is declared.1164 * \param DType The DIType.1165 *1166 * @see DIType::getLine()1167 */1168LLVM_C_ABI unsigned LLVMDITypeGetLine(LLVMMetadataRef DType);1169 1170/**1171 * Get the flags associated with this DIType.1172 * \param DType The DIType.1173 *1174 * @see DIType::getFlags()1175 */1176LLVM_C_ABI LLVMDIFlags LLVMDITypeGetFlags(LLVMMetadataRef DType);1177 1178/**1179 * Create a descriptor for a value range.1180 * \param Builder The DIBuilder.1181 * \param LowerBound Lower bound of the subrange, e.g. 0 for C, 1 for Fortran.1182 * \param Count Count of elements in the subrange.1183 */1184LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderGetOrCreateSubrange(1185 LLVMDIBuilderRef Builder, int64_t LowerBound, int64_t Count);1186 1187/**1188 * Create an array of DI Nodes.1189 * \param Builder The DIBuilder.1190 * \param Data The DI Node elements.1191 * \param NumElements Number of DI Node elements.1192 */1193LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderGetOrCreateArray(1194 LLVMDIBuilderRef Builder, LLVMMetadataRef *Data, size_t NumElements);1195 1196/**1197 * Create a new descriptor for the specified variable which has a complex1198 * address expression for its address.1199 * \param Builder The DIBuilder.1200 * \param Addr An array of complex address operations.1201 * \param Length Length of the address operation array.1202 */1203LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateExpression(1204 LLVMDIBuilderRef Builder, uint64_t *Addr, size_t Length);1205 1206/**1207 * Create a new descriptor for the specified variable that does not have an1208 * address, but does have a constant value.1209 * \param Builder The DIBuilder.1210 * \param Value The constant value.1211 */1212LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateConstantValueExpression(1213 LLVMDIBuilderRef Builder, uint64_t Value);1214 1215/**1216 * Create a new descriptor for the specified variable.1217 * \param Scope Variable scope.1218 * \param Name Name of the variable.1219 * \param NameLen The length of the C string passed to \c Name.1220 * \param Linkage Mangled name of the variable.1221 * \param LinkLen The length of the C string passed to \c Linkage.1222 * \param File File where this variable is defined.1223 * \param LineNo Line number.1224 * \param Ty Variable Type.1225 * \param LocalToUnit Boolean flag indicate whether this variable is1226 * externally visible or not.1227 * \param Expr The location of the global relative to the attached1228 * GlobalVariable.1229 * \param Decl Reference to the corresponding declaration.1230 * variables.1231 * \param AlignInBits Variable alignment(or 0 if no alignment attr was1232 * specified)1233 */1234LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateGlobalVariableExpression(1235 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,1236 size_t NameLen, const char *Linkage, size_t LinkLen, LLVMMetadataRef File,1237 unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit,1238 LLVMMetadataRef Expr, LLVMMetadataRef Decl, uint32_t AlignInBits);1239 1240/**1241 * Get the dwarf::Tag of a DINode1242 */1243LLVM_C_ABI uint16_t LLVMGetDINodeTag(LLVMMetadataRef MD);1244 1245/**1246 * Retrieves the \c DIVariable associated with this global variable expression.1247 * \param GVE The global variable expression.1248 *1249 * @see llvm::DIGlobalVariableExpression::getVariable()1250 */1251LLVM_C_ABI LLVMMetadataRef1252LLVMDIGlobalVariableExpressionGetVariable(LLVMMetadataRef GVE);1253 1254/**1255 * Retrieves the \c DIExpression associated with this global variable expression.1256 * \param GVE The global variable expression.1257 *1258 * @see llvm::DIGlobalVariableExpression::getExpression()1259 */1260LLVM_C_ABI LLVMMetadataRef1261LLVMDIGlobalVariableExpressionGetExpression(LLVMMetadataRef GVE);1262 1263/**1264 * Get the metadata of the file associated with a given variable.1265 * \param Var The variable object.1266 *1267 * @see DIVariable::getFile()1268 */1269LLVM_C_ABI LLVMMetadataRef LLVMDIVariableGetFile(LLVMMetadataRef Var);1270 1271/**1272 * Get the metadata of the scope associated with a given variable.1273 * \param Var The variable object.1274 *1275 * @see DIVariable::getScope()1276 */1277LLVM_C_ABI LLVMMetadataRef LLVMDIVariableGetScope(LLVMMetadataRef Var);1278 1279/**1280 * Get the source line where this \c DIVariable is declared.1281 * \param Var The DIVariable.1282 *1283 * @see DIVariable::getLine()1284 */1285LLVM_C_ABI unsigned LLVMDIVariableGetLine(LLVMMetadataRef Var);1286 1287/**1288 * Create a new temporary \c MDNode. Suitable for use in constructing cyclic1289 * \c MDNode structures. A temporary \c MDNode is not uniqued, may be RAUW'd,1290 * and must be manually deleted with \c LLVMDisposeTemporaryMDNode.1291 * \param Ctx The context in which to construct the temporary node.1292 * \param Data The metadata elements.1293 * \param NumElements Number of metadata elements.1294 */1295LLVM_C_ABI LLVMMetadataRef LLVMTemporaryMDNode(LLVMContextRef Ctx,1296 LLVMMetadataRef *Data,1297 size_t NumElements);1298 1299/**1300 * Deallocate a temporary node.1301 *1302 * Calls \c replaceAllUsesWith(nullptr) before deleting, so any remaining1303 * references will be reset.1304 * \param TempNode The temporary metadata node.1305 */1306LLVM_C_ABI void LLVMDisposeTemporaryMDNode(LLVMMetadataRef TempNode);1307 1308/**1309 * Replace all uses of temporary metadata.1310 * \param TempTargetMetadata The temporary metadata node.1311 * \param Replacement The replacement metadata node.1312 */1313LLVM_C_ABI void1314LLVMMetadataReplaceAllUsesWith(LLVMMetadataRef TempTargetMetadata,1315 LLVMMetadataRef Replacement);1316 1317/**1318 * Create a new descriptor for the specified global variable that is temporary1319 * and meant to be RAUWed.1320 * \param Scope Variable scope.1321 * \param Name Name of the variable.1322 * \param NameLen The length of the C string passed to \c Name.1323 * \param Linkage Mangled name of the variable.1324 * \param LnkLen The length of the C string passed to \c Linkage.1325 * \param File File where this variable is defined.1326 * \param LineNo Line number.1327 * \param Ty Variable Type.1328 * \param LocalToUnit Boolean flag indicate whether this variable is1329 * externally visible or not.1330 * \param Decl Reference to the corresponding declaration.1331 * \param AlignInBits Variable alignment(or 0 if no alignment attr was1332 * specified)1333 */1334LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateTempGlobalVariableFwdDecl(1335 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,1336 size_t NameLen, const char *Linkage, size_t LnkLen, LLVMMetadataRef File,1337 unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit,1338 LLVMMetadataRef Decl, uint32_t AlignInBits);1339 1340/**1341 * Only use in "new debug format" (LLVMIsNewDbgInfoFormat() is true).1342 * See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes1343 *1344 * The debug format can be switched later after inserting the records using1345 * LLVMSetIsNewDbgInfoFormat, if needed for legacy or transitionary reasons.1346 *1347 * Insert a Declare DbgRecord before the given instruction.1348 * \param Builder The DIBuilder.1349 * \param Storage The storage of the variable to declare.1350 * \param VarInfo The variable's debug info descriptor.1351 * \param Expr A complex location expression for the variable.1352 * \param DebugLoc Debug info location.1353 * \param Instr Instruction acting as a location for the new record.1354 */1355LLVM_C_ABI LLVMDbgRecordRef LLVMDIBuilderInsertDeclareRecordBefore(1356 LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,1357 LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr);1358 1359/**1360 * Only use in "new debug format" (LLVMIsNewDbgInfoFormat() is true).1361 * See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes1362 *1363 * The debug format can be switched later after inserting the records using1364 * LLVMSetIsNewDbgInfoFormat, if needed for legacy or transitionary reasons.1365 *1366 * Insert a Declare DbgRecord at the end of the given basic block. If the basic1367 * block has a terminator instruction, the record is inserted before that1368 * terminator instruction.1369 * \param Builder The DIBuilder.1370 * \param Storage The storage of the variable to declare.1371 * \param VarInfo The variable's debug info descriptor.1372 * \param Expr A complex location expression for the variable.1373 * \param DebugLoc Debug info location.1374 * \param Block Basic block acting as a location for the new record.1375 */1376LLVM_C_ABI LLVMDbgRecordRef LLVMDIBuilderInsertDeclareRecordAtEnd(1377 LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,1378 LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block);1379 1380/**1381 * Only use in "new debug format" (LLVMIsNewDbgInfoFormat() is true).1382 * See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes1383 *1384 * The debug format can be switched later after inserting the records using1385 * LLVMSetIsNewDbgInfoFormat, if needed for legacy or transitionary reasons.1386 *1387 * Insert a new debug record before the given instruction.1388 * \param Builder The DIBuilder.1389 * \param Val The value of the variable.1390 * \param VarInfo The variable's debug info descriptor.1391 * \param Expr A complex location expression for the variable.1392 * \param DebugLoc Debug info location.1393 * \param Instr Instruction acting as a location for the new record.1394 */1395LLVM_C_ABI LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueRecordBefore(1396 LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,1397 LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr);1398 1399/**1400 * Only use in "new debug format" (LLVMIsNewDbgInfoFormat() is true).1401 * See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes1402 *1403 * The debug format can be switched later after inserting the records using1404 * LLVMSetIsNewDbgInfoFormat, if needed for legacy or transitionary reasons.1405 *1406 * Insert a new debug record at the end of the given basic block. If the1407 * basic block has a terminator instruction, the record is inserted before1408 * that terminator instruction.1409 * \param Builder The DIBuilder.1410 * \param Val The value of the variable.1411 * \param VarInfo The variable's debug info descriptor.1412 * \param Expr A complex location expression for the variable.1413 * \param DebugLoc Debug info location.1414 * \param Block Basic block acting as a location for the new record.1415 */1416LLVM_C_ABI LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueRecordAtEnd(1417 LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,1418 LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block);1419 1420/**1421 * Create a new descriptor for a local auto variable.1422 * \param Builder The DIBuilder.1423 * \param Scope The local scope the variable is declared in.1424 * \param Name Variable name.1425 * \param NameLen Length of variable name.1426 * \param File File where this variable is defined.1427 * \param LineNo Line number.1428 * \param Ty Metadata describing the type of the variable.1429 * \param AlwaysPreserve If true, this descriptor will survive optimizations.1430 * \param Flags Flags.1431 * \param AlignInBits Variable alignment.1432 */1433LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateAutoVariable(1434 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,1435 size_t NameLen, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty,1436 LLVMBool AlwaysPreserve, LLVMDIFlags Flags, uint32_t AlignInBits);1437 1438/**1439 * Create a new descriptor for a function parameter variable.1440 * \param Builder The DIBuilder.1441 * \param Scope The local scope the variable is declared in.1442 * \param Name Variable name.1443 * \param NameLen Length of variable name.1444 * \param ArgNo Unique argument number for this variable; starts at 1.1445 * \param File File where this variable is defined.1446 * \param LineNo Line number.1447 * \param Ty Metadata describing the type of the variable.1448 * \param AlwaysPreserve If true, this descriptor will survive optimizations.1449 * \param Flags Flags.1450 */1451LLVM_C_ABI LLVMMetadataRef LLVMDIBuilderCreateParameterVariable(1452 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,1453 size_t NameLen, unsigned ArgNo, LLVMMetadataRef File, unsigned LineNo,1454 LLVMMetadataRef Ty, LLVMBool AlwaysPreserve, LLVMDIFlags Flags);1455 1456/**1457 * Get the metadata of the subprogram attached to a function.1458 *1459 * @see llvm::Function::getSubprogram()1460 */1461LLVM_C_ABI LLVMMetadataRef LLVMGetSubprogram(LLVMValueRef Func);1462 1463/**1464 * Set the subprogram attached to a function.1465 *1466 * @see llvm::Function::setSubprogram()1467 */1468LLVM_C_ABI void LLVMSetSubprogram(LLVMValueRef Func, LLVMMetadataRef SP);1469 1470/**1471 * Get the line associated with a given subprogram.1472 * \param Subprogram The subprogram object.1473 *1474 * @see DISubprogram::getLine()1475 */1476LLVM_C_ABI unsigned LLVMDISubprogramGetLine(LLVMMetadataRef Subprogram);1477 1478/**1479 * Replace the subprogram subroutine type.1480 * \param Subprogram The subprogram object.1481 * \param SubroutineType The new subroutine type.1482 *1483 * @see DISubprogram::replaceType()1484 */1485LLVM_C_ABI void LLVMDISubprogramReplaceType(LLVMMetadataRef Subprogram,1486 LLVMMetadataRef SubroutineType);1487 1488/**1489 * Get the debug location for the given instruction.1490 *1491 * @see llvm::Instruction::getDebugLoc()1492 */1493LLVM_C_ABI LLVMMetadataRef LLVMInstructionGetDebugLoc(LLVMValueRef Inst);1494 1495/**1496 * Set the debug location for the given instruction.1497 *1498 * To clear the location metadata of the given instruction, pass NULL to \p Loc.1499 *1500 * @see llvm::Instruction::setDebugLoc()1501 */1502LLVM_C_ABI void LLVMInstructionSetDebugLoc(LLVMValueRef Inst,1503 LLVMMetadataRef Loc);1504 1505/**1506 * Create a new descriptor for a label1507 *1508 * \param Builder The DIBuilder.1509 * \param Scope The scope to create the label in.1510 * \param Name Variable name.1511 * \param NameLen Length of variable name.1512 * \param File The file to create the label in.1513 * \param LineNo Line Number.1514 * \param AlwaysPreserve Preserve the label regardless of optimization.1515 *1516 * @see llvm::DIBuilder::createLabel()1517 */1518LLVM_C_ABI LLVMMetadataRef1519LLVMDIBuilderCreateLabel(LLVMDIBuilderRef Builder, LLVMMetadataRef Context,1520 const char *Name, size_t NameLen, LLVMMetadataRef File,1521 unsigned LineNo, LLVMBool AlwaysPreserve);1522 1523/**1524 * Insert a new llvm.dbg.label intrinsic call1525 *1526 * \param Builder The DIBuilder.1527 * \param LabelInfo The Label's debug info descriptor1528 * \param Location The debug info location1529 * \param InsertBefore Location for the new intrinsic.1530 *1531 * @see llvm::DIBuilder::insertLabel()1532 */1533LLVM_C_ABI LLVMDbgRecordRef LLVMDIBuilderInsertLabelBefore(1534 LLVMDIBuilderRef Builder, LLVMMetadataRef LabelInfo,1535 LLVMMetadataRef Location, LLVMValueRef InsertBefore);1536 1537/**1538 * Insert a new llvm.dbg.label intrinsic call1539 *1540 * \param Builder The DIBuilder.1541 * \param LabelInfo The Label's debug info descriptor1542 * \param Location The debug info location1543 * \param InsertAtEnd Location for the new intrinsic.1544 *1545 * @see llvm::DIBuilder::insertLabel()1546 */1547LLVM_C_ABI LLVMDbgRecordRef LLVMDIBuilderInsertLabelAtEnd(1548 LLVMDIBuilderRef Builder, LLVMMetadataRef LabelInfo,1549 LLVMMetadataRef Location, LLVMBasicBlockRef InsertAtEnd);1550 1551/**1552 * Obtain the enumerated type of a Metadata instance.1553 *1554 * @see llvm::Metadata::getMetadataID()1555 */1556LLVM_C_ABI LLVMMetadataKind LLVMGetMetadataKind(LLVMMetadataRef Metadata);1557 1558/**1559 * @}1560 */1561 1562LLVM_C_EXTERN_C_END1563 1564#endif1565