Path: blob/main/contrib/llvm-project/llvm/include/llvm-c/DebugInfo.h
35233 views
//===------------ DebugInfo.h - LLVM C API Debug Info API -----------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7///8/// This file declares the C API endpoints for generating DWARF Debug Info9///10/// Note: This interface is experimental. It is *NOT* stable, and may be11/// changed without warning.12///13//===----------------------------------------------------------------------===//1415#ifndef LLVM_C_DEBUGINFO_H16#define LLVM_C_DEBUGINFO_H1718#include "llvm-c/ExternC.h"19#include "llvm-c/Types.h"2021LLVM_C_EXTERN_C_BEGIN2223/**24* @defgroup LLVMCCoreDebugInfo Debug Information25* @ingroup LLVMCCore26*27* @{28*/2930/**31* Debug info flags.32*/33typedef enum {34LLVMDIFlagZero = 0,35LLVMDIFlagPrivate = 1,36LLVMDIFlagProtected = 2,37LLVMDIFlagPublic = 3,38LLVMDIFlagFwdDecl = 1 << 2,39LLVMDIFlagAppleBlock = 1 << 3,40LLVMDIFlagReservedBit4 = 1 << 4,41LLVMDIFlagVirtual = 1 << 5,42LLVMDIFlagArtificial = 1 << 6,43LLVMDIFlagExplicit = 1 << 7,44LLVMDIFlagPrototyped = 1 << 8,45LLVMDIFlagObjcClassComplete = 1 << 9,46LLVMDIFlagObjectPointer = 1 << 10,47LLVMDIFlagVector = 1 << 11,48LLVMDIFlagStaticMember = 1 << 12,49LLVMDIFlagLValueReference = 1 << 13,50LLVMDIFlagRValueReference = 1 << 14,51LLVMDIFlagReserved = 1 << 15,52LLVMDIFlagSingleInheritance = 1 << 16,53LLVMDIFlagMultipleInheritance = 2 << 16,54LLVMDIFlagVirtualInheritance = 3 << 16,55LLVMDIFlagIntroducedVirtual = 1 << 18,56LLVMDIFlagBitField = 1 << 19,57LLVMDIFlagNoReturn = 1 << 20,58LLVMDIFlagTypePassByValue = 1 << 22,59LLVMDIFlagTypePassByReference = 1 << 23,60LLVMDIFlagEnumClass = 1 << 24,61LLVMDIFlagFixedEnum = LLVMDIFlagEnumClass, // Deprecated.62LLVMDIFlagThunk = 1 << 25,63LLVMDIFlagNonTrivial = 1 << 26,64LLVMDIFlagBigEndian = 1 << 27,65LLVMDIFlagLittleEndian = 1 << 28,66LLVMDIFlagIndirectVirtualBase = (1 << 2) | (1 << 5),67LLVMDIFlagAccessibility = LLVMDIFlagPrivate | LLVMDIFlagProtected |68LLVMDIFlagPublic,69LLVMDIFlagPtrToMemberRep = LLVMDIFlagSingleInheritance |70LLVMDIFlagMultipleInheritance |71LLVMDIFlagVirtualInheritance72} LLVMDIFlags;7374/**75* Source languages known by DWARF.76*/77typedef enum {78LLVMDWARFSourceLanguageC89,79LLVMDWARFSourceLanguageC,80LLVMDWARFSourceLanguageAda83,81LLVMDWARFSourceLanguageC_plus_plus,82LLVMDWARFSourceLanguageCobol74,83LLVMDWARFSourceLanguageCobol85,84LLVMDWARFSourceLanguageFortran77,85LLVMDWARFSourceLanguageFortran90,86LLVMDWARFSourceLanguagePascal83,87LLVMDWARFSourceLanguageModula2,88// New in DWARF v3:89LLVMDWARFSourceLanguageJava,90LLVMDWARFSourceLanguageC99,91LLVMDWARFSourceLanguageAda95,92LLVMDWARFSourceLanguageFortran95,93LLVMDWARFSourceLanguagePLI,94LLVMDWARFSourceLanguageObjC,95LLVMDWARFSourceLanguageObjC_plus_plus,96LLVMDWARFSourceLanguageUPC,97LLVMDWARFSourceLanguageD,98// New in DWARF v4:99LLVMDWARFSourceLanguagePython,100// New in DWARF v5:101LLVMDWARFSourceLanguageOpenCL,102LLVMDWARFSourceLanguageGo,103LLVMDWARFSourceLanguageModula3,104LLVMDWARFSourceLanguageHaskell,105LLVMDWARFSourceLanguageC_plus_plus_03,106LLVMDWARFSourceLanguageC_plus_plus_11,107LLVMDWARFSourceLanguageOCaml,108LLVMDWARFSourceLanguageRust,109LLVMDWARFSourceLanguageC11,110LLVMDWARFSourceLanguageSwift,111LLVMDWARFSourceLanguageJulia,112LLVMDWARFSourceLanguageDylan,113LLVMDWARFSourceLanguageC_plus_plus_14,114LLVMDWARFSourceLanguageFortran03,115LLVMDWARFSourceLanguageFortran08,116LLVMDWARFSourceLanguageRenderScript,117LLVMDWARFSourceLanguageBLISS,118LLVMDWARFSourceLanguageKotlin,119LLVMDWARFSourceLanguageZig,120LLVMDWARFSourceLanguageCrystal,121LLVMDWARFSourceLanguageC_plus_plus_17,122LLVMDWARFSourceLanguageC_plus_plus_20,123LLVMDWARFSourceLanguageC17,124LLVMDWARFSourceLanguageFortran18,125LLVMDWARFSourceLanguageAda2005,126LLVMDWARFSourceLanguageAda2012,127LLVMDWARFSourceLanguageHIP,128LLVMDWARFSourceLanguageAssembly,129LLVMDWARFSourceLanguageC_sharp,130LLVMDWARFSourceLanguageMojo,131LLVMDWARFSourceLanguageGLSL,132LLVMDWARFSourceLanguageGLSL_ES,133LLVMDWARFSourceLanguageHLSL,134LLVMDWARFSourceLanguageOpenCL_CPP,135LLVMDWARFSourceLanguageCPP_for_OpenCL,136LLVMDWARFSourceLanguageSYCL,137LLVMDWARFSourceLanguageRuby,138LLVMDWARFSourceLanguageMove,139LLVMDWARFSourceLanguageHylo,140141// Vendor extensions:142LLVMDWARFSourceLanguageMips_Assembler,143LLVMDWARFSourceLanguageGOOGLE_RenderScript,144LLVMDWARFSourceLanguageBORLAND_Delphi145} LLVMDWARFSourceLanguage;146147/**148* The amount of debug information to emit.149*/150typedef enum {151LLVMDWARFEmissionNone = 0,152LLVMDWARFEmissionFull,153LLVMDWARFEmissionLineTablesOnly154} LLVMDWARFEmissionKind;155156/**157* The kind of metadata nodes.158*/159enum {160LLVMMDStringMetadataKind,161LLVMConstantAsMetadataMetadataKind,162LLVMLocalAsMetadataMetadataKind,163LLVMDistinctMDOperandPlaceholderMetadataKind,164LLVMMDTupleMetadataKind,165LLVMDILocationMetadataKind,166LLVMDIExpressionMetadataKind,167LLVMDIGlobalVariableExpressionMetadataKind,168LLVMGenericDINodeMetadataKind,169LLVMDISubrangeMetadataKind,170LLVMDIEnumeratorMetadataKind,171LLVMDIBasicTypeMetadataKind,172LLVMDIDerivedTypeMetadataKind,173LLVMDICompositeTypeMetadataKind,174LLVMDISubroutineTypeMetadataKind,175LLVMDIFileMetadataKind,176LLVMDICompileUnitMetadataKind,177LLVMDISubprogramMetadataKind,178LLVMDILexicalBlockMetadataKind,179LLVMDILexicalBlockFileMetadataKind,180LLVMDINamespaceMetadataKind,181LLVMDIModuleMetadataKind,182LLVMDITemplateTypeParameterMetadataKind,183LLVMDITemplateValueParameterMetadataKind,184LLVMDIGlobalVariableMetadataKind,185LLVMDILocalVariableMetadataKind,186LLVMDILabelMetadataKind,187LLVMDIObjCPropertyMetadataKind,188LLVMDIImportedEntityMetadataKind,189LLVMDIMacroMetadataKind,190LLVMDIMacroFileMetadataKind,191LLVMDICommonBlockMetadataKind,192LLVMDIStringTypeMetadataKind,193LLVMDIGenericSubrangeMetadataKind,194LLVMDIArgListMetadataKind,195LLVMDIAssignIDMetadataKind,196};197typedef unsigned LLVMMetadataKind;198199/**200* An LLVM DWARF type encoding.201*/202typedef unsigned LLVMDWARFTypeEncoding;203204/**205* Describes the kind of macro declaration used for LLVMDIBuilderCreateMacro.206* @see llvm::dwarf::MacinfoRecordType207* @note Values are from DW_MACINFO_* constants in the DWARF specification.208*/209typedef enum {210LLVMDWARFMacinfoRecordTypeDefine = 0x01,211LLVMDWARFMacinfoRecordTypeMacro = 0x02,212LLVMDWARFMacinfoRecordTypeStartFile = 0x03,213LLVMDWARFMacinfoRecordTypeEndFile = 0x04,214LLVMDWARFMacinfoRecordTypeVendorExt = 0xff215} LLVMDWARFMacinfoRecordType;216217/**218* The current debug metadata version number.219*/220unsigned LLVMDebugMetadataVersion(void);221222/**223* The version of debug metadata that's present in the provided \c Module.224*/225unsigned LLVMGetModuleDebugMetadataVersion(LLVMModuleRef Module);226227/**228* Strip debug info in the module if it exists.229* To do this, we remove all calls to the debugger intrinsics and any named230* metadata for debugging. We also remove debug locations for instructions.231* Return true if module is modified.232*/233LLVMBool LLVMStripModuleDebugInfo(LLVMModuleRef Module);234235/**236* Construct a builder for a module, and do not allow for unresolved nodes237* attached to the module.238*/239LLVMDIBuilderRef LLVMCreateDIBuilderDisallowUnresolved(LLVMModuleRef M);240241/**242* Construct a builder for a module and collect unresolved nodes attached243* to the module in order to resolve cycles during a call to244* \c LLVMDIBuilderFinalize.245*/246LLVMDIBuilderRef LLVMCreateDIBuilder(LLVMModuleRef M);247248/**249* Deallocates the \c DIBuilder and everything it owns.250* @note You must call \c LLVMDIBuilderFinalize before this251*/252void LLVMDisposeDIBuilder(LLVMDIBuilderRef Builder);253254/**255* Construct any deferred debug info descriptors.256*/257void LLVMDIBuilderFinalize(LLVMDIBuilderRef Builder);258259/**260* Finalize a specific subprogram.261* No new variables may be added to this subprogram afterwards.262*/263void LLVMDIBuilderFinalizeSubprogram(LLVMDIBuilderRef Builder,264LLVMMetadataRef Subprogram);265266/**267* A CompileUnit provides an anchor for all debugging268* information generated during this instance of compilation.269* \param Lang Source programming language, eg.270* \c LLVMDWARFSourceLanguageC99271* \param FileRef File info.272* \param Producer Identify the producer of debugging information273* and code. Usually this is a compiler274* version string.275* \param ProducerLen The length of the C string passed to \c Producer.276* \param isOptimized A boolean flag which indicates whether optimization277* is enabled or not.278* \param Flags This string lists command line options. This279* string is directly embedded in debug info280* output which may be used by a tool281* analyzing generated debugging information.282* \param FlagsLen The length of the C string passed to \c Flags.283* \param RuntimeVer This indicates runtime version for languages like284* Objective-C.285* \param SplitName The name of the file that we'll split debug info286* out into.287* \param SplitNameLen The length of the C string passed to \c SplitName.288* \param Kind The kind of debug information to generate.289* \param DWOId The DWOId if this is a split skeleton compile unit.290* \param SplitDebugInlining Whether to emit inline debug info.291* \param DebugInfoForProfiling Whether to emit extra debug info for292* profile collection.293* \param SysRoot The Clang system root (value of -isysroot).294* \param SysRootLen The length of the C string passed to \c SysRoot.295* \param SDK The SDK. On Darwin, the last component of the sysroot.296* \param SDKLen The length of the C string passed to \c SDK.297*/298LLVMMetadataRef LLVMDIBuilderCreateCompileUnit(299LLVMDIBuilderRef Builder, LLVMDWARFSourceLanguage Lang,300LLVMMetadataRef FileRef, const char *Producer, size_t ProducerLen,301LLVMBool isOptimized, const char *Flags, size_t FlagsLen,302unsigned RuntimeVer, const char *SplitName, size_t SplitNameLen,303LLVMDWARFEmissionKind Kind, unsigned DWOId, LLVMBool SplitDebugInlining,304LLVMBool DebugInfoForProfiling, const char *SysRoot, size_t SysRootLen,305const char *SDK, size_t SDKLen);306307/**308* Create a file descriptor to hold debugging information for a file.309* \param Builder The \c DIBuilder.310* \param Filename File name.311* \param FilenameLen The length of the C string passed to \c Filename.312* \param Directory Directory.313* \param DirectoryLen The length of the C string passed to \c Directory.314*/315LLVMMetadataRef316LLVMDIBuilderCreateFile(LLVMDIBuilderRef Builder, const char *Filename,317size_t FilenameLen, const char *Directory,318size_t DirectoryLen);319320/**321* Creates a new descriptor for a module with the specified parent scope.322* \param Builder The \c DIBuilder.323* \param ParentScope The parent scope containing this module declaration.324* \param Name Module name.325* \param NameLen The length of the C string passed to \c Name.326* \param ConfigMacros A space-separated shell-quoted list of -D macro327definitions as they would appear on a command line.328* \param ConfigMacrosLen The length of the C string passed to \c ConfigMacros.329* \param IncludePath The path to the module map file.330* \param IncludePathLen The length of the C string passed to \c IncludePath.331* \param APINotesFile The path to an API notes file for the module.332* \param APINotesFileLen The length of the C string passed to \c APINotestFile.333*/334LLVMMetadataRef335LLVMDIBuilderCreateModule(LLVMDIBuilderRef Builder, LLVMMetadataRef ParentScope,336const char *Name, size_t NameLen,337const char *ConfigMacros, size_t ConfigMacrosLen,338const char *IncludePath, size_t IncludePathLen,339const char *APINotesFile, size_t APINotesFileLen);340341/**342* Creates a new descriptor for a namespace with the specified parent scope.343* \param Builder The \c DIBuilder.344* \param ParentScope The parent scope containing this module declaration.345* \param Name NameSpace name.346* \param NameLen The length of the C string passed to \c Name.347* \param ExportSymbols Whether or not the namespace exports symbols, e.g.348* this is true of C++ inline namespaces.349*/350LLVMMetadataRef351LLVMDIBuilderCreateNameSpace(LLVMDIBuilderRef Builder,352LLVMMetadataRef ParentScope,353const char *Name, size_t NameLen,354LLVMBool ExportSymbols);355356/**357* Create a new descriptor for the specified subprogram.358* \param Builder The \c DIBuilder.359* \param Scope Function scope.360* \param Name Function name.361* \param NameLen Length of enumeration name.362* \param LinkageName Mangled function name.363* \param LinkageNameLen Length of linkage name.364* \param File File where this variable is defined.365* \param LineNo Line number.366* \param Ty Function type.367* \param IsLocalToUnit True if this function is not externally visible.368* \param IsDefinition True if this is a function definition.369* \param ScopeLine Set to the beginning of the scope this starts370* \param Flags E.g.: \c LLVMDIFlagLValueReference. These flags are371* used to emit dwarf attributes.372* \param IsOptimized True if optimization is ON.373*/374LLVMMetadataRef LLVMDIBuilderCreateFunction(375LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,376size_t NameLen, const char *LinkageName, size_t LinkageNameLen,377LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty,378LLVMBool IsLocalToUnit, LLVMBool IsDefinition,379unsigned ScopeLine, LLVMDIFlags Flags, LLVMBool IsOptimized);380381/**382* Create a descriptor for a lexical block with the specified parent context.383* \param Builder The \c DIBuilder.384* \param Scope Parent lexical block.385* \param File Source file.386* \param Line The line in the source file.387* \param Column The column in the source file.388*/389LLVMMetadataRef LLVMDIBuilderCreateLexicalBlock(390LLVMDIBuilderRef Builder, LLVMMetadataRef Scope,391LLVMMetadataRef File, unsigned Line, unsigned Column);392393/**394* Create a descriptor for a lexical block with a new file attached.395* \param Builder The \c DIBuilder.396* \param Scope Lexical block.397* \param File Source file.398* \param Discriminator DWARF path discriminator value.399*/400LLVMMetadataRef401LLVMDIBuilderCreateLexicalBlockFile(LLVMDIBuilderRef Builder,402LLVMMetadataRef Scope,403LLVMMetadataRef File,404unsigned Discriminator);405406/**407* Create a descriptor for an imported namespace. Suitable for e.g. C++408* using declarations.409* \param Builder The \c DIBuilder.410* \param Scope The scope this module is imported into411* \param File File where the declaration is located.412* \param Line Line number of the declaration.413*/414LLVMMetadataRef415LLVMDIBuilderCreateImportedModuleFromNamespace(LLVMDIBuilderRef Builder,416LLVMMetadataRef Scope,417LLVMMetadataRef NS,418LLVMMetadataRef File,419unsigned Line);420421/**422* Create a descriptor for an imported module that aliases another423* imported entity descriptor.424* \param Builder The \c DIBuilder.425* \param Scope The scope this module is imported into426* \param ImportedEntity Previous imported entity to alias.427* \param File File where the declaration is located.428* \param Line Line number of the declaration.429* \param Elements Renamed elements.430* \param NumElements Number of renamed elements.431*/432LLVMMetadataRef LLVMDIBuilderCreateImportedModuleFromAlias(433LLVMDIBuilderRef Builder, LLVMMetadataRef Scope,434LLVMMetadataRef ImportedEntity, LLVMMetadataRef File, unsigned Line,435LLVMMetadataRef *Elements, unsigned NumElements);436437/**438* Create a descriptor for an imported module.439* \param Builder The \c DIBuilder.440* \param Scope The scope this module is imported into441* \param M The module being imported here442* \param File File where the declaration is located.443* \param Line Line number of the declaration.444* \param Elements Renamed elements.445* \param NumElements Number of renamed elements.446*/447LLVMMetadataRef LLVMDIBuilderCreateImportedModuleFromModule(448LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, LLVMMetadataRef M,449LLVMMetadataRef File, unsigned Line, LLVMMetadataRef *Elements,450unsigned NumElements);451452/**453* Create a descriptor for an imported function, type, or variable. Suitable454* for e.g. FORTRAN-style USE declarations.455* \param Builder The DIBuilder.456* \param Scope The scope this module is imported into.457* \param Decl The declaration (or definition) of a function, type,458or variable.459* \param File File where the declaration is located.460* \param Line Line number of the declaration.461* \param Name A name that uniquely identifies this imported462declaration.463* \param NameLen The length of the C string passed to \c Name.464* \param Elements Renamed elements.465* \param NumElements Number of renamed elements.466*/467LLVMMetadataRef LLVMDIBuilderCreateImportedDeclaration(468LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, LLVMMetadataRef Decl,469LLVMMetadataRef File, unsigned Line, const char *Name, size_t NameLen,470LLVMMetadataRef *Elements, unsigned NumElements);471472/**473* Creates a new DebugLocation that describes a source location.474* \param Line The line in the source file.475* \param Column The column in the source file.476* \param Scope The scope in which the location resides.477* \param InlinedAt The scope where this location was inlined, if at all.478* (optional).479* \note If the item to which this location is attached cannot be480* attributed to a source line, pass 0 for the line and column.481*/482LLVMMetadataRef483LLVMDIBuilderCreateDebugLocation(LLVMContextRef Ctx, unsigned Line,484unsigned Column, LLVMMetadataRef Scope,485LLVMMetadataRef InlinedAt);486487/**488* Get the line number of this debug location.489* \param Location The debug location.490*491* @see DILocation::getLine()492*/493unsigned LLVMDILocationGetLine(LLVMMetadataRef Location);494495/**496* Get the column number of this debug location.497* \param Location The debug location.498*499* @see DILocation::getColumn()500*/501unsigned LLVMDILocationGetColumn(LLVMMetadataRef Location);502503/**504* Get the local scope associated with this debug location.505* \param Location The debug location.506*507* @see DILocation::getScope()508*/509LLVMMetadataRef LLVMDILocationGetScope(LLVMMetadataRef Location);510511/**512* Get the "inline at" location associated with this debug location.513* \param Location The debug location.514*515* @see DILocation::getInlinedAt()516*/517LLVMMetadataRef LLVMDILocationGetInlinedAt(LLVMMetadataRef Location);518519/**520* Get the metadata of the file associated with a given scope.521* \param Scope The scope object.522*523* @see DIScope::getFile()524*/525LLVMMetadataRef LLVMDIScopeGetFile(LLVMMetadataRef Scope);526527/**528* Get the directory of a given file.529* \param File The file object.530* \param Len The length of the returned string.531*532* @see DIFile::getDirectory()533*/534const char *LLVMDIFileGetDirectory(LLVMMetadataRef File, unsigned *Len);535536/**537* Get the name of a given file.538* \param File The file object.539* \param Len The length of the returned string.540*541* @see DIFile::getFilename()542*/543const char *LLVMDIFileGetFilename(LLVMMetadataRef File, unsigned *Len);544545/**546* Get the source of a given file.547* \param File The file object.548* \param Len The length of the returned string.549*550* @see DIFile::getSource()551*/552const char *LLVMDIFileGetSource(LLVMMetadataRef File, unsigned *Len);553554/**555* Create a type array.556* \param Builder The DIBuilder.557* \param Data The type elements.558* \param NumElements Number of type elements.559*/560LLVMMetadataRef LLVMDIBuilderGetOrCreateTypeArray(LLVMDIBuilderRef Builder,561LLVMMetadataRef *Data,562size_t NumElements);563564/**565* Create subroutine type.566* \param Builder The DIBuilder.567* \param File The file in which the subroutine resides.568* \param ParameterTypes An array of subroutine parameter types. This569* includes return type at 0th index.570* \param NumParameterTypes The number of parameter types in \c ParameterTypes571* \param Flags E.g.: \c LLVMDIFlagLValueReference.572* These flags are used to emit dwarf attributes.573*/574LLVMMetadataRef575LLVMDIBuilderCreateSubroutineType(LLVMDIBuilderRef Builder,576LLVMMetadataRef File,577LLVMMetadataRef *ParameterTypes,578unsigned NumParameterTypes,579LLVMDIFlags Flags);580581/**582* Create debugging information entry for a macro.583* @param Builder The DIBuilder.584* @param ParentMacroFile Macro parent (could be NULL).585* @param Line Source line number where the macro is defined.586* @param RecordType DW_MACINFO_define or DW_MACINFO_undef.587* @param Name Macro name.588* @param NameLen Macro name length.589* @param Value Macro value.590* @param ValueLen Macro value length.591*/592LLVMMetadataRef LLVMDIBuilderCreateMacro(LLVMDIBuilderRef Builder,593LLVMMetadataRef ParentMacroFile,594unsigned Line,595LLVMDWARFMacinfoRecordType RecordType,596const char *Name, size_t NameLen,597const char *Value, size_t ValueLen);598599/**600* Create debugging information temporary entry for a macro file.601* List of macro node direct children will be calculated by DIBuilder,602* using the \p ParentMacroFile relationship.603* @param Builder The DIBuilder.604* @param ParentMacroFile Macro parent (could be NULL).605* @param Line Source line number where the macro file is included.606* @param File File descriptor containing the name of the macro file.607*/608LLVMMetadataRef609LLVMDIBuilderCreateTempMacroFile(LLVMDIBuilderRef Builder,610LLVMMetadataRef ParentMacroFile, unsigned Line,611LLVMMetadataRef File);612613/**614* Create debugging information entry for an enumerator.615* @param Builder The DIBuilder.616* @param Name Enumerator name.617* @param NameLen Length of enumerator name.618* @param Value Enumerator value.619* @param IsUnsigned True if the value is unsigned.620*/621LLVMMetadataRef LLVMDIBuilderCreateEnumerator(LLVMDIBuilderRef Builder,622const char *Name, size_t NameLen,623int64_t Value,624LLVMBool IsUnsigned);625626/**627* Create debugging information entry for an enumeration.628* \param Builder The DIBuilder.629* \param Scope Scope in which this enumeration is defined.630* \param Name Enumeration name.631* \param NameLen Length of enumeration name.632* \param File File where this member is defined.633* \param LineNumber Line number.634* \param SizeInBits Member size.635* \param AlignInBits Member alignment.636* \param Elements Enumeration elements.637* \param NumElements Number of enumeration elements.638* \param ClassTy Underlying type of a C++11/ObjC fixed enum.639*/640LLVMMetadataRef LLVMDIBuilderCreateEnumerationType(641LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,642size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,643uint64_t SizeInBits, uint32_t AlignInBits, LLVMMetadataRef *Elements,644unsigned NumElements, LLVMMetadataRef ClassTy);645646/**647* Create debugging information entry for a union.648* \param Builder The DIBuilder.649* \param Scope Scope in which this union is defined.650* \param Name Union name.651* \param NameLen Length of union name.652* \param File File where this member is defined.653* \param LineNumber Line number.654* \param SizeInBits Member size.655* \param AlignInBits Member alignment.656* \param Flags Flags to encode member attribute, e.g. private657* \param Elements Union elements.658* \param NumElements Number of union elements.659* \param RunTimeLang Optional parameter, Objective-C runtime version.660* \param UniqueId A unique identifier for the union.661* \param UniqueIdLen Length of unique identifier.662*/663LLVMMetadataRef LLVMDIBuilderCreateUnionType(664LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,665size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,666uint64_t SizeInBits, uint32_t AlignInBits, LLVMDIFlags Flags,667LLVMMetadataRef *Elements, unsigned NumElements, unsigned RunTimeLang,668const char *UniqueId, size_t UniqueIdLen);669670671/**672* Create debugging information entry for an array.673* \param Builder The DIBuilder.674* \param Size Array size.675* \param AlignInBits Alignment.676* \param Ty Element type.677* \param Subscripts Subscripts.678* \param NumSubscripts Number of subscripts.679*/680LLVMMetadataRef681LLVMDIBuilderCreateArrayType(LLVMDIBuilderRef Builder, uint64_t Size,682uint32_t AlignInBits, LLVMMetadataRef Ty,683LLVMMetadataRef *Subscripts,684unsigned NumSubscripts);685686/**687* Create debugging information entry for a vector type.688* \param Builder The DIBuilder.689* \param Size Vector size.690* \param AlignInBits Alignment.691* \param Ty Element type.692* \param Subscripts Subscripts.693* \param NumSubscripts Number of subscripts.694*/695LLVMMetadataRef696LLVMDIBuilderCreateVectorType(LLVMDIBuilderRef Builder, uint64_t Size,697uint32_t AlignInBits, LLVMMetadataRef Ty,698LLVMMetadataRef *Subscripts,699unsigned NumSubscripts);700701/**702* Create a DWARF unspecified type.703* \param Builder The DIBuilder.704* \param Name The unspecified type's name.705* \param NameLen Length of type name.706*/707LLVMMetadataRef708LLVMDIBuilderCreateUnspecifiedType(LLVMDIBuilderRef Builder, const char *Name,709size_t NameLen);710711/**712* Create debugging information entry for a basic713* type.714* \param Builder The DIBuilder.715* \param Name Type name.716* \param NameLen Length of type name.717* \param SizeInBits Size of the type.718* \param Encoding DWARF encoding code, e.g. \c LLVMDWARFTypeEncoding_float.719* \param Flags Flags to encode optional attribute like endianity720*/721LLVMMetadataRef722LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef Builder, const char *Name,723size_t NameLen, uint64_t SizeInBits,724LLVMDWARFTypeEncoding Encoding,725LLVMDIFlags Flags);726727/**728* Create debugging information entry for a pointer.729* \param Builder The DIBuilder.730* \param PointeeTy Type pointed by this pointer.731* \param SizeInBits Size.732* \param AlignInBits Alignment. (optional, pass 0 to ignore)733* \param AddressSpace DWARF address space. (optional, pass 0 to ignore)734* \param Name Pointer type name. (optional)735* \param NameLen Length of pointer type name. (optional)736*/737LLVMMetadataRef LLVMDIBuilderCreatePointerType(738LLVMDIBuilderRef Builder, LLVMMetadataRef PointeeTy,739uint64_t SizeInBits, uint32_t AlignInBits, unsigned AddressSpace,740const char *Name, size_t NameLen);741742/**743* Create debugging information entry for a struct.744* \param Builder The DIBuilder.745* \param Scope Scope in which this struct is defined.746* \param Name Struct name.747* \param NameLen Struct name length.748* \param File File where this member is defined.749* \param LineNumber Line number.750* \param SizeInBits Member size.751* \param AlignInBits Member alignment.752* \param Flags Flags to encode member attribute, e.g. private753* \param Elements Struct elements.754* \param NumElements Number of struct elements.755* \param RunTimeLang Optional parameter, Objective-C runtime version.756* \param VTableHolder The object containing the vtable for the struct.757* \param UniqueId A unique identifier for the struct.758* \param UniqueIdLen Length of the unique identifier for the struct.759*/760LLVMMetadataRef LLVMDIBuilderCreateStructType(761LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,762size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,763uint64_t SizeInBits, uint32_t AlignInBits, LLVMDIFlags Flags,764LLVMMetadataRef DerivedFrom, LLVMMetadataRef *Elements,765unsigned NumElements, unsigned RunTimeLang, LLVMMetadataRef VTableHolder,766const char *UniqueId, size_t UniqueIdLen);767768/**769* Create debugging information entry for a member.770* \param Builder The DIBuilder.771* \param Scope Member scope.772* \param Name Member name.773* \param NameLen Length of member name.774* \param File File where this member is defined.775* \param LineNo Line number.776* \param SizeInBits Member size.777* \param AlignInBits Member alignment.778* \param OffsetInBits Member offset.779* \param Flags Flags to encode member attribute, e.g. private780* \param Ty Parent type.781*/782LLVMMetadataRef LLVMDIBuilderCreateMemberType(783LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,784size_t NameLen, LLVMMetadataRef File, unsigned LineNo,785uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,786LLVMDIFlags Flags, LLVMMetadataRef Ty);787788/**789* Create debugging information entry for a790* C++ static data member.791* \param Builder The DIBuilder.792* \param Scope Member scope.793* \param Name Member name.794* \param NameLen Length of member name.795* \param File File where this member is declared.796* \param LineNumber Line number.797* \param Type Type of the static member.798* \param Flags Flags to encode member attribute, e.g. private.799* \param ConstantVal Const initializer of the member.800* \param AlignInBits Member alignment.801*/802LLVMMetadataRef803LLVMDIBuilderCreateStaticMemberType(804LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,805size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,806LLVMMetadataRef Type, LLVMDIFlags Flags, LLVMValueRef ConstantVal,807uint32_t AlignInBits);808809/**810* Create debugging information entry for a pointer to member.811* \param Builder The DIBuilder.812* \param PointeeType Type pointed to by this pointer.813* \param ClassType Type for which this pointer points to members of.814* \param SizeInBits Size.815* \param AlignInBits Alignment.816* \param Flags Flags.817*/818LLVMMetadataRef819LLVMDIBuilderCreateMemberPointerType(LLVMDIBuilderRef Builder,820LLVMMetadataRef PointeeType,821LLVMMetadataRef ClassType,822uint64_t SizeInBits,823uint32_t AlignInBits,824LLVMDIFlags Flags);825/**826* Create debugging information entry for Objective-C instance variable.827* \param Builder The DIBuilder.828* \param Name Member name.829* \param NameLen The length of the C string passed to \c Name.830* \param File File where this member is defined.831* \param LineNo Line number.832* \param SizeInBits Member size.833* \param AlignInBits Member alignment.834* \param OffsetInBits Member offset.835* \param Flags Flags to encode member attribute, e.g. private836* \param Ty Parent type.837* \param PropertyNode Property associated with this ivar.838*/839LLVMMetadataRef840LLVMDIBuilderCreateObjCIVar(LLVMDIBuilderRef Builder,841const char *Name, size_t NameLen,842LLVMMetadataRef File, unsigned LineNo,843uint64_t SizeInBits, uint32_t AlignInBits,844uint64_t OffsetInBits, LLVMDIFlags Flags,845LLVMMetadataRef Ty, LLVMMetadataRef PropertyNode);846847/**848* Create debugging information entry for Objective-C property.849* \param Builder The DIBuilder.850* \param Name Property name.851* \param NameLen The length of the C string passed to \c Name.852* \param File File where this property is defined.853* \param LineNo Line number.854* \param GetterName Name of the Objective C property getter selector.855* \param GetterNameLen The length of the C string passed to \c GetterName.856* \param SetterName Name of the Objective C property setter selector.857* \param SetterNameLen The length of the C string passed to \c SetterName.858* \param PropertyAttributes Objective C property attributes.859* \param Ty Type.860*/861LLVMMetadataRef862LLVMDIBuilderCreateObjCProperty(LLVMDIBuilderRef Builder,863const char *Name, size_t NameLen,864LLVMMetadataRef File, unsigned LineNo,865const char *GetterName, size_t GetterNameLen,866const char *SetterName, size_t SetterNameLen,867unsigned PropertyAttributes,868LLVMMetadataRef Ty);869870/**871* Create a uniqued DIType* clone with FlagObjectPointer and FlagArtificial set.872* \param Builder The DIBuilder.873* \param Type The underlying type to which this pointer points.874*/875LLVMMetadataRef876LLVMDIBuilderCreateObjectPointerType(LLVMDIBuilderRef Builder,877LLVMMetadataRef Type);878879/**880* Create debugging information entry for a qualified881* type, e.g. 'const int'.882* \param Builder The DIBuilder.883* \param Tag Tag identifying type,884* e.g. LLVMDWARFTypeQualifier_volatile_type885* \param Type Base Type.886*/887LLVMMetadataRef888LLVMDIBuilderCreateQualifiedType(LLVMDIBuilderRef Builder, unsigned Tag,889LLVMMetadataRef Type);890891/**892* Create debugging information entry for a c++893* style reference or rvalue reference type.894* \param Builder The DIBuilder.895* \param Tag Tag identifying type,896* \param Type Base Type.897*/898LLVMMetadataRef899LLVMDIBuilderCreateReferenceType(LLVMDIBuilderRef Builder, unsigned Tag,900LLVMMetadataRef Type);901902/**903* Create C++11 nullptr type.904* \param Builder The DIBuilder.905*/906LLVMMetadataRef907LLVMDIBuilderCreateNullPtrType(LLVMDIBuilderRef Builder);908909/**910* Create debugging information entry for a typedef.911* \param Builder The DIBuilder.912* \param Type Original type.913* \param Name Typedef name.914* \param File File where this type is defined.915* \param LineNo Line number.916* \param Scope The surrounding context for the typedef.917*/918LLVMMetadataRef919LLVMDIBuilderCreateTypedef(LLVMDIBuilderRef Builder, LLVMMetadataRef Type,920const char *Name, size_t NameLen,921LLVMMetadataRef File, unsigned LineNo,922LLVMMetadataRef Scope, uint32_t AlignInBits);923924/**925* Create debugging information entry to establish inheritance relationship926* between two types.927* \param Builder The DIBuilder.928* \param Ty Original type.929* \param BaseTy Base type. Ty is inherits from base.930* \param BaseOffset Base offset.931* \param VBPtrOffset Virtual base pointer offset.932* \param Flags Flags to describe inheritance attribute, e.g. private933*/934LLVMMetadataRef935LLVMDIBuilderCreateInheritance(LLVMDIBuilderRef Builder,936LLVMMetadataRef Ty, LLVMMetadataRef BaseTy,937uint64_t BaseOffset, uint32_t VBPtrOffset,938LLVMDIFlags Flags);939940/**941* Create a permanent forward-declared type.942* \param Builder The DIBuilder.943* \param Tag A unique tag for this type.944* \param Name Type name.945* \param NameLen Length of type name.946* \param Scope Type scope.947* \param File File where this type is defined.948* \param Line Line number where this type is defined.949* \param RuntimeLang Indicates runtime version for languages like950* Objective-C.951* \param SizeInBits Member size.952* \param AlignInBits Member alignment.953* \param UniqueIdentifier A unique identifier for the type.954* \param UniqueIdentifierLen Length of the unique identifier.955*/956LLVMMetadataRef LLVMDIBuilderCreateForwardDecl(957LLVMDIBuilderRef Builder, unsigned Tag, const char *Name,958size_t NameLen, LLVMMetadataRef Scope, LLVMMetadataRef File, unsigned Line,959unsigned RuntimeLang, uint64_t SizeInBits, uint32_t AlignInBits,960const char *UniqueIdentifier, size_t UniqueIdentifierLen);961962/**963* Create a temporary forward-declared type.964* \param Builder The DIBuilder.965* \param Tag A unique tag for this type.966* \param Name Type name.967* \param NameLen Length of type name.968* \param Scope Type scope.969* \param File File where this type is defined.970* \param Line Line number where this type is defined.971* \param RuntimeLang Indicates runtime version for languages like972* Objective-C.973* \param SizeInBits Member size.974* \param AlignInBits Member alignment.975* \param Flags Flags.976* \param UniqueIdentifier A unique identifier for the type.977* \param UniqueIdentifierLen Length of the unique identifier.978*/979LLVMMetadataRef980LLVMDIBuilderCreateReplaceableCompositeType(981LLVMDIBuilderRef Builder, unsigned Tag, const char *Name,982size_t NameLen, LLVMMetadataRef Scope, LLVMMetadataRef File, unsigned Line,983unsigned RuntimeLang, uint64_t SizeInBits, uint32_t AlignInBits,984LLVMDIFlags Flags, const char *UniqueIdentifier,985size_t UniqueIdentifierLen);986987/**988* Create debugging information entry for a bit field member.989* \param Builder The DIBuilder.990* \param Scope Member scope.991* \param Name Member name.992* \param NameLen Length of member name.993* \param File File where this member is defined.994* \param LineNumber Line number.995* \param SizeInBits Member size.996* \param OffsetInBits Member offset.997* \param StorageOffsetInBits Member storage offset.998* \param Flags Flags to encode member attribute.999* \param Type Parent type.1000*/1001LLVMMetadataRef1002LLVMDIBuilderCreateBitFieldMemberType(LLVMDIBuilderRef Builder,1003LLVMMetadataRef Scope,1004const char *Name, size_t NameLen,1005LLVMMetadataRef File, unsigned LineNumber,1006uint64_t SizeInBits,1007uint64_t OffsetInBits,1008uint64_t StorageOffsetInBits,1009LLVMDIFlags Flags, LLVMMetadataRef Type);10101011/**1012* Create debugging information entry for a class.1013* \param Scope Scope in which this class is defined.1014* \param Name Class name.1015* \param NameLen The length of the C string passed to \c Name.1016* \param File File where this member is defined.1017* \param LineNumber Line number.1018* \param SizeInBits Member size.1019* \param AlignInBits Member alignment.1020* \param OffsetInBits Member offset.1021* \param Flags Flags to encode member attribute, e.g. private.1022* \param DerivedFrom Debug info of the base class of this type.1023* \param Elements Class members.1024* \param NumElements Number of class elements.1025* \param VTableHolder Debug info of the base class that contains vtable1026* for this type. This is used in1027* DW_AT_containing_type. See DWARF documentation1028* for more info.1029* \param TemplateParamsNode Template type parameters.1030* \param UniqueIdentifier A unique identifier for the type.1031* \param UniqueIdentifierLen Length of the unique identifier.1032*/1033LLVMMetadataRef LLVMDIBuilderCreateClassType(LLVMDIBuilderRef Builder,1034LLVMMetadataRef Scope, const char *Name, size_t NameLen,1035LLVMMetadataRef File, unsigned LineNumber, uint64_t SizeInBits,1036uint32_t AlignInBits, uint64_t OffsetInBits, LLVMDIFlags Flags,1037LLVMMetadataRef DerivedFrom,1038LLVMMetadataRef *Elements, unsigned NumElements,1039LLVMMetadataRef VTableHolder, LLVMMetadataRef TemplateParamsNode,1040const char *UniqueIdentifier, size_t UniqueIdentifierLen);10411042/**1043* Create a uniqued DIType* clone with FlagArtificial set.1044* \param Builder The DIBuilder.1045* \param Type The underlying type.1046*/1047LLVMMetadataRef1048LLVMDIBuilderCreateArtificialType(LLVMDIBuilderRef Builder,1049LLVMMetadataRef Type);10501051/**1052* Get the name of this DIType.1053* \param DType The DIType.1054* \param Length The length of the returned string.1055*1056* @see DIType::getName()1057*/1058const char *LLVMDITypeGetName(LLVMMetadataRef DType, size_t *Length);10591060/**1061* Get the size of this DIType in bits.1062* \param DType The DIType.1063*1064* @see DIType::getSizeInBits()1065*/1066uint64_t LLVMDITypeGetSizeInBits(LLVMMetadataRef DType);10671068/**1069* Get the offset of this DIType in bits.1070* \param DType The DIType.1071*1072* @see DIType::getOffsetInBits()1073*/1074uint64_t LLVMDITypeGetOffsetInBits(LLVMMetadataRef DType);10751076/**1077* Get the alignment of this DIType in bits.1078* \param DType The DIType.1079*1080* @see DIType::getAlignInBits()1081*/1082uint32_t LLVMDITypeGetAlignInBits(LLVMMetadataRef DType);10831084/**1085* Get the source line where this DIType is declared.1086* \param DType The DIType.1087*1088* @see DIType::getLine()1089*/1090unsigned LLVMDITypeGetLine(LLVMMetadataRef DType);10911092/**1093* Get the flags associated with this DIType.1094* \param DType The DIType.1095*1096* @see DIType::getFlags()1097*/1098LLVMDIFlags LLVMDITypeGetFlags(LLVMMetadataRef DType);10991100/**1101* Create a descriptor for a value range.1102* \param Builder The DIBuilder.1103* \param LowerBound Lower bound of the subrange, e.g. 0 for C, 1 for Fortran.1104* \param Count Count of elements in the subrange.1105*/1106LLVMMetadataRef LLVMDIBuilderGetOrCreateSubrange(LLVMDIBuilderRef Builder,1107int64_t LowerBound,1108int64_t Count);11091110/**1111* Create an array of DI Nodes.1112* \param Builder The DIBuilder.1113* \param Data The DI Node elements.1114* \param NumElements Number of DI Node elements.1115*/1116LLVMMetadataRef LLVMDIBuilderGetOrCreateArray(LLVMDIBuilderRef Builder,1117LLVMMetadataRef *Data,1118size_t NumElements);11191120/**1121* Create a new descriptor for the specified variable which has a complex1122* address expression for its address.1123* \param Builder The DIBuilder.1124* \param Addr An array of complex address operations.1125* \param Length Length of the address operation array.1126*/1127LLVMMetadataRef LLVMDIBuilderCreateExpression(LLVMDIBuilderRef Builder,1128uint64_t *Addr, size_t Length);11291130/**1131* Create a new descriptor for the specified variable that does not have an1132* address, but does have a constant value.1133* \param Builder The DIBuilder.1134* \param Value The constant value.1135*/1136LLVMMetadataRef1137LLVMDIBuilderCreateConstantValueExpression(LLVMDIBuilderRef Builder,1138uint64_t Value);11391140/**1141* Create a new descriptor for the specified variable.1142* \param Scope Variable scope.1143* \param Name Name of the variable.1144* \param NameLen The length of the C string passed to \c Name.1145* \param Linkage Mangled name of the variable.1146* \param LinkLen The length of the C string passed to \c Linkage.1147* \param File File where this variable is defined.1148* \param LineNo Line number.1149* \param Ty Variable Type.1150* \param LocalToUnit Boolean flag indicate whether this variable is1151* externally visible or not.1152* \param Expr The location of the global relative to the attached1153* GlobalVariable.1154* \param Decl Reference to the corresponding declaration.1155* variables.1156* \param AlignInBits Variable alignment(or 0 if no alignment attr was1157* specified)1158*/1159LLVMMetadataRef LLVMDIBuilderCreateGlobalVariableExpression(1160LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,1161size_t NameLen, const char *Linkage, size_t LinkLen, LLVMMetadataRef File,1162unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit,1163LLVMMetadataRef Expr, LLVMMetadataRef Decl, uint32_t AlignInBits);116411651166/**1167* Get the dwarf::Tag of a DINode1168*/1169uint16_t LLVMGetDINodeTag(LLVMMetadataRef MD);11701171/**1172* Retrieves the \c DIVariable associated with this global variable expression.1173* \param GVE The global variable expression.1174*1175* @see llvm::DIGlobalVariableExpression::getVariable()1176*/1177LLVMMetadataRef LLVMDIGlobalVariableExpressionGetVariable(LLVMMetadataRef GVE);11781179/**1180* Retrieves the \c DIExpression associated with this global variable expression.1181* \param GVE The global variable expression.1182*1183* @see llvm::DIGlobalVariableExpression::getExpression()1184*/1185LLVMMetadataRef LLVMDIGlobalVariableExpressionGetExpression(1186LLVMMetadataRef GVE);11871188/**1189* Get the metadata of the file associated with a given variable.1190* \param Var The variable object.1191*1192* @see DIVariable::getFile()1193*/1194LLVMMetadataRef LLVMDIVariableGetFile(LLVMMetadataRef Var);11951196/**1197* Get the metadata of the scope associated with a given variable.1198* \param Var The variable object.1199*1200* @see DIVariable::getScope()1201*/1202LLVMMetadataRef LLVMDIVariableGetScope(LLVMMetadataRef Var);12031204/**1205* Get the source line where this \c DIVariable is declared.1206* \param Var The DIVariable.1207*1208* @see DIVariable::getLine()1209*/1210unsigned LLVMDIVariableGetLine(LLVMMetadataRef Var);12111212/**1213* Create a new temporary \c MDNode. Suitable for use in constructing cyclic1214* \c MDNode structures. A temporary \c MDNode is not uniqued, may be RAUW'd,1215* and must be manually deleted with \c LLVMDisposeTemporaryMDNode.1216* \param Ctx The context in which to construct the temporary node.1217* \param Data The metadata elements.1218* \param NumElements Number of metadata elements.1219*/1220LLVMMetadataRef LLVMTemporaryMDNode(LLVMContextRef Ctx, LLVMMetadataRef *Data,1221size_t NumElements);12221223/**1224* Deallocate a temporary node.1225*1226* Calls \c replaceAllUsesWith(nullptr) before deleting, so any remaining1227* references will be reset.1228* \param TempNode The temporary metadata node.1229*/1230void LLVMDisposeTemporaryMDNode(LLVMMetadataRef TempNode);12311232/**1233* Replace all uses of temporary metadata.1234* \param TempTargetMetadata The temporary metadata node.1235* \param Replacement The replacement metadata node.1236*/1237void LLVMMetadataReplaceAllUsesWith(LLVMMetadataRef TempTargetMetadata,1238LLVMMetadataRef Replacement);12391240/**1241* Create a new descriptor for the specified global variable that is temporary1242* and meant to be RAUWed.1243* \param Scope Variable scope.1244* \param Name Name of the variable.1245* \param NameLen The length of the C string passed to \c Name.1246* \param Linkage Mangled name of the variable.1247* \param LnkLen The length of the C string passed to \c Linkage.1248* \param File File where this variable is defined.1249* \param LineNo Line number.1250* \param Ty Variable Type.1251* \param LocalToUnit Boolean flag indicate whether this variable is1252* externally visible or not.1253* \param Decl Reference to the corresponding declaration.1254* \param AlignInBits Variable alignment(or 0 if no alignment attr was1255* specified)1256*/1257LLVMMetadataRef LLVMDIBuilderCreateTempGlobalVariableFwdDecl(1258LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,1259size_t NameLen, const char *Linkage, size_t LnkLen, LLVMMetadataRef File,1260unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit,1261LLVMMetadataRef Decl, uint32_t AlignInBits);12621263/**1264* Only use in "new debug format" (LLVMIsNewDbgInfoFormat() is true).1265* See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes1266*1267* The debug format can be switched later after inserting the records using1268* LLVMSetIsNewDbgInfoFormat, if needed for legacy or transitionary reasons.1269*1270* Insert a Declare DbgRecord before the given instruction.1271* \param Builder The DIBuilder.1272* \param Storage The storage of the variable to declare.1273* \param VarInfo The variable's debug info descriptor.1274* \param Expr A complex location expression for the variable.1275* \param DebugLoc Debug info location.1276* \param Instr Instruction acting as a location for the new record.1277*/1278LLVMDbgRecordRef LLVMDIBuilderInsertDeclareRecordBefore(1279LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,1280LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr);12811282/**1283* Only use in "new debug format" (LLVMIsNewDbgInfoFormat() is true).1284* See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes1285*1286* The debug format can be switched later after inserting the records using1287* LLVMSetIsNewDbgInfoFormat, if needed for legacy or transitionary reasons.1288*1289* Insert a Declare DbgRecord at the end of the given basic block. If the basic1290* block has a terminator instruction, the record is inserted before that1291* terminator instruction.1292* \param Builder The DIBuilder.1293* \param Storage The storage of the variable to declare.1294* \param VarInfo The variable's debug info descriptor.1295* \param Expr A complex location expression for the variable.1296* \param DebugLoc Debug info location.1297* \param Block Basic block acting as a location for the new record.1298*/1299LLVMDbgRecordRef LLVMDIBuilderInsertDeclareRecordAtEnd(1300LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,1301LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block);13021303/**1304* Only use in "new debug format" (LLVMIsNewDbgInfoFormat() is true).1305* See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes1306*1307* The debug format can be switched later after inserting the records using1308* LLVMSetIsNewDbgInfoFormat, if needed for legacy or transitionary reasons.1309*1310* Insert a new debug record before the given instruction.1311* \param Builder The DIBuilder.1312* \param Val The value of the variable.1313* \param VarInfo The variable's debug info descriptor.1314* \param Expr A complex location expression for the variable.1315* \param DebugLoc Debug info location.1316* \param Instr Instruction acting as a location for the new record.1317*/1318LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueRecordBefore(1319LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,1320LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr);13211322/**1323* Only use in "new debug format" (LLVMIsNewDbgInfoFormat() is true).1324* See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes1325*1326* The debug format can be switched later after inserting the records using1327* LLVMSetIsNewDbgInfoFormat, if needed for legacy or transitionary reasons.1328*1329* Insert a new debug record at the end of the given basic block. If the1330* basic block has a terminator instruction, the record is inserted before1331* that terminator instruction.1332* \param Builder The DIBuilder.1333* \param Val The value of the variable.1334* \param VarInfo The variable's debug info descriptor.1335* \param Expr A complex location expression for the variable.1336* \param DebugLoc Debug info location.1337* \param Block Basic block acting as a location for the new record.1338*/1339LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueRecordAtEnd(1340LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo,1341LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block);13421343/**1344* Create a new descriptor for a local auto variable.1345* \param Builder The DIBuilder.1346* \param Scope The local scope the variable is declared in.1347* \param Name Variable name.1348* \param NameLen Length of variable name.1349* \param File File where this variable is defined.1350* \param LineNo Line number.1351* \param Ty Metadata describing the type of the variable.1352* \param AlwaysPreserve If true, this descriptor will survive optimizations.1353* \param Flags Flags.1354* \param AlignInBits Variable alignment.1355*/1356LLVMMetadataRef LLVMDIBuilderCreateAutoVariable(1357LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,1358size_t NameLen, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty,1359LLVMBool AlwaysPreserve, LLVMDIFlags Flags, uint32_t AlignInBits);13601361/**1362* Create a new descriptor for a function parameter variable.1363* \param Builder The DIBuilder.1364* \param Scope The local scope the variable is declared in.1365* \param Name Variable name.1366* \param NameLen Length of variable name.1367* \param ArgNo Unique argument number for this variable; starts at 1.1368* \param File File where this variable is defined.1369* \param LineNo Line number.1370* \param Ty Metadata describing the type of the variable.1371* \param AlwaysPreserve If true, this descriptor will survive optimizations.1372* \param Flags Flags.1373*/1374LLVMMetadataRef LLVMDIBuilderCreateParameterVariable(1375LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,1376size_t NameLen, unsigned ArgNo, LLVMMetadataRef File, unsigned LineNo,1377LLVMMetadataRef Ty, LLVMBool AlwaysPreserve, LLVMDIFlags Flags);13781379/**1380* Get the metadata of the subprogram attached to a function.1381*1382* @see llvm::Function::getSubprogram()1383*/1384LLVMMetadataRef LLVMGetSubprogram(LLVMValueRef Func);13851386/**1387* Set the subprogram attached to a function.1388*1389* @see llvm::Function::setSubprogram()1390*/1391void LLVMSetSubprogram(LLVMValueRef Func, LLVMMetadataRef SP);13921393/**1394* Get the line associated with a given subprogram.1395* \param Subprogram The subprogram object.1396*1397* @see DISubprogram::getLine()1398*/1399unsigned LLVMDISubprogramGetLine(LLVMMetadataRef Subprogram);14001401/**1402* Get the debug location for the given instruction.1403*1404* @see llvm::Instruction::getDebugLoc()1405*/1406LLVMMetadataRef LLVMInstructionGetDebugLoc(LLVMValueRef Inst);14071408/**1409* Set the debug location for the given instruction.1410*1411* To clear the location metadata of the given instruction, pass NULL to \p Loc.1412*1413* @see llvm::Instruction::setDebugLoc()1414*/1415void LLVMInstructionSetDebugLoc(LLVMValueRef Inst, LLVMMetadataRef Loc);14161417/**1418* Obtain the enumerated type of a Metadata instance.1419*1420* @see llvm::Metadata::getMetadataID()1421*/1422LLVMMetadataKind LLVMGetMetadataKind(LLVMMetadataRef Metadata);14231424/**1425* @}1426*/14271428LLVM_C_EXTERN_C_END14291430#endif143114321433