10b57cec5SDimitry Andric //===------------ DebugInfo.h - LLVM C API Debug Info API -----------------===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric /// 90b57cec5SDimitry Andric /// This file declares the C API endpoints for generating DWARF Debug Info 100b57cec5SDimitry Andric /// 110b57cec5SDimitry Andric /// Note: This interface is experimental. It is *NOT* stable, and may be 120b57cec5SDimitry Andric /// changed without warning. 130b57cec5SDimitry Andric /// 140b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 150b57cec5SDimitry Andric 160b57cec5SDimitry Andric #ifndef LLVM_C_DEBUGINFO_H 170b57cec5SDimitry Andric #define LLVM_C_DEBUGINFO_H 180b57cec5SDimitry Andric 19480093f4SDimitry Andric #include "llvm-c/ExternC.h" 201fd87a68SDimitry Andric #include "llvm-c/Types.h" 210b57cec5SDimitry Andric 22480093f4SDimitry Andric LLVM_C_EXTERN_C_BEGIN 230b57cec5SDimitry Andric 240b57cec5SDimitry Andric /** 25349cc55cSDimitry Andric * @defgroup LLVMCCoreDebugInfo Debug Information 26349cc55cSDimitry Andric * @ingroup LLVMCCore 27349cc55cSDimitry Andric * 28349cc55cSDimitry Andric * @{ 29349cc55cSDimitry Andric */ 30349cc55cSDimitry Andric 31349cc55cSDimitry Andric /** 320b57cec5SDimitry Andric * Debug info flags. 330b57cec5SDimitry Andric */ 340b57cec5SDimitry Andric typedef enum { 350b57cec5SDimitry Andric LLVMDIFlagZero = 0, 360b57cec5SDimitry Andric LLVMDIFlagPrivate = 1, 370b57cec5SDimitry Andric LLVMDIFlagProtected = 2, 380b57cec5SDimitry Andric LLVMDIFlagPublic = 3, 390b57cec5SDimitry Andric LLVMDIFlagFwdDecl = 1 << 2, 400b57cec5SDimitry Andric LLVMDIFlagAppleBlock = 1 << 3, 418bcb0991SDimitry Andric LLVMDIFlagReservedBit4 = 1 << 4, 420b57cec5SDimitry Andric LLVMDIFlagVirtual = 1 << 5, 430b57cec5SDimitry Andric LLVMDIFlagArtificial = 1 << 6, 440b57cec5SDimitry Andric LLVMDIFlagExplicit = 1 << 7, 450b57cec5SDimitry Andric LLVMDIFlagPrototyped = 1 << 8, 460b57cec5SDimitry Andric LLVMDIFlagObjcClassComplete = 1 << 9, 470b57cec5SDimitry Andric LLVMDIFlagObjectPointer = 1 << 10, 480b57cec5SDimitry Andric LLVMDIFlagVector = 1 << 11, 490b57cec5SDimitry Andric LLVMDIFlagStaticMember = 1 << 12, 500b57cec5SDimitry Andric LLVMDIFlagLValueReference = 1 << 13, 510b57cec5SDimitry Andric LLVMDIFlagRValueReference = 1 << 14, 520b57cec5SDimitry Andric LLVMDIFlagReserved = 1 << 15, 530b57cec5SDimitry Andric LLVMDIFlagSingleInheritance = 1 << 16, 540b57cec5SDimitry Andric LLVMDIFlagMultipleInheritance = 2 << 16, 550b57cec5SDimitry Andric LLVMDIFlagVirtualInheritance = 3 << 16, 560b57cec5SDimitry Andric LLVMDIFlagIntroducedVirtual = 1 << 18, 570b57cec5SDimitry Andric LLVMDIFlagBitField = 1 << 19, 580b57cec5SDimitry Andric LLVMDIFlagNoReturn = 1 << 20, 590b57cec5SDimitry Andric LLVMDIFlagTypePassByValue = 1 << 22, 600b57cec5SDimitry Andric LLVMDIFlagTypePassByReference = 1 << 23, 610b57cec5SDimitry Andric LLVMDIFlagEnumClass = 1 << 24, 620b57cec5SDimitry Andric LLVMDIFlagFixedEnum = LLVMDIFlagEnumClass, // Deprecated. 630b57cec5SDimitry Andric LLVMDIFlagThunk = 1 << 25, 640b57cec5SDimitry Andric LLVMDIFlagNonTrivial = 1 << 26, 650b57cec5SDimitry Andric LLVMDIFlagBigEndian = 1 << 27, 660b57cec5SDimitry Andric LLVMDIFlagLittleEndian = 1 << 28, 670b57cec5SDimitry Andric LLVMDIFlagIndirectVirtualBase = (1 << 2) | (1 << 5), 680b57cec5SDimitry Andric LLVMDIFlagAccessibility = LLVMDIFlagPrivate | LLVMDIFlagProtected | 690b57cec5SDimitry Andric LLVMDIFlagPublic, 700b57cec5SDimitry Andric LLVMDIFlagPtrToMemberRep = LLVMDIFlagSingleInheritance | 710b57cec5SDimitry Andric LLVMDIFlagMultipleInheritance | 720b57cec5SDimitry Andric LLVMDIFlagVirtualInheritance 730b57cec5SDimitry Andric } LLVMDIFlags; 740b57cec5SDimitry Andric 750b57cec5SDimitry Andric /** 760b57cec5SDimitry Andric * Source languages known by DWARF. 770b57cec5SDimitry Andric */ 780b57cec5SDimitry Andric typedef enum { 790b57cec5SDimitry Andric LLVMDWARFSourceLanguageC89, 800b57cec5SDimitry Andric LLVMDWARFSourceLanguageC, 810b57cec5SDimitry Andric LLVMDWARFSourceLanguageAda83, 820b57cec5SDimitry Andric LLVMDWARFSourceLanguageC_plus_plus, 830b57cec5SDimitry Andric LLVMDWARFSourceLanguageCobol74, 840b57cec5SDimitry Andric LLVMDWARFSourceLanguageCobol85, 850b57cec5SDimitry Andric LLVMDWARFSourceLanguageFortran77, 860b57cec5SDimitry Andric LLVMDWARFSourceLanguageFortran90, 870b57cec5SDimitry Andric LLVMDWARFSourceLanguagePascal83, 880b57cec5SDimitry Andric LLVMDWARFSourceLanguageModula2, 890b57cec5SDimitry Andric // New in DWARF v3: 900b57cec5SDimitry Andric LLVMDWARFSourceLanguageJava, 910b57cec5SDimitry Andric LLVMDWARFSourceLanguageC99, 920b57cec5SDimitry Andric LLVMDWARFSourceLanguageAda95, 930b57cec5SDimitry Andric LLVMDWARFSourceLanguageFortran95, 940b57cec5SDimitry Andric LLVMDWARFSourceLanguagePLI, 950b57cec5SDimitry Andric LLVMDWARFSourceLanguageObjC, 960b57cec5SDimitry Andric LLVMDWARFSourceLanguageObjC_plus_plus, 970b57cec5SDimitry Andric LLVMDWARFSourceLanguageUPC, 980b57cec5SDimitry Andric LLVMDWARFSourceLanguageD, 990b57cec5SDimitry Andric // New in DWARF v4: 1000b57cec5SDimitry Andric LLVMDWARFSourceLanguagePython, 1010b57cec5SDimitry Andric // New in DWARF v5: 1020b57cec5SDimitry Andric LLVMDWARFSourceLanguageOpenCL, 1030b57cec5SDimitry Andric LLVMDWARFSourceLanguageGo, 1040b57cec5SDimitry Andric LLVMDWARFSourceLanguageModula3, 1050b57cec5SDimitry Andric LLVMDWARFSourceLanguageHaskell, 1060b57cec5SDimitry Andric LLVMDWARFSourceLanguageC_plus_plus_03, 1070b57cec5SDimitry Andric LLVMDWARFSourceLanguageC_plus_plus_11, 1080b57cec5SDimitry Andric LLVMDWARFSourceLanguageOCaml, 1090b57cec5SDimitry Andric LLVMDWARFSourceLanguageRust, 1100b57cec5SDimitry Andric LLVMDWARFSourceLanguageC11, 1110b57cec5SDimitry Andric LLVMDWARFSourceLanguageSwift, 1120b57cec5SDimitry Andric LLVMDWARFSourceLanguageJulia, 1130b57cec5SDimitry Andric LLVMDWARFSourceLanguageDylan, 1140b57cec5SDimitry Andric LLVMDWARFSourceLanguageC_plus_plus_14, 1150b57cec5SDimitry Andric LLVMDWARFSourceLanguageFortran03, 1160b57cec5SDimitry Andric LLVMDWARFSourceLanguageFortran08, 1170b57cec5SDimitry Andric LLVMDWARFSourceLanguageRenderScript, 1180b57cec5SDimitry Andric LLVMDWARFSourceLanguageBLISS, 119bdd1243dSDimitry Andric LLVMDWARFSourceLanguageKotlin, 120bdd1243dSDimitry Andric LLVMDWARFSourceLanguageZig, 121bdd1243dSDimitry Andric LLVMDWARFSourceLanguageCrystal, 122bdd1243dSDimitry Andric LLVMDWARFSourceLanguageC_plus_plus_17, 123bdd1243dSDimitry Andric LLVMDWARFSourceLanguageC_plus_plus_20, 124bdd1243dSDimitry Andric LLVMDWARFSourceLanguageC17, 125bdd1243dSDimitry Andric LLVMDWARFSourceLanguageFortran18, 126bdd1243dSDimitry Andric LLVMDWARFSourceLanguageAda2005, 127bdd1243dSDimitry Andric LLVMDWARFSourceLanguageAda2012, 128*0fca6ea1SDimitry Andric LLVMDWARFSourceLanguageHIP, 129*0fca6ea1SDimitry Andric LLVMDWARFSourceLanguageAssembly, 130*0fca6ea1SDimitry Andric LLVMDWARFSourceLanguageC_sharp, 13106c3fb27SDimitry Andric LLVMDWARFSourceLanguageMojo, 132*0fca6ea1SDimitry Andric LLVMDWARFSourceLanguageGLSL, 133*0fca6ea1SDimitry Andric LLVMDWARFSourceLanguageGLSL_ES, 134*0fca6ea1SDimitry Andric LLVMDWARFSourceLanguageHLSL, 135*0fca6ea1SDimitry Andric LLVMDWARFSourceLanguageOpenCL_CPP, 136*0fca6ea1SDimitry Andric LLVMDWARFSourceLanguageCPP_for_OpenCL, 137*0fca6ea1SDimitry Andric LLVMDWARFSourceLanguageSYCL, 138*0fca6ea1SDimitry Andric LLVMDWARFSourceLanguageRuby, 139*0fca6ea1SDimitry Andric LLVMDWARFSourceLanguageMove, 140*0fca6ea1SDimitry Andric LLVMDWARFSourceLanguageHylo, 141*0fca6ea1SDimitry Andric 1420b57cec5SDimitry Andric // Vendor extensions: 1430b57cec5SDimitry Andric LLVMDWARFSourceLanguageMips_Assembler, 1440b57cec5SDimitry Andric LLVMDWARFSourceLanguageGOOGLE_RenderScript, 1450b57cec5SDimitry Andric LLVMDWARFSourceLanguageBORLAND_Delphi 1460b57cec5SDimitry Andric } LLVMDWARFSourceLanguage; 1470b57cec5SDimitry Andric 1480b57cec5SDimitry Andric /** 1490b57cec5SDimitry Andric * The amount of debug information to emit. 1500b57cec5SDimitry Andric */ 1510b57cec5SDimitry Andric typedef enum { 1520b57cec5SDimitry Andric LLVMDWARFEmissionNone = 0, 1530b57cec5SDimitry Andric LLVMDWARFEmissionFull, 1540b57cec5SDimitry Andric LLVMDWARFEmissionLineTablesOnly 1550b57cec5SDimitry Andric } LLVMDWARFEmissionKind; 1560b57cec5SDimitry Andric 1570b57cec5SDimitry Andric /** 1580b57cec5SDimitry Andric * The kind of metadata nodes. 1590b57cec5SDimitry Andric */ 1600b57cec5SDimitry Andric enum { 1610b57cec5SDimitry Andric LLVMMDStringMetadataKind, 1620b57cec5SDimitry Andric LLVMConstantAsMetadataMetadataKind, 1630b57cec5SDimitry Andric LLVMLocalAsMetadataMetadataKind, 1640b57cec5SDimitry Andric LLVMDistinctMDOperandPlaceholderMetadataKind, 1650b57cec5SDimitry Andric LLVMMDTupleMetadataKind, 1660b57cec5SDimitry Andric LLVMDILocationMetadataKind, 1670b57cec5SDimitry Andric LLVMDIExpressionMetadataKind, 1680b57cec5SDimitry Andric LLVMDIGlobalVariableExpressionMetadataKind, 1690b57cec5SDimitry Andric LLVMGenericDINodeMetadataKind, 1700b57cec5SDimitry Andric LLVMDISubrangeMetadataKind, 1710b57cec5SDimitry Andric LLVMDIEnumeratorMetadataKind, 1720b57cec5SDimitry Andric LLVMDIBasicTypeMetadataKind, 1730b57cec5SDimitry Andric LLVMDIDerivedTypeMetadataKind, 1740b57cec5SDimitry Andric LLVMDICompositeTypeMetadataKind, 1750b57cec5SDimitry Andric LLVMDISubroutineTypeMetadataKind, 1760b57cec5SDimitry Andric LLVMDIFileMetadataKind, 1770b57cec5SDimitry Andric LLVMDICompileUnitMetadataKind, 1780b57cec5SDimitry Andric LLVMDISubprogramMetadataKind, 1790b57cec5SDimitry Andric LLVMDILexicalBlockMetadataKind, 1800b57cec5SDimitry Andric LLVMDILexicalBlockFileMetadataKind, 1810b57cec5SDimitry Andric LLVMDINamespaceMetadataKind, 1820b57cec5SDimitry Andric LLVMDIModuleMetadataKind, 1830b57cec5SDimitry Andric LLVMDITemplateTypeParameterMetadataKind, 1840b57cec5SDimitry Andric LLVMDITemplateValueParameterMetadataKind, 1850b57cec5SDimitry Andric LLVMDIGlobalVariableMetadataKind, 1860b57cec5SDimitry Andric LLVMDILocalVariableMetadataKind, 1870b57cec5SDimitry Andric LLVMDILabelMetadataKind, 1880b57cec5SDimitry Andric LLVMDIObjCPropertyMetadataKind, 1890b57cec5SDimitry Andric LLVMDIImportedEntityMetadataKind, 1900b57cec5SDimitry Andric LLVMDIMacroMetadataKind, 1910b57cec5SDimitry Andric LLVMDIMacroFileMetadataKind, 192e8d8bef9SDimitry Andric LLVMDICommonBlockMetadataKind, 193e8d8bef9SDimitry Andric LLVMDIStringTypeMetadataKind, 194fe6060f1SDimitry Andric LLVMDIGenericSubrangeMetadataKind, 195bdd1243dSDimitry Andric LLVMDIArgListMetadataKind, 196bdd1243dSDimitry Andric LLVMDIAssignIDMetadataKind, 1970b57cec5SDimitry Andric }; 1980b57cec5SDimitry Andric typedef unsigned LLVMMetadataKind; 1990b57cec5SDimitry Andric 2000b57cec5SDimitry Andric /** 2010b57cec5SDimitry Andric * An LLVM DWARF type encoding. 2020b57cec5SDimitry Andric */ 2030b57cec5SDimitry Andric typedef unsigned LLVMDWARFTypeEncoding; 2040b57cec5SDimitry Andric 2050b57cec5SDimitry Andric /** 2068bcb0991SDimitry Andric * Describes the kind of macro declaration used for LLVMDIBuilderCreateMacro. 2078bcb0991SDimitry Andric * @see llvm::dwarf::MacinfoRecordType 2088bcb0991SDimitry Andric * @note Values are from DW_MACINFO_* constants in the DWARF specification. 2098bcb0991SDimitry Andric */ 2108bcb0991SDimitry Andric typedef enum { 2118bcb0991SDimitry Andric LLVMDWARFMacinfoRecordTypeDefine = 0x01, 2128bcb0991SDimitry Andric LLVMDWARFMacinfoRecordTypeMacro = 0x02, 2138bcb0991SDimitry Andric LLVMDWARFMacinfoRecordTypeStartFile = 0x03, 2148bcb0991SDimitry Andric LLVMDWARFMacinfoRecordTypeEndFile = 0x04, 2158bcb0991SDimitry Andric LLVMDWARFMacinfoRecordTypeVendorExt = 0xff 2168bcb0991SDimitry Andric } LLVMDWARFMacinfoRecordType; 2178bcb0991SDimitry Andric 2188bcb0991SDimitry Andric /** 2190b57cec5SDimitry Andric * The current debug metadata version number. 2200b57cec5SDimitry Andric */ 2210b57cec5SDimitry Andric unsigned LLVMDebugMetadataVersion(void); 2220b57cec5SDimitry Andric 2230b57cec5SDimitry Andric /** 2240b57cec5SDimitry Andric * The version of debug metadata that's present in the provided \c Module. 2250b57cec5SDimitry Andric */ 2260b57cec5SDimitry Andric unsigned LLVMGetModuleDebugMetadataVersion(LLVMModuleRef Module); 2270b57cec5SDimitry Andric 2280b57cec5SDimitry Andric /** 2290b57cec5SDimitry Andric * Strip debug info in the module if it exists. 2300b57cec5SDimitry Andric * To do this, we remove all calls to the debugger intrinsics and any named 2310b57cec5SDimitry Andric * metadata for debugging. We also remove debug locations for instructions. 2320b57cec5SDimitry Andric * Return true if module is modified. 2330b57cec5SDimitry Andric */ 2340b57cec5SDimitry Andric LLVMBool LLVMStripModuleDebugInfo(LLVMModuleRef Module); 2350b57cec5SDimitry Andric 2360b57cec5SDimitry Andric /** 2370b57cec5SDimitry Andric * Construct a builder for a module, and do not allow for unresolved nodes 2380b57cec5SDimitry Andric * attached to the module. 2390b57cec5SDimitry Andric */ 2400b57cec5SDimitry Andric LLVMDIBuilderRef LLVMCreateDIBuilderDisallowUnresolved(LLVMModuleRef M); 2410b57cec5SDimitry Andric 2420b57cec5SDimitry Andric /** 2430b57cec5SDimitry Andric * Construct a builder for a module and collect unresolved nodes attached 2440b57cec5SDimitry Andric * to the module in order to resolve cycles during a call to 2450b57cec5SDimitry Andric * \c LLVMDIBuilderFinalize. 2460b57cec5SDimitry Andric */ 2470b57cec5SDimitry Andric LLVMDIBuilderRef LLVMCreateDIBuilder(LLVMModuleRef M); 2480b57cec5SDimitry Andric 2490b57cec5SDimitry Andric /** 2500b57cec5SDimitry Andric * Deallocates the \c DIBuilder and everything it owns. 2510b57cec5SDimitry Andric * @note You must call \c LLVMDIBuilderFinalize before this 2520b57cec5SDimitry Andric */ 2530b57cec5SDimitry Andric void LLVMDisposeDIBuilder(LLVMDIBuilderRef Builder); 2540b57cec5SDimitry Andric 2550b57cec5SDimitry Andric /** 2560b57cec5SDimitry Andric * Construct any deferred debug info descriptors. 2570b57cec5SDimitry Andric */ 2580b57cec5SDimitry Andric void LLVMDIBuilderFinalize(LLVMDIBuilderRef Builder); 2590b57cec5SDimitry Andric 2600b57cec5SDimitry Andric /** 261349cc55cSDimitry Andric * Finalize a specific subprogram. 262349cc55cSDimitry Andric * No new variables may be added to this subprogram afterwards. 263349cc55cSDimitry Andric */ 264349cc55cSDimitry Andric void LLVMDIBuilderFinalizeSubprogram(LLVMDIBuilderRef Builder, 265349cc55cSDimitry Andric LLVMMetadataRef Subprogram); 266349cc55cSDimitry Andric 267349cc55cSDimitry Andric /** 2680b57cec5SDimitry Andric * A CompileUnit provides an anchor for all debugging 2690b57cec5SDimitry Andric * information generated during this instance of compilation. 2700b57cec5SDimitry Andric * \param Lang Source programming language, eg. 2710b57cec5SDimitry Andric * \c LLVMDWARFSourceLanguageC99 2720b57cec5SDimitry Andric * \param FileRef File info. 2730b57cec5SDimitry Andric * \param Producer Identify the producer of debugging information 2740b57cec5SDimitry Andric * and code. Usually this is a compiler 2750b57cec5SDimitry Andric * version string. 2760b57cec5SDimitry Andric * \param ProducerLen The length of the C string passed to \c Producer. 2770b57cec5SDimitry Andric * \param isOptimized A boolean flag which indicates whether optimization 2780b57cec5SDimitry Andric * is enabled or not. 2790b57cec5SDimitry Andric * \param Flags This string lists command line options. This 2800b57cec5SDimitry Andric * string is directly embedded in debug info 2810b57cec5SDimitry Andric * output which may be used by a tool 2820b57cec5SDimitry Andric * analyzing generated debugging information. 2830b57cec5SDimitry Andric * \param FlagsLen The length of the C string passed to \c Flags. 2840b57cec5SDimitry Andric * \param RuntimeVer This indicates runtime version for languages like 2850b57cec5SDimitry Andric * Objective-C. 2860b57cec5SDimitry Andric * \param SplitName The name of the file that we'll split debug info 2870b57cec5SDimitry Andric * out into. 2880b57cec5SDimitry Andric * \param SplitNameLen The length of the C string passed to \c SplitName. 2890b57cec5SDimitry Andric * \param Kind The kind of debug information to generate. 2900b57cec5SDimitry Andric * \param DWOId The DWOId if this is a split skeleton compile unit. 2910b57cec5SDimitry Andric * \param SplitDebugInlining Whether to emit inline debug info. 2920b57cec5SDimitry Andric * \param DebugInfoForProfiling Whether to emit extra debug info for 2930b57cec5SDimitry Andric * profile collection. 2945ffd83dbSDimitry Andric * \param SysRoot The Clang system root (value of -isysroot). 2955ffd83dbSDimitry Andric * \param SysRootLen The length of the C string passed to \c SysRoot. 2965ffd83dbSDimitry Andric * \param SDK The SDK. On Darwin, the last component of the sysroot. 2975ffd83dbSDimitry Andric * \param SDKLen The length of the C string passed to \c SDK. 2980b57cec5SDimitry Andric */ 2990b57cec5SDimitry Andric LLVMMetadataRef LLVMDIBuilderCreateCompileUnit( 3000b57cec5SDimitry Andric LLVMDIBuilderRef Builder, LLVMDWARFSourceLanguage Lang, 3010b57cec5SDimitry Andric LLVMMetadataRef FileRef, const char *Producer, size_t ProducerLen, 3020b57cec5SDimitry Andric LLVMBool isOptimized, const char *Flags, size_t FlagsLen, 3030b57cec5SDimitry Andric unsigned RuntimeVer, const char *SplitName, size_t SplitNameLen, 3040b57cec5SDimitry Andric LLVMDWARFEmissionKind Kind, unsigned DWOId, LLVMBool SplitDebugInlining, 3055ffd83dbSDimitry Andric LLVMBool DebugInfoForProfiling, const char *SysRoot, size_t SysRootLen, 3065ffd83dbSDimitry Andric const char *SDK, size_t SDKLen); 3070b57cec5SDimitry Andric 3080b57cec5SDimitry Andric /** 3090b57cec5SDimitry Andric * Create a file descriptor to hold debugging information for a file. 3100b57cec5SDimitry Andric * \param Builder The \c DIBuilder. 3110b57cec5SDimitry Andric * \param Filename File name. 3120b57cec5SDimitry Andric * \param FilenameLen The length of the C string passed to \c Filename. 3130b57cec5SDimitry Andric * \param Directory Directory. 3140b57cec5SDimitry Andric * \param DirectoryLen The length of the C string passed to \c Directory. 3150b57cec5SDimitry Andric */ 3160b57cec5SDimitry Andric LLVMMetadataRef 3170b57cec5SDimitry Andric LLVMDIBuilderCreateFile(LLVMDIBuilderRef Builder, const char *Filename, 3180b57cec5SDimitry Andric size_t FilenameLen, const char *Directory, 3190b57cec5SDimitry Andric size_t DirectoryLen); 3200b57cec5SDimitry Andric 3210b57cec5SDimitry Andric /** 3220b57cec5SDimitry Andric * Creates a new descriptor for a module with the specified parent scope. 3230b57cec5SDimitry Andric * \param Builder The \c DIBuilder. 3240b57cec5SDimitry Andric * \param ParentScope The parent scope containing this module declaration. 3250b57cec5SDimitry Andric * \param Name Module name. 3260b57cec5SDimitry Andric * \param NameLen The length of the C string passed to \c Name. 3270b57cec5SDimitry Andric * \param ConfigMacros A space-separated shell-quoted list of -D macro 3280b57cec5SDimitry Andric definitions as they would appear on a command line. 3290b57cec5SDimitry Andric * \param ConfigMacrosLen The length of the C string passed to \c ConfigMacros. 3300b57cec5SDimitry Andric * \param IncludePath The path to the module map file. 3310b57cec5SDimitry Andric * \param IncludePathLen The length of the C string passed to \c IncludePath. 3325ffd83dbSDimitry Andric * \param APINotesFile The path to an API notes file for the module. 3335ffd83dbSDimitry Andric * \param APINotesFileLen The length of the C string passed to \c APINotestFile. 3340b57cec5SDimitry Andric */ 3350b57cec5SDimitry Andric LLVMMetadataRef 3360b57cec5SDimitry Andric LLVMDIBuilderCreateModule(LLVMDIBuilderRef Builder, LLVMMetadataRef ParentScope, 3370b57cec5SDimitry Andric const char *Name, size_t NameLen, 3380b57cec5SDimitry Andric const char *ConfigMacros, size_t ConfigMacrosLen, 3390b57cec5SDimitry Andric const char *IncludePath, size_t IncludePathLen, 3405ffd83dbSDimitry Andric const char *APINotesFile, size_t APINotesFileLen); 3410b57cec5SDimitry Andric 3420b57cec5SDimitry Andric /** 3430b57cec5SDimitry Andric * Creates a new descriptor for a namespace with the specified parent scope. 3440b57cec5SDimitry Andric * \param Builder The \c DIBuilder. 3450b57cec5SDimitry Andric * \param ParentScope The parent scope containing this module declaration. 3460b57cec5SDimitry Andric * \param Name NameSpace name. 3470b57cec5SDimitry Andric * \param NameLen The length of the C string passed to \c Name. 3480b57cec5SDimitry Andric * \param ExportSymbols Whether or not the namespace exports symbols, e.g. 3490b57cec5SDimitry Andric * this is true of C++ inline namespaces. 3500b57cec5SDimitry Andric */ 3510b57cec5SDimitry Andric LLVMMetadataRef 3520b57cec5SDimitry Andric LLVMDIBuilderCreateNameSpace(LLVMDIBuilderRef Builder, 3530b57cec5SDimitry Andric LLVMMetadataRef ParentScope, 3540b57cec5SDimitry Andric const char *Name, size_t NameLen, 3550b57cec5SDimitry Andric LLVMBool ExportSymbols); 3560b57cec5SDimitry Andric 3570b57cec5SDimitry Andric /** 3580b57cec5SDimitry Andric * Create a new descriptor for the specified subprogram. 3590b57cec5SDimitry Andric * \param Builder The \c DIBuilder. 3600b57cec5SDimitry Andric * \param Scope Function scope. 3610b57cec5SDimitry Andric * \param Name Function name. 3620b57cec5SDimitry Andric * \param NameLen Length of enumeration name. 3630b57cec5SDimitry Andric * \param LinkageName Mangled function name. 3640b57cec5SDimitry Andric * \param LinkageNameLen Length of linkage name. 3650b57cec5SDimitry Andric * \param File File where this variable is defined. 3660b57cec5SDimitry Andric * \param LineNo Line number. 3670b57cec5SDimitry Andric * \param Ty Function type. 3680b57cec5SDimitry Andric * \param IsLocalToUnit True if this function is not externally visible. 3690b57cec5SDimitry Andric * \param IsDefinition True if this is a function definition. 3700b57cec5SDimitry Andric * \param ScopeLine Set to the beginning of the scope this starts 3710b57cec5SDimitry Andric * \param Flags E.g.: \c LLVMDIFlagLValueReference. These flags are 3720b57cec5SDimitry Andric * used to emit dwarf attributes. 3730b57cec5SDimitry Andric * \param IsOptimized True if optimization is ON. 3740b57cec5SDimitry Andric */ 3750b57cec5SDimitry Andric LLVMMetadataRef LLVMDIBuilderCreateFunction( 3760b57cec5SDimitry Andric LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, 3770b57cec5SDimitry Andric size_t NameLen, const char *LinkageName, size_t LinkageNameLen, 3780b57cec5SDimitry Andric LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty, 3790b57cec5SDimitry Andric LLVMBool IsLocalToUnit, LLVMBool IsDefinition, 3800b57cec5SDimitry Andric unsigned ScopeLine, LLVMDIFlags Flags, LLVMBool IsOptimized); 3810b57cec5SDimitry Andric 3820b57cec5SDimitry Andric /** 3830b57cec5SDimitry Andric * Create a descriptor for a lexical block with the specified parent context. 3840b57cec5SDimitry Andric * \param Builder The \c DIBuilder. 3850b57cec5SDimitry Andric * \param Scope Parent lexical block. 3860b57cec5SDimitry Andric * \param File Source file. 3870b57cec5SDimitry Andric * \param Line The line in the source file. 3880b57cec5SDimitry Andric * \param Column The column in the source file. 3890b57cec5SDimitry Andric */ 3900b57cec5SDimitry Andric LLVMMetadataRef LLVMDIBuilderCreateLexicalBlock( 3910b57cec5SDimitry Andric LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, 3920b57cec5SDimitry Andric LLVMMetadataRef File, unsigned Line, unsigned Column); 3930b57cec5SDimitry Andric 3940b57cec5SDimitry Andric /** 3950b57cec5SDimitry Andric * Create a descriptor for a lexical block with a new file attached. 3960b57cec5SDimitry Andric * \param Builder The \c DIBuilder. 3970b57cec5SDimitry Andric * \param Scope Lexical block. 3980b57cec5SDimitry Andric * \param File Source file. 3990b57cec5SDimitry Andric * \param Discriminator DWARF path discriminator value. 4000b57cec5SDimitry Andric */ 4010b57cec5SDimitry Andric LLVMMetadataRef 4020b57cec5SDimitry Andric LLVMDIBuilderCreateLexicalBlockFile(LLVMDIBuilderRef Builder, 4030b57cec5SDimitry Andric LLVMMetadataRef Scope, 4040b57cec5SDimitry Andric LLVMMetadataRef File, 4050b57cec5SDimitry Andric unsigned Discriminator); 4060b57cec5SDimitry Andric 4070b57cec5SDimitry Andric /** 4080b57cec5SDimitry Andric * Create a descriptor for an imported namespace. Suitable for e.g. C++ 4090b57cec5SDimitry Andric * using declarations. 4100b57cec5SDimitry Andric * \param Builder The \c DIBuilder. 4110b57cec5SDimitry Andric * \param Scope The scope this module is imported into 4120b57cec5SDimitry Andric * \param File File where the declaration is located. 4130b57cec5SDimitry Andric * \param Line Line number of the declaration. 4140b57cec5SDimitry Andric */ 4150b57cec5SDimitry Andric LLVMMetadataRef 4160b57cec5SDimitry Andric LLVMDIBuilderCreateImportedModuleFromNamespace(LLVMDIBuilderRef Builder, 4170b57cec5SDimitry Andric LLVMMetadataRef Scope, 4180b57cec5SDimitry Andric LLVMMetadataRef NS, 4190b57cec5SDimitry Andric LLVMMetadataRef File, 4200b57cec5SDimitry Andric unsigned Line); 4210b57cec5SDimitry Andric 4220b57cec5SDimitry Andric /** 4230b57cec5SDimitry Andric * Create a descriptor for an imported module that aliases another 4240b57cec5SDimitry Andric * imported entity descriptor. 4250b57cec5SDimitry Andric * \param Builder The \c DIBuilder. 4260b57cec5SDimitry Andric * \param Scope The scope this module is imported into 4270b57cec5SDimitry Andric * \param ImportedEntity Previous imported entity to alias. 4280b57cec5SDimitry Andric * \param File File where the declaration is located. 4290b57cec5SDimitry Andric * \param Line Line number of the declaration. 430349cc55cSDimitry Andric * \param Elements Renamed elements. 431349cc55cSDimitry Andric * \param NumElements Number of renamed elements. 4320b57cec5SDimitry Andric */ 433349cc55cSDimitry Andric LLVMMetadataRef LLVMDIBuilderCreateImportedModuleFromAlias( 434349cc55cSDimitry Andric LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, 435349cc55cSDimitry Andric LLVMMetadataRef ImportedEntity, LLVMMetadataRef File, unsigned Line, 436349cc55cSDimitry Andric LLVMMetadataRef *Elements, unsigned NumElements); 4370b57cec5SDimitry Andric 4380b57cec5SDimitry Andric /** 4390b57cec5SDimitry Andric * Create a descriptor for an imported module. 4400b57cec5SDimitry Andric * \param Builder The \c DIBuilder. 4410b57cec5SDimitry Andric * \param Scope The scope this module is imported into 4420b57cec5SDimitry Andric * \param M The module being imported here 4430b57cec5SDimitry Andric * \param File File where the declaration is located. 4440b57cec5SDimitry Andric * \param Line Line number of the declaration. 445349cc55cSDimitry Andric * \param Elements Renamed elements. 446349cc55cSDimitry Andric * \param NumElements Number of renamed elements. 4470b57cec5SDimitry Andric */ 448349cc55cSDimitry Andric LLVMMetadataRef LLVMDIBuilderCreateImportedModuleFromModule( 449349cc55cSDimitry Andric LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, LLVMMetadataRef M, 450349cc55cSDimitry Andric LLVMMetadataRef File, unsigned Line, LLVMMetadataRef *Elements, 451349cc55cSDimitry Andric unsigned NumElements); 4520b57cec5SDimitry Andric 4530b57cec5SDimitry Andric /** 4540b57cec5SDimitry Andric * Create a descriptor for an imported function, type, or variable. Suitable 4550b57cec5SDimitry Andric * for e.g. FORTRAN-style USE declarations. 4560b57cec5SDimitry Andric * \param Builder The DIBuilder. 4570b57cec5SDimitry Andric * \param Scope The scope this module is imported into. 4580b57cec5SDimitry Andric * \param Decl The declaration (or definition) of a function, type, 4590b57cec5SDimitry Andric or variable. 4600b57cec5SDimitry Andric * \param File File where the declaration is located. 4610b57cec5SDimitry Andric * \param Line Line number of the declaration. 462349cc55cSDimitry Andric * \param Name A name that uniquely identifies this imported 463349cc55cSDimitry Andric declaration. 4640b57cec5SDimitry Andric * \param NameLen The length of the C string passed to \c Name. 465349cc55cSDimitry Andric * \param Elements Renamed elements. 466349cc55cSDimitry Andric * \param NumElements Number of renamed elements. 4670b57cec5SDimitry Andric */ 468349cc55cSDimitry Andric LLVMMetadataRef LLVMDIBuilderCreateImportedDeclaration( 469349cc55cSDimitry Andric LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, LLVMMetadataRef Decl, 470349cc55cSDimitry Andric LLVMMetadataRef File, unsigned Line, const char *Name, size_t NameLen, 471349cc55cSDimitry Andric LLVMMetadataRef *Elements, unsigned NumElements); 4720b57cec5SDimitry Andric 4730b57cec5SDimitry Andric /** 4740b57cec5SDimitry Andric * Creates a new DebugLocation that describes a source location. 4750b57cec5SDimitry Andric * \param Line The line in the source file. 4760b57cec5SDimitry Andric * \param Column The column in the source file. 4770b57cec5SDimitry Andric * \param Scope The scope in which the location resides. 4780b57cec5SDimitry Andric * \param InlinedAt The scope where this location was inlined, if at all. 4790b57cec5SDimitry Andric * (optional). 4800b57cec5SDimitry Andric * \note If the item to which this location is attached cannot be 4810b57cec5SDimitry Andric * attributed to a source line, pass 0 for the line and column. 4820b57cec5SDimitry Andric */ 4830b57cec5SDimitry Andric LLVMMetadataRef 4840b57cec5SDimitry Andric LLVMDIBuilderCreateDebugLocation(LLVMContextRef Ctx, unsigned Line, 4850b57cec5SDimitry Andric unsigned Column, LLVMMetadataRef Scope, 4860b57cec5SDimitry Andric LLVMMetadataRef InlinedAt); 4870b57cec5SDimitry Andric 4880b57cec5SDimitry Andric /** 4890b57cec5SDimitry Andric * Get the line number of this debug location. 4900b57cec5SDimitry Andric * \param Location The debug location. 4910b57cec5SDimitry Andric * 4920b57cec5SDimitry Andric * @see DILocation::getLine() 4930b57cec5SDimitry Andric */ 4940b57cec5SDimitry Andric unsigned LLVMDILocationGetLine(LLVMMetadataRef Location); 4950b57cec5SDimitry Andric 4960b57cec5SDimitry Andric /** 4970b57cec5SDimitry Andric * Get the column number of this debug location. 4980b57cec5SDimitry Andric * \param Location The debug location. 4990b57cec5SDimitry Andric * 5000b57cec5SDimitry Andric * @see DILocation::getColumn() 5010b57cec5SDimitry Andric */ 5020b57cec5SDimitry Andric unsigned LLVMDILocationGetColumn(LLVMMetadataRef Location); 5030b57cec5SDimitry Andric 5040b57cec5SDimitry Andric /** 5050b57cec5SDimitry Andric * Get the local scope associated with this debug location. 5060b57cec5SDimitry Andric * \param Location The debug location. 5070b57cec5SDimitry Andric * 5080b57cec5SDimitry Andric * @see DILocation::getScope() 5090b57cec5SDimitry Andric */ 5100b57cec5SDimitry Andric LLVMMetadataRef LLVMDILocationGetScope(LLVMMetadataRef Location); 5110b57cec5SDimitry Andric 5120b57cec5SDimitry Andric /** 5130b57cec5SDimitry Andric * Get the "inline at" location associated with this debug location. 5140b57cec5SDimitry Andric * \param Location The debug location. 5150b57cec5SDimitry Andric * 5160b57cec5SDimitry Andric * @see DILocation::getInlinedAt() 5170b57cec5SDimitry Andric */ 5180b57cec5SDimitry Andric LLVMMetadataRef LLVMDILocationGetInlinedAt(LLVMMetadataRef Location); 5190b57cec5SDimitry Andric 5200b57cec5SDimitry Andric /** 5210b57cec5SDimitry Andric * Get the metadata of the file associated with a given scope. 5220b57cec5SDimitry Andric * \param Scope The scope object. 5230b57cec5SDimitry Andric * 5240b57cec5SDimitry Andric * @see DIScope::getFile() 5250b57cec5SDimitry Andric */ 5260b57cec5SDimitry Andric LLVMMetadataRef LLVMDIScopeGetFile(LLVMMetadataRef Scope); 5270b57cec5SDimitry Andric 5280b57cec5SDimitry Andric /** 5290b57cec5SDimitry Andric * Get the directory of a given file. 5300b57cec5SDimitry Andric * \param File The file object. 5310b57cec5SDimitry Andric * \param Len The length of the returned string. 5320b57cec5SDimitry Andric * 5330b57cec5SDimitry Andric * @see DIFile::getDirectory() 5340b57cec5SDimitry Andric */ 5350b57cec5SDimitry Andric const char *LLVMDIFileGetDirectory(LLVMMetadataRef File, unsigned *Len); 5360b57cec5SDimitry Andric 5370b57cec5SDimitry Andric /** 5380b57cec5SDimitry Andric * Get the name of a given file. 5390b57cec5SDimitry Andric * \param File The file object. 5400b57cec5SDimitry Andric * \param Len The length of the returned string. 5410b57cec5SDimitry Andric * 5420b57cec5SDimitry Andric * @see DIFile::getFilename() 5430b57cec5SDimitry Andric */ 5440b57cec5SDimitry Andric const char *LLVMDIFileGetFilename(LLVMMetadataRef File, unsigned *Len); 5450b57cec5SDimitry Andric 5460b57cec5SDimitry Andric /** 5470b57cec5SDimitry Andric * Get the source of a given file. 5480b57cec5SDimitry Andric * \param File The file object. 5490b57cec5SDimitry Andric * \param Len The length of the returned string. 5500b57cec5SDimitry Andric * 5510b57cec5SDimitry Andric * @see DIFile::getSource() 5520b57cec5SDimitry Andric */ 5530b57cec5SDimitry Andric const char *LLVMDIFileGetSource(LLVMMetadataRef File, unsigned *Len); 5540b57cec5SDimitry Andric 5550b57cec5SDimitry Andric /** 5560b57cec5SDimitry Andric * Create a type array. 5570b57cec5SDimitry Andric * \param Builder The DIBuilder. 5580b57cec5SDimitry Andric * \param Data The type elements. 5590b57cec5SDimitry Andric * \param NumElements Number of type elements. 5600b57cec5SDimitry Andric */ 5610b57cec5SDimitry Andric LLVMMetadataRef LLVMDIBuilderGetOrCreateTypeArray(LLVMDIBuilderRef Builder, 5620b57cec5SDimitry Andric LLVMMetadataRef *Data, 5630b57cec5SDimitry Andric size_t NumElements); 5640b57cec5SDimitry Andric 5650b57cec5SDimitry Andric /** 5660b57cec5SDimitry Andric * Create subroutine type. 5670b57cec5SDimitry Andric * \param Builder The DIBuilder. 5680b57cec5SDimitry Andric * \param File The file in which the subroutine resides. 5690b57cec5SDimitry Andric * \param ParameterTypes An array of subroutine parameter types. This 5700b57cec5SDimitry Andric * includes return type at 0th index. 5710b57cec5SDimitry Andric * \param NumParameterTypes The number of parameter types in \c ParameterTypes 5720b57cec5SDimitry Andric * \param Flags E.g.: \c LLVMDIFlagLValueReference. 5730b57cec5SDimitry Andric * These flags are used to emit dwarf attributes. 5740b57cec5SDimitry Andric */ 5750b57cec5SDimitry Andric LLVMMetadataRef 5760b57cec5SDimitry Andric LLVMDIBuilderCreateSubroutineType(LLVMDIBuilderRef Builder, 5770b57cec5SDimitry Andric LLVMMetadataRef File, 5780b57cec5SDimitry Andric LLVMMetadataRef *ParameterTypes, 5790b57cec5SDimitry Andric unsigned NumParameterTypes, 5800b57cec5SDimitry Andric LLVMDIFlags Flags); 5810b57cec5SDimitry Andric 5820b57cec5SDimitry Andric /** 5838bcb0991SDimitry Andric * Create debugging information entry for a macro. 5848bcb0991SDimitry Andric * @param Builder The DIBuilder. 5858bcb0991SDimitry Andric * @param ParentMacroFile Macro parent (could be NULL). 5868bcb0991SDimitry Andric * @param Line Source line number where the macro is defined. 5878bcb0991SDimitry Andric * @param RecordType DW_MACINFO_define or DW_MACINFO_undef. 5888bcb0991SDimitry Andric * @param Name Macro name. 5898bcb0991SDimitry Andric * @param NameLen Macro name length. 5908bcb0991SDimitry Andric * @param Value Macro value. 5918bcb0991SDimitry Andric * @param ValueLen Macro value length. 5928bcb0991SDimitry Andric */ 5938bcb0991SDimitry Andric LLVMMetadataRef LLVMDIBuilderCreateMacro(LLVMDIBuilderRef Builder, 5948bcb0991SDimitry Andric LLVMMetadataRef ParentMacroFile, 5958bcb0991SDimitry Andric unsigned Line, 5968bcb0991SDimitry Andric LLVMDWARFMacinfoRecordType RecordType, 5978bcb0991SDimitry Andric const char *Name, size_t NameLen, 5988bcb0991SDimitry Andric const char *Value, size_t ValueLen); 5998bcb0991SDimitry Andric 6008bcb0991SDimitry Andric /** 6018bcb0991SDimitry Andric * Create debugging information temporary entry for a macro file. 6028bcb0991SDimitry Andric * List of macro node direct children will be calculated by DIBuilder, 6038bcb0991SDimitry Andric * using the \p ParentMacroFile relationship. 6048bcb0991SDimitry Andric * @param Builder The DIBuilder. 6058bcb0991SDimitry Andric * @param ParentMacroFile Macro parent (could be NULL). 6068bcb0991SDimitry Andric * @param Line Source line number where the macro file is included. 6078bcb0991SDimitry Andric * @param File File descriptor containing the name of the macro file. 6088bcb0991SDimitry Andric */ 6098bcb0991SDimitry Andric LLVMMetadataRef 6108bcb0991SDimitry Andric LLVMDIBuilderCreateTempMacroFile(LLVMDIBuilderRef Builder, 6118bcb0991SDimitry Andric LLVMMetadataRef ParentMacroFile, unsigned Line, 6128bcb0991SDimitry Andric LLVMMetadataRef File); 6138bcb0991SDimitry Andric 6148bcb0991SDimitry Andric /** 6150b57cec5SDimitry Andric * Create debugging information entry for an enumerator. 6160b57cec5SDimitry Andric * @param Builder The DIBuilder. 6170b57cec5SDimitry Andric * @param Name Enumerator name. 6180b57cec5SDimitry Andric * @param NameLen Length of enumerator name. 6190b57cec5SDimitry Andric * @param Value Enumerator value. 6200b57cec5SDimitry Andric * @param IsUnsigned True if the value is unsigned. 6210b57cec5SDimitry Andric */ 6220b57cec5SDimitry Andric LLVMMetadataRef LLVMDIBuilderCreateEnumerator(LLVMDIBuilderRef Builder, 6230b57cec5SDimitry Andric const char *Name, size_t NameLen, 6240b57cec5SDimitry Andric int64_t Value, 6250b57cec5SDimitry Andric LLVMBool IsUnsigned); 6260b57cec5SDimitry Andric 6270b57cec5SDimitry Andric /** 6280b57cec5SDimitry Andric * Create debugging information entry for an enumeration. 6290b57cec5SDimitry Andric * \param Builder The DIBuilder. 6300b57cec5SDimitry Andric * \param Scope Scope in which this enumeration is defined. 6310b57cec5SDimitry Andric * \param Name Enumeration name. 6320b57cec5SDimitry Andric * \param NameLen Length of enumeration name. 6330b57cec5SDimitry Andric * \param File File where this member is defined. 6340b57cec5SDimitry Andric * \param LineNumber Line number. 6350b57cec5SDimitry Andric * \param SizeInBits Member size. 6360b57cec5SDimitry Andric * \param AlignInBits Member alignment. 6370b57cec5SDimitry Andric * \param Elements Enumeration elements. 6380b57cec5SDimitry Andric * \param NumElements Number of enumeration elements. 6390b57cec5SDimitry Andric * \param ClassTy Underlying type of a C++11/ObjC fixed enum. 6400b57cec5SDimitry Andric */ 6410b57cec5SDimitry Andric LLVMMetadataRef LLVMDIBuilderCreateEnumerationType( 6420b57cec5SDimitry Andric LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, 6430b57cec5SDimitry Andric size_t NameLen, LLVMMetadataRef File, unsigned LineNumber, 6440b57cec5SDimitry Andric uint64_t SizeInBits, uint32_t AlignInBits, LLVMMetadataRef *Elements, 6450b57cec5SDimitry Andric unsigned NumElements, LLVMMetadataRef ClassTy); 6460b57cec5SDimitry Andric 6470b57cec5SDimitry Andric /** 6480b57cec5SDimitry Andric * Create debugging information entry for a union. 6490b57cec5SDimitry Andric * \param Builder The DIBuilder. 6500b57cec5SDimitry Andric * \param Scope Scope in which this union is defined. 6510b57cec5SDimitry Andric * \param Name Union name. 6520b57cec5SDimitry Andric * \param NameLen Length of union name. 6530b57cec5SDimitry Andric * \param File File where this member is defined. 6540b57cec5SDimitry Andric * \param LineNumber Line number. 6550b57cec5SDimitry Andric * \param SizeInBits Member size. 6560b57cec5SDimitry Andric * \param AlignInBits Member alignment. 6570b57cec5SDimitry Andric * \param Flags Flags to encode member attribute, e.g. private 6580b57cec5SDimitry Andric * \param Elements Union elements. 6590b57cec5SDimitry Andric * \param NumElements Number of union elements. 6600b57cec5SDimitry Andric * \param RunTimeLang Optional parameter, Objective-C runtime version. 6610b57cec5SDimitry Andric * \param UniqueId A unique identifier for the union. 6620b57cec5SDimitry Andric * \param UniqueIdLen Length of unique identifier. 6630b57cec5SDimitry Andric */ 6640b57cec5SDimitry Andric LLVMMetadataRef LLVMDIBuilderCreateUnionType( 6650b57cec5SDimitry Andric LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, 6660b57cec5SDimitry Andric size_t NameLen, LLVMMetadataRef File, unsigned LineNumber, 6670b57cec5SDimitry Andric uint64_t SizeInBits, uint32_t AlignInBits, LLVMDIFlags Flags, 6680b57cec5SDimitry Andric LLVMMetadataRef *Elements, unsigned NumElements, unsigned RunTimeLang, 6690b57cec5SDimitry Andric const char *UniqueId, size_t UniqueIdLen); 6700b57cec5SDimitry Andric 6710b57cec5SDimitry Andric 6720b57cec5SDimitry Andric /** 6730b57cec5SDimitry Andric * Create debugging information entry for an array. 6740b57cec5SDimitry Andric * \param Builder The DIBuilder. 6750b57cec5SDimitry Andric * \param Size Array size. 6760b57cec5SDimitry Andric * \param AlignInBits Alignment. 6770b57cec5SDimitry Andric * \param Ty Element type. 6780b57cec5SDimitry Andric * \param Subscripts Subscripts. 6790b57cec5SDimitry Andric * \param NumSubscripts Number of subscripts. 6800b57cec5SDimitry Andric */ 6810b57cec5SDimitry Andric LLVMMetadataRef 6820b57cec5SDimitry Andric LLVMDIBuilderCreateArrayType(LLVMDIBuilderRef Builder, uint64_t Size, 6830b57cec5SDimitry Andric uint32_t AlignInBits, LLVMMetadataRef Ty, 6840b57cec5SDimitry Andric LLVMMetadataRef *Subscripts, 6850b57cec5SDimitry Andric unsigned NumSubscripts); 6860b57cec5SDimitry Andric 6870b57cec5SDimitry Andric /** 6880b57cec5SDimitry Andric * Create debugging information entry for a vector type. 6890b57cec5SDimitry Andric * \param Builder The DIBuilder. 6900b57cec5SDimitry Andric * \param Size Vector size. 6910b57cec5SDimitry Andric * \param AlignInBits Alignment. 6920b57cec5SDimitry Andric * \param Ty Element type. 6930b57cec5SDimitry Andric * \param Subscripts Subscripts. 6940b57cec5SDimitry Andric * \param NumSubscripts Number of subscripts. 6950b57cec5SDimitry Andric */ 6960b57cec5SDimitry Andric LLVMMetadataRef 6970b57cec5SDimitry Andric LLVMDIBuilderCreateVectorType(LLVMDIBuilderRef Builder, uint64_t Size, 6980b57cec5SDimitry Andric uint32_t AlignInBits, LLVMMetadataRef Ty, 6990b57cec5SDimitry Andric LLVMMetadataRef *Subscripts, 7000b57cec5SDimitry Andric unsigned NumSubscripts); 7010b57cec5SDimitry Andric 7020b57cec5SDimitry Andric /** 7030b57cec5SDimitry Andric * Create a DWARF unspecified type. 7040b57cec5SDimitry Andric * \param Builder The DIBuilder. 7050b57cec5SDimitry Andric * \param Name The unspecified type's name. 7060b57cec5SDimitry Andric * \param NameLen Length of type name. 7070b57cec5SDimitry Andric */ 7080b57cec5SDimitry Andric LLVMMetadataRef 7090b57cec5SDimitry Andric LLVMDIBuilderCreateUnspecifiedType(LLVMDIBuilderRef Builder, const char *Name, 7100b57cec5SDimitry Andric size_t NameLen); 7110b57cec5SDimitry Andric 7120b57cec5SDimitry Andric /** 7130b57cec5SDimitry Andric * Create debugging information entry for a basic 7140b57cec5SDimitry Andric * type. 7150b57cec5SDimitry Andric * \param Builder The DIBuilder. 7160b57cec5SDimitry Andric * \param Name Type name. 7170b57cec5SDimitry Andric * \param NameLen Length of type name. 7180b57cec5SDimitry Andric * \param SizeInBits Size of the type. 7190b57cec5SDimitry Andric * \param Encoding DWARF encoding code, e.g. \c LLVMDWARFTypeEncoding_float. 7200b57cec5SDimitry Andric * \param Flags Flags to encode optional attribute like endianity 7210b57cec5SDimitry Andric */ 7220b57cec5SDimitry Andric LLVMMetadataRef 7230b57cec5SDimitry Andric LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef Builder, const char *Name, 7240b57cec5SDimitry Andric size_t NameLen, uint64_t SizeInBits, 7250b57cec5SDimitry Andric LLVMDWARFTypeEncoding Encoding, 7260b57cec5SDimitry Andric LLVMDIFlags Flags); 7270b57cec5SDimitry Andric 7280b57cec5SDimitry Andric /** 7290b57cec5SDimitry Andric * Create debugging information entry for a pointer. 7300b57cec5SDimitry Andric * \param Builder The DIBuilder. 7310b57cec5SDimitry Andric * \param PointeeTy Type pointed by this pointer. 7320b57cec5SDimitry Andric * \param SizeInBits Size. 7330b57cec5SDimitry Andric * \param AlignInBits Alignment. (optional, pass 0 to ignore) 7340b57cec5SDimitry Andric * \param AddressSpace DWARF address space. (optional, pass 0 to ignore) 7350b57cec5SDimitry Andric * \param Name Pointer type name. (optional) 7360b57cec5SDimitry Andric * \param NameLen Length of pointer type name. (optional) 7370b57cec5SDimitry Andric */ 7380b57cec5SDimitry Andric LLVMMetadataRef LLVMDIBuilderCreatePointerType( 7390b57cec5SDimitry Andric LLVMDIBuilderRef Builder, LLVMMetadataRef PointeeTy, 7400b57cec5SDimitry Andric uint64_t SizeInBits, uint32_t AlignInBits, unsigned AddressSpace, 7410b57cec5SDimitry Andric const char *Name, size_t NameLen); 7420b57cec5SDimitry Andric 7430b57cec5SDimitry Andric /** 7440b57cec5SDimitry Andric * Create debugging information entry for a struct. 7450b57cec5SDimitry Andric * \param Builder The DIBuilder. 7460b57cec5SDimitry Andric * \param Scope Scope in which this struct is defined. 7470b57cec5SDimitry Andric * \param Name Struct name. 7480b57cec5SDimitry Andric * \param NameLen Struct name length. 7490b57cec5SDimitry Andric * \param File File where this member is defined. 7500b57cec5SDimitry Andric * \param LineNumber Line number. 7510b57cec5SDimitry Andric * \param SizeInBits Member size. 7520b57cec5SDimitry Andric * \param AlignInBits Member alignment. 7530b57cec5SDimitry Andric * \param Flags Flags to encode member attribute, e.g. private 7540b57cec5SDimitry Andric * \param Elements Struct elements. 7550b57cec5SDimitry Andric * \param NumElements Number of struct elements. 7560b57cec5SDimitry Andric * \param RunTimeLang Optional parameter, Objective-C runtime version. 7570b57cec5SDimitry Andric * \param VTableHolder The object containing the vtable for the struct. 7580b57cec5SDimitry Andric * \param UniqueId A unique identifier for the struct. 7590b57cec5SDimitry Andric * \param UniqueIdLen Length of the unique identifier for the struct. 7600b57cec5SDimitry Andric */ 7610b57cec5SDimitry Andric LLVMMetadataRef LLVMDIBuilderCreateStructType( 7620b57cec5SDimitry Andric LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, 7630b57cec5SDimitry Andric size_t NameLen, LLVMMetadataRef File, unsigned LineNumber, 7640b57cec5SDimitry Andric uint64_t SizeInBits, uint32_t AlignInBits, LLVMDIFlags Flags, 7650b57cec5SDimitry Andric LLVMMetadataRef DerivedFrom, LLVMMetadataRef *Elements, 7660b57cec5SDimitry Andric unsigned NumElements, unsigned RunTimeLang, LLVMMetadataRef VTableHolder, 7670b57cec5SDimitry Andric const char *UniqueId, size_t UniqueIdLen); 7680b57cec5SDimitry Andric 7690b57cec5SDimitry Andric /** 7700b57cec5SDimitry Andric * Create debugging information entry for a member. 7710b57cec5SDimitry Andric * \param Builder The DIBuilder. 7720b57cec5SDimitry Andric * \param Scope Member scope. 7730b57cec5SDimitry Andric * \param Name Member name. 7740b57cec5SDimitry Andric * \param NameLen Length of member name. 7750b57cec5SDimitry Andric * \param File File where this member is defined. 7760b57cec5SDimitry Andric * \param LineNo Line number. 7770b57cec5SDimitry Andric * \param SizeInBits Member size. 7780b57cec5SDimitry Andric * \param AlignInBits Member alignment. 7790b57cec5SDimitry Andric * \param OffsetInBits Member offset. 7800b57cec5SDimitry Andric * \param Flags Flags to encode member attribute, e.g. private 7810b57cec5SDimitry Andric * \param Ty Parent type. 7820b57cec5SDimitry Andric */ 7830b57cec5SDimitry Andric LLVMMetadataRef LLVMDIBuilderCreateMemberType( 7840b57cec5SDimitry Andric LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, 7850b57cec5SDimitry Andric size_t NameLen, LLVMMetadataRef File, unsigned LineNo, 7860b57cec5SDimitry Andric uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, 7870b57cec5SDimitry Andric LLVMDIFlags Flags, LLVMMetadataRef Ty); 7880b57cec5SDimitry Andric 7890b57cec5SDimitry Andric /** 7900b57cec5SDimitry Andric * Create debugging information entry for a 7910b57cec5SDimitry Andric * C++ static data member. 7920b57cec5SDimitry Andric * \param Builder The DIBuilder. 7930b57cec5SDimitry Andric * \param Scope Member scope. 7940b57cec5SDimitry Andric * \param Name Member name. 7950b57cec5SDimitry Andric * \param NameLen Length of member name. 7960b57cec5SDimitry Andric * \param File File where this member is declared. 7970b57cec5SDimitry Andric * \param LineNumber Line number. 7980b57cec5SDimitry Andric * \param Type Type of the static member. 7990b57cec5SDimitry Andric * \param Flags Flags to encode member attribute, e.g. private. 8000b57cec5SDimitry Andric * \param ConstantVal Const initializer of the member. 8010b57cec5SDimitry Andric * \param AlignInBits Member alignment. 8020b57cec5SDimitry Andric */ 8030b57cec5SDimitry Andric LLVMMetadataRef 8040b57cec5SDimitry Andric LLVMDIBuilderCreateStaticMemberType( 8050b57cec5SDimitry Andric LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, 8060b57cec5SDimitry Andric size_t NameLen, LLVMMetadataRef File, unsigned LineNumber, 8070b57cec5SDimitry Andric LLVMMetadataRef Type, LLVMDIFlags Flags, LLVMValueRef ConstantVal, 8080b57cec5SDimitry Andric uint32_t AlignInBits); 8090b57cec5SDimitry Andric 8100b57cec5SDimitry Andric /** 8110b57cec5SDimitry Andric * Create debugging information entry for a pointer to member. 8120b57cec5SDimitry Andric * \param Builder The DIBuilder. 8130b57cec5SDimitry Andric * \param PointeeType Type pointed to by this pointer. 8140b57cec5SDimitry Andric * \param ClassType Type for which this pointer points to members of. 8150b57cec5SDimitry Andric * \param SizeInBits Size. 8160b57cec5SDimitry Andric * \param AlignInBits Alignment. 8170b57cec5SDimitry Andric * \param Flags Flags. 8180b57cec5SDimitry Andric */ 8190b57cec5SDimitry Andric LLVMMetadataRef 8200b57cec5SDimitry Andric LLVMDIBuilderCreateMemberPointerType(LLVMDIBuilderRef Builder, 8210b57cec5SDimitry Andric LLVMMetadataRef PointeeType, 8220b57cec5SDimitry Andric LLVMMetadataRef ClassType, 8230b57cec5SDimitry Andric uint64_t SizeInBits, 8240b57cec5SDimitry Andric uint32_t AlignInBits, 8250b57cec5SDimitry Andric LLVMDIFlags Flags); 8260b57cec5SDimitry Andric /** 8270b57cec5SDimitry Andric * Create debugging information entry for Objective-C instance variable. 8280b57cec5SDimitry Andric * \param Builder The DIBuilder. 8290b57cec5SDimitry Andric * \param Name Member name. 8300b57cec5SDimitry Andric * \param NameLen The length of the C string passed to \c Name. 8310b57cec5SDimitry Andric * \param File File where this member is defined. 8320b57cec5SDimitry Andric * \param LineNo Line number. 8330b57cec5SDimitry Andric * \param SizeInBits Member size. 8340b57cec5SDimitry Andric * \param AlignInBits Member alignment. 8350b57cec5SDimitry Andric * \param OffsetInBits Member offset. 8360b57cec5SDimitry Andric * \param Flags Flags to encode member attribute, e.g. private 8370b57cec5SDimitry Andric * \param Ty Parent type. 8380b57cec5SDimitry Andric * \param PropertyNode Property associated with this ivar. 8390b57cec5SDimitry Andric */ 8400b57cec5SDimitry Andric LLVMMetadataRef 8410b57cec5SDimitry Andric LLVMDIBuilderCreateObjCIVar(LLVMDIBuilderRef Builder, 8420b57cec5SDimitry Andric const char *Name, size_t NameLen, 8430b57cec5SDimitry Andric LLVMMetadataRef File, unsigned LineNo, 8440b57cec5SDimitry Andric uint64_t SizeInBits, uint32_t AlignInBits, 8450b57cec5SDimitry Andric uint64_t OffsetInBits, LLVMDIFlags Flags, 8460b57cec5SDimitry Andric LLVMMetadataRef Ty, LLVMMetadataRef PropertyNode); 8470b57cec5SDimitry Andric 8480b57cec5SDimitry Andric /** 8490b57cec5SDimitry Andric * Create debugging information entry for Objective-C property. 8500b57cec5SDimitry Andric * \param Builder The DIBuilder. 8510b57cec5SDimitry Andric * \param Name Property name. 8520b57cec5SDimitry Andric * \param NameLen The length of the C string passed to \c Name. 8530b57cec5SDimitry Andric * \param File File where this property is defined. 8540b57cec5SDimitry Andric * \param LineNo Line number. 8550b57cec5SDimitry Andric * \param GetterName Name of the Objective C property getter selector. 8560b57cec5SDimitry Andric * \param GetterNameLen The length of the C string passed to \c GetterName. 8570b57cec5SDimitry Andric * \param SetterName Name of the Objective C property setter selector. 8580b57cec5SDimitry Andric * \param SetterNameLen The length of the C string passed to \c SetterName. 8590b57cec5SDimitry Andric * \param PropertyAttributes Objective C property attributes. 8600b57cec5SDimitry Andric * \param Ty Type. 8610b57cec5SDimitry Andric */ 8620b57cec5SDimitry Andric LLVMMetadataRef 8630b57cec5SDimitry Andric LLVMDIBuilderCreateObjCProperty(LLVMDIBuilderRef Builder, 8640b57cec5SDimitry Andric const char *Name, size_t NameLen, 8650b57cec5SDimitry Andric LLVMMetadataRef File, unsigned LineNo, 8660b57cec5SDimitry Andric const char *GetterName, size_t GetterNameLen, 8670b57cec5SDimitry Andric const char *SetterName, size_t SetterNameLen, 8680b57cec5SDimitry Andric unsigned PropertyAttributes, 8690b57cec5SDimitry Andric LLVMMetadataRef Ty); 8700b57cec5SDimitry Andric 8710b57cec5SDimitry Andric /** 8720b57cec5SDimitry Andric * Create a uniqued DIType* clone with FlagObjectPointer and FlagArtificial set. 8730b57cec5SDimitry Andric * \param Builder The DIBuilder. 8740b57cec5SDimitry Andric * \param Type The underlying type to which this pointer points. 8750b57cec5SDimitry Andric */ 8760b57cec5SDimitry Andric LLVMMetadataRef 8770b57cec5SDimitry Andric LLVMDIBuilderCreateObjectPointerType(LLVMDIBuilderRef Builder, 8780b57cec5SDimitry Andric LLVMMetadataRef Type); 8790b57cec5SDimitry Andric 8800b57cec5SDimitry Andric /** 8810b57cec5SDimitry Andric * Create debugging information entry for a qualified 8820b57cec5SDimitry Andric * type, e.g. 'const int'. 8830b57cec5SDimitry Andric * \param Builder The DIBuilder. 8840b57cec5SDimitry Andric * \param Tag Tag identifying type, 8850b57cec5SDimitry Andric * e.g. LLVMDWARFTypeQualifier_volatile_type 8860b57cec5SDimitry Andric * \param Type Base Type. 8870b57cec5SDimitry Andric */ 8880b57cec5SDimitry Andric LLVMMetadataRef 8890b57cec5SDimitry Andric LLVMDIBuilderCreateQualifiedType(LLVMDIBuilderRef Builder, unsigned Tag, 8900b57cec5SDimitry Andric LLVMMetadataRef Type); 8910b57cec5SDimitry Andric 8920b57cec5SDimitry Andric /** 8930b57cec5SDimitry Andric * Create debugging information entry for a c++ 8940b57cec5SDimitry Andric * style reference or rvalue reference type. 8950b57cec5SDimitry Andric * \param Builder The DIBuilder. 8960b57cec5SDimitry Andric * \param Tag Tag identifying type, 8970b57cec5SDimitry Andric * \param Type Base Type. 8980b57cec5SDimitry Andric */ 8990b57cec5SDimitry Andric LLVMMetadataRef 9000b57cec5SDimitry Andric LLVMDIBuilderCreateReferenceType(LLVMDIBuilderRef Builder, unsigned Tag, 9010b57cec5SDimitry Andric LLVMMetadataRef Type); 9020b57cec5SDimitry Andric 9030b57cec5SDimitry Andric /** 9040b57cec5SDimitry Andric * Create C++11 nullptr type. 9050b57cec5SDimitry Andric * \param Builder The DIBuilder. 9060b57cec5SDimitry Andric */ 9070b57cec5SDimitry Andric LLVMMetadataRef 9080b57cec5SDimitry Andric LLVMDIBuilderCreateNullPtrType(LLVMDIBuilderRef Builder); 9090b57cec5SDimitry Andric 9100b57cec5SDimitry Andric /** 9110b57cec5SDimitry Andric * Create debugging information entry for a typedef. 9120b57cec5SDimitry Andric * \param Builder The DIBuilder. 9130b57cec5SDimitry Andric * \param Type Original type. 9140b57cec5SDimitry Andric * \param Name Typedef name. 9150b57cec5SDimitry Andric * \param File File where this type is defined. 9160b57cec5SDimitry Andric * \param LineNo Line number. 9170b57cec5SDimitry Andric * \param Scope The surrounding context for the typedef. 9180b57cec5SDimitry Andric */ 9190b57cec5SDimitry Andric LLVMMetadataRef 9200b57cec5SDimitry Andric LLVMDIBuilderCreateTypedef(LLVMDIBuilderRef Builder, LLVMMetadataRef Type, 9210b57cec5SDimitry Andric const char *Name, size_t NameLen, 9220b57cec5SDimitry Andric LLVMMetadataRef File, unsigned LineNo, 923480093f4SDimitry Andric LLVMMetadataRef Scope, uint32_t AlignInBits); 9240b57cec5SDimitry Andric 9250b57cec5SDimitry Andric /** 9260b57cec5SDimitry Andric * Create debugging information entry to establish inheritance relationship 9270b57cec5SDimitry Andric * between two types. 9280b57cec5SDimitry Andric * \param Builder The DIBuilder. 9290b57cec5SDimitry Andric * \param Ty Original type. 9300b57cec5SDimitry Andric * \param BaseTy Base type. Ty is inherits from base. 9310b57cec5SDimitry Andric * \param BaseOffset Base offset. 9320b57cec5SDimitry Andric * \param VBPtrOffset Virtual base pointer offset. 9330b57cec5SDimitry Andric * \param Flags Flags to describe inheritance attribute, e.g. private 9340b57cec5SDimitry Andric */ 9350b57cec5SDimitry Andric LLVMMetadataRef 9360b57cec5SDimitry Andric LLVMDIBuilderCreateInheritance(LLVMDIBuilderRef Builder, 9370b57cec5SDimitry Andric LLVMMetadataRef Ty, LLVMMetadataRef BaseTy, 9380b57cec5SDimitry Andric uint64_t BaseOffset, uint32_t VBPtrOffset, 9390b57cec5SDimitry Andric LLVMDIFlags Flags); 9400b57cec5SDimitry Andric 9410b57cec5SDimitry Andric /** 9420b57cec5SDimitry Andric * Create a permanent forward-declared type. 9430b57cec5SDimitry Andric * \param Builder The DIBuilder. 9440b57cec5SDimitry Andric * \param Tag A unique tag for this type. 9450b57cec5SDimitry Andric * \param Name Type name. 9460b57cec5SDimitry Andric * \param NameLen Length of type name. 9470b57cec5SDimitry Andric * \param Scope Type scope. 9480b57cec5SDimitry Andric * \param File File where this type is defined. 9490b57cec5SDimitry Andric * \param Line Line number where this type is defined. 9500b57cec5SDimitry Andric * \param RuntimeLang Indicates runtime version for languages like 9510b57cec5SDimitry Andric * Objective-C. 9520b57cec5SDimitry Andric * \param SizeInBits Member size. 9530b57cec5SDimitry Andric * \param AlignInBits Member alignment. 9540b57cec5SDimitry Andric * \param UniqueIdentifier A unique identifier for the type. 9550b57cec5SDimitry Andric * \param UniqueIdentifierLen Length of the unique identifier. 9560b57cec5SDimitry Andric */ 9570b57cec5SDimitry Andric LLVMMetadataRef LLVMDIBuilderCreateForwardDecl( 9580b57cec5SDimitry Andric LLVMDIBuilderRef Builder, unsigned Tag, const char *Name, 9590b57cec5SDimitry Andric size_t NameLen, LLVMMetadataRef Scope, LLVMMetadataRef File, unsigned Line, 9600b57cec5SDimitry Andric unsigned RuntimeLang, uint64_t SizeInBits, uint32_t AlignInBits, 9610b57cec5SDimitry Andric const char *UniqueIdentifier, size_t UniqueIdentifierLen); 9620b57cec5SDimitry Andric 9630b57cec5SDimitry Andric /** 9640b57cec5SDimitry Andric * Create a temporary forward-declared type. 9650b57cec5SDimitry Andric * \param Builder The DIBuilder. 9660b57cec5SDimitry Andric * \param Tag A unique tag for this type. 9670b57cec5SDimitry Andric * \param Name Type name. 9680b57cec5SDimitry Andric * \param NameLen Length of type name. 9690b57cec5SDimitry Andric * \param Scope Type scope. 9700b57cec5SDimitry Andric * \param File File where this type is defined. 9710b57cec5SDimitry Andric * \param Line Line number where this type is defined. 9720b57cec5SDimitry Andric * \param RuntimeLang Indicates runtime version for languages like 9730b57cec5SDimitry Andric * Objective-C. 9740b57cec5SDimitry Andric * \param SizeInBits Member size. 9750b57cec5SDimitry Andric * \param AlignInBits Member alignment. 9760b57cec5SDimitry Andric * \param Flags Flags. 9770b57cec5SDimitry Andric * \param UniqueIdentifier A unique identifier for the type. 9780b57cec5SDimitry Andric * \param UniqueIdentifierLen Length of the unique identifier. 9790b57cec5SDimitry Andric */ 9800b57cec5SDimitry Andric LLVMMetadataRef 9810b57cec5SDimitry Andric LLVMDIBuilderCreateReplaceableCompositeType( 9820b57cec5SDimitry Andric LLVMDIBuilderRef Builder, unsigned Tag, const char *Name, 9830b57cec5SDimitry Andric size_t NameLen, LLVMMetadataRef Scope, LLVMMetadataRef File, unsigned Line, 9840b57cec5SDimitry Andric unsigned RuntimeLang, uint64_t SizeInBits, uint32_t AlignInBits, 9850b57cec5SDimitry Andric LLVMDIFlags Flags, const char *UniqueIdentifier, 9860b57cec5SDimitry Andric size_t UniqueIdentifierLen); 9870b57cec5SDimitry Andric 9880b57cec5SDimitry Andric /** 9890b57cec5SDimitry Andric * Create debugging information entry for a bit field member. 9900b57cec5SDimitry Andric * \param Builder The DIBuilder. 9910b57cec5SDimitry Andric * \param Scope Member scope. 9920b57cec5SDimitry Andric * \param Name Member name. 9930b57cec5SDimitry Andric * \param NameLen Length of member name. 9940b57cec5SDimitry Andric * \param File File where this member is defined. 9950b57cec5SDimitry Andric * \param LineNumber Line number. 9960b57cec5SDimitry Andric * \param SizeInBits Member size. 9970b57cec5SDimitry Andric * \param OffsetInBits Member offset. 9980b57cec5SDimitry Andric * \param StorageOffsetInBits Member storage offset. 9990b57cec5SDimitry Andric * \param Flags Flags to encode member attribute. 10000b57cec5SDimitry Andric * \param Type Parent type. 10010b57cec5SDimitry Andric */ 10020b57cec5SDimitry Andric LLVMMetadataRef 10030b57cec5SDimitry Andric LLVMDIBuilderCreateBitFieldMemberType(LLVMDIBuilderRef Builder, 10040b57cec5SDimitry Andric LLVMMetadataRef Scope, 10050b57cec5SDimitry Andric const char *Name, size_t NameLen, 10060b57cec5SDimitry Andric LLVMMetadataRef File, unsigned LineNumber, 10070b57cec5SDimitry Andric uint64_t SizeInBits, 10080b57cec5SDimitry Andric uint64_t OffsetInBits, 10090b57cec5SDimitry Andric uint64_t StorageOffsetInBits, 10100b57cec5SDimitry Andric LLVMDIFlags Flags, LLVMMetadataRef Type); 10110b57cec5SDimitry Andric 10120b57cec5SDimitry Andric /** 10130b57cec5SDimitry Andric * Create debugging information entry for a class. 10140b57cec5SDimitry Andric * \param Scope Scope in which this class is defined. 10150b57cec5SDimitry Andric * \param Name Class name. 10160b57cec5SDimitry Andric * \param NameLen The length of the C string passed to \c Name. 10170b57cec5SDimitry Andric * \param File File where this member is defined. 10180b57cec5SDimitry Andric * \param LineNumber Line number. 10190b57cec5SDimitry Andric * \param SizeInBits Member size. 10200b57cec5SDimitry Andric * \param AlignInBits Member alignment. 10210b57cec5SDimitry Andric * \param OffsetInBits Member offset. 10220b57cec5SDimitry Andric * \param Flags Flags to encode member attribute, e.g. private. 10230b57cec5SDimitry Andric * \param DerivedFrom Debug info of the base class of this type. 10240b57cec5SDimitry Andric * \param Elements Class members. 10250b57cec5SDimitry Andric * \param NumElements Number of class elements. 10260b57cec5SDimitry Andric * \param VTableHolder Debug info of the base class that contains vtable 10270b57cec5SDimitry Andric * for this type. This is used in 10280b57cec5SDimitry Andric * DW_AT_containing_type. See DWARF documentation 10290b57cec5SDimitry Andric * for more info. 10300b57cec5SDimitry Andric * \param TemplateParamsNode Template type parameters. 10310b57cec5SDimitry Andric * \param UniqueIdentifier A unique identifier for the type. 10320b57cec5SDimitry Andric * \param UniqueIdentifierLen Length of the unique identifier. 10330b57cec5SDimitry Andric */ 10340b57cec5SDimitry Andric LLVMMetadataRef LLVMDIBuilderCreateClassType(LLVMDIBuilderRef Builder, 10350b57cec5SDimitry Andric LLVMMetadataRef Scope, const char *Name, size_t NameLen, 10360b57cec5SDimitry Andric LLVMMetadataRef File, unsigned LineNumber, uint64_t SizeInBits, 10370b57cec5SDimitry Andric uint32_t AlignInBits, uint64_t OffsetInBits, LLVMDIFlags Flags, 10380b57cec5SDimitry Andric LLVMMetadataRef DerivedFrom, 10390b57cec5SDimitry Andric LLVMMetadataRef *Elements, unsigned NumElements, 10400b57cec5SDimitry Andric LLVMMetadataRef VTableHolder, LLVMMetadataRef TemplateParamsNode, 10410b57cec5SDimitry Andric const char *UniqueIdentifier, size_t UniqueIdentifierLen); 10420b57cec5SDimitry Andric 10430b57cec5SDimitry Andric /** 10440b57cec5SDimitry Andric * Create a uniqued DIType* clone with FlagArtificial set. 10450b57cec5SDimitry Andric * \param Builder The DIBuilder. 10460b57cec5SDimitry Andric * \param Type The underlying type. 10470b57cec5SDimitry Andric */ 10480b57cec5SDimitry Andric LLVMMetadataRef 10490b57cec5SDimitry Andric LLVMDIBuilderCreateArtificialType(LLVMDIBuilderRef Builder, 10500b57cec5SDimitry Andric LLVMMetadataRef Type); 10510b57cec5SDimitry Andric 10520b57cec5SDimitry Andric /** 10530b57cec5SDimitry Andric * Get the name of this DIType. 10540b57cec5SDimitry Andric * \param DType The DIType. 10550b57cec5SDimitry Andric * \param Length The length of the returned string. 10560b57cec5SDimitry Andric * 10570b57cec5SDimitry Andric * @see DIType::getName() 10580b57cec5SDimitry Andric */ 10590b57cec5SDimitry Andric const char *LLVMDITypeGetName(LLVMMetadataRef DType, size_t *Length); 10600b57cec5SDimitry Andric 10610b57cec5SDimitry Andric /** 10620b57cec5SDimitry Andric * Get the size of this DIType in bits. 10630b57cec5SDimitry Andric * \param DType The DIType. 10640b57cec5SDimitry Andric * 10650b57cec5SDimitry Andric * @see DIType::getSizeInBits() 10660b57cec5SDimitry Andric */ 10670b57cec5SDimitry Andric uint64_t LLVMDITypeGetSizeInBits(LLVMMetadataRef DType); 10680b57cec5SDimitry Andric 10690b57cec5SDimitry Andric /** 10700b57cec5SDimitry Andric * Get the offset of this DIType in bits. 10710b57cec5SDimitry Andric * \param DType The DIType. 10720b57cec5SDimitry Andric * 10730b57cec5SDimitry Andric * @see DIType::getOffsetInBits() 10740b57cec5SDimitry Andric */ 10750b57cec5SDimitry Andric uint64_t LLVMDITypeGetOffsetInBits(LLVMMetadataRef DType); 10760b57cec5SDimitry Andric 10770b57cec5SDimitry Andric /** 10780b57cec5SDimitry Andric * Get the alignment of this DIType in bits. 10790b57cec5SDimitry Andric * \param DType The DIType. 10800b57cec5SDimitry Andric * 10810b57cec5SDimitry Andric * @see DIType::getAlignInBits() 10820b57cec5SDimitry Andric */ 10830b57cec5SDimitry Andric uint32_t LLVMDITypeGetAlignInBits(LLVMMetadataRef DType); 10840b57cec5SDimitry Andric 10850b57cec5SDimitry Andric /** 10860b57cec5SDimitry Andric * Get the source line where this DIType is declared. 10870b57cec5SDimitry Andric * \param DType The DIType. 10880b57cec5SDimitry Andric * 10890b57cec5SDimitry Andric * @see DIType::getLine() 10900b57cec5SDimitry Andric */ 10910b57cec5SDimitry Andric unsigned LLVMDITypeGetLine(LLVMMetadataRef DType); 10920b57cec5SDimitry Andric 10930b57cec5SDimitry Andric /** 10940b57cec5SDimitry Andric * Get the flags associated with this DIType. 10950b57cec5SDimitry Andric * \param DType The DIType. 10960b57cec5SDimitry Andric * 10970b57cec5SDimitry Andric * @see DIType::getFlags() 10980b57cec5SDimitry Andric */ 10990b57cec5SDimitry Andric LLVMDIFlags LLVMDITypeGetFlags(LLVMMetadataRef DType); 11000b57cec5SDimitry Andric 11010b57cec5SDimitry Andric /** 11020b57cec5SDimitry Andric * Create a descriptor for a value range. 11030b57cec5SDimitry Andric * \param Builder The DIBuilder. 11040b57cec5SDimitry Andric * \param LowerBound Lower bound of the subrange, e.g. 0 for C, 1 for Fortran. 11050b57cec5SDimitry Andric * \param Count Count of elements in the subrange. 11060b57cec5SDimitry Andric */ 11070b57cec5SDimitry Andric LLVMMetadataRef LLVMDIBuilderGetOrCreateSubrange(LLVMDIBuilderRef Builder, 11080b57cec5SDimitry Andric int64_t LowerBound, 11090b57cec5SDimitry Andric int64_t Count); 11100b57cec5SDimitry Andric 11110b57cec5SDimitry Andric /** 11120b57cec5SDimitry Andric * Create an array of DI Nodes. 11130b57cec5SDimitry Andric * \param Builder The DIBuilder. 11140b57cec5SDimitry Andric * \param Data The DI Node elements. 11150b57cec5SDimitry Andric * \param NumElements Number of DI Node elements. 11160b57cec5SDimitry Andric */ 11170b57cec5SDimitry Andric LLVMMetadataRef LLVMDIBuilderGetOrCreateArray(LLVMDIBuilderRef Builder, 11180b57cec5SDimitry Andric LLVMMetadataRef *Data, 11190b57cec5SDimitry Andric size_t NumElements); 11200b57cec5SDimitry Andric 11210b57cec5SDimitry Andric /** 11220b57cec5SDimitry Andric * Create a new descriptor for the specified variable which has a complex 11230b57cec5SDimitry Andric * address expression for its address. 11240b57cec5SDimitry Andric * \param Builder The DIBuilder. 11250b57cec5SDimitry Andric * \param Addr An array of complex address operations. 11260b57cec5SDimitry Andric * \param Length Length of the address operation array. 11270b57cec5SDimitry Andric */ 11280b57cec5SDimitry Andric LLVMMetadataRef LLVMDIBuilderCreateExpression(LLVMDIBuilderRef Builder, 112904eeddc0SDimitry Andric uint64_t *Addr, size_t Length); 11300b57cec5SDimitry Andric 11310b57cec5SDimitry Andric /** 11320b57cec5SDimitry Andric * Create a new descriptor for the specified variable that does not have an 11330b57cec5SDimitry Andric * address, but does have a constant value. 11340b57cec5SDimitry Andric * \param Builder The DIBuilder. 11350b57cec5SDimitry Andric * \param Value The constant value. 11360b57cec5SDimitry Andric */ 11370b57cec5SDimitry Andric LLVMMetadataRef 11380b57cec5SDimitry Andric LLVMDIBuilderCreateConstantValueExpression(LLVMDIBuilderRef Builder, 113904eeddc0SDimitry Andric uint64_t Value); 11400b57cec5SDimitry Andric 11410b57cec5SDimitry Andric /** 11420b57cec5SDimitry Andric * Create a new descriptor for the specified variable. 11430b57cec5SDimitry Andric * \param Scope Variable scope. 11440b57cec5SDimitry Andric * \param Name Name of the variable. 11450b57cec5SDimitry Andric * \param NameLen The length of the C string passed to \c Name. 11460b57cec5SDimitry Andric * \param Linkage Mangled name of the variable. 11470b57cec5SDimitry Andric * \param LinkLen The length of the C string passed to \c Linkage. 11480b57cec5SDimitry Andric * \param File File where this variable is defined. 11490b57cec5SDimitry Andric * \param LineNo Line number. 11500b57cec5SDimitry Andric * \param Ty Variable Type. 11510b57cec5SDimitry Andric * \param LocalToUnit Boolean flag indicate whether this variable is 11520b57cec5SDimitry Andric * externally visible or not. 11530b57cec5SDimitry Andric * \param Expr The location of the global relative to the attached 11540b57cec5SDimitry Andric * GlobalVariable. 11550b57cec5SDimitry Andric * \param Decl Reference to the corresponding declaration. 11560b57cec5SDimitry Andric * variables. 11570b57cec5SDimitry Andric * \param AlignInBits Variable alignment(or 0 if no alignment attr was 11580b57cec5SDimitry Andric * specified) 11590b57cec5SDimitry Andric */ 11600b57cec5SDimitry Andric LLVMMetadataRef LLVMDIBuilderCreateGlobalVariableExpression( 11610b57cec5SDimitry Andric LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, 11620b57cec5SDimitry Andric size_t NameLen, const char *Linkage, size_t LinkLen, LLVMMetadataRef File, 11630b57cec5SDimitry Andric unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit, 11640b57cec5SDimitry Andric LLVMMetadataRef Expr, LLVMMetadataRef Decl, uint32_t AlignInBits); 11650b57cec5SDimitry Andric 116606c3fb27SDimitry Andric 116706c3fb27SDimitry Andric /** 116806c3fb27SDimitry Andric * Get the dwarf::Tag of a DINode 116906c3fb27SDimitry Andric */ 117006c3fb27SDimitry Andric uint16_t LLVMGetDINodeTag(LLVMMetadataRef MD); 117106c3fb27SDimitry Andric 11720b57cec5SDimitry Andric /** 11730b57cec5SDimitry Andric * Retrieves the \c DIVariable associated with this global variable expression. 11740b57cec5SDimitry Andric * \param GVE The global variable expression. 11750b57cec5SDimitry Andric * 11760b57cec5SDimitry Andric * @see llvm::DIGlobalVariableExpression::getVariable() 11770b57cec5SDimitry Andric */ 11780b57cec5SDimitry Andric LLVMMetadataRef LLVMDIGlobalVariableExpressionGetVariable(LLVMMetadataRef GVE); 11790b57cec5SDimitry Andric 11800b57cec5SDimitry Andric /** 11810b57cec5SDimitry Andric * Retrieves the \c DIExpression associated with this global variable expression. 11820b57cec5SDimitry Andric * \param GVE The global variable expression. 11830b57cec5SDimitry Andric * 11840b57cec5SDimitry Andric * @see llvm::DIGlobalVariableExpression::getExpression() 11850b57cec5SDimitry Andric */ 11860b57cec5SDimitry Andric LLVMMetadataRef LLVMDIGlobalVariableExpressionGetExpression( 11870b57cec5SDimitry Andric LLVMMetadataRef GVE); 11880b57cec5SDimitry Andric 11890b57cec5SDimitry Andric /** 11900b57cec5SDimitry Andric * Get the metadata of the file associated with a given variable. 11910b57cec5SDimitry Andric * \param Var The variable object. 11920b57cec5SDimitry Andric * 11930b57cec5SDimitry Andric * @see DIVariable::getFile() 11940b57cec5SDimitry Andric */ 11950b57cec5SDimitry Andric LLVMMetadataRef LLVMDIVariableGetFile(LLVMMetadataRef Var); 11960b57cec5SDimitry Andric 11970b57cec5SDimitry Andric /** 11980b57cec5SDimitry Andric * Get the metadata of the scope associated with a given variable. 11990b57cec5SDimitry Andric * \param Var The variable object. 12000b57cec5SDimitry Andric * 12010b57cec5SDimitry Andric * @see DIVariable::getScope() 12020b57cec5SDimitry Andric */ 12030b57cec5SDimitry Andric LLVMMetadataRef LLVMDIVariableGetScope(LLVMMetadataRef Var); 12040b57cec5SDimitry Andric 12050b57cec5SDimitry Andric /** 12060b57cec5SDimitry Andric * Get the source line where this \c DIVariable is declared. 12070b57cec5SDimitry Andric * \param Var The DIVariable. 12080b57cec5SDimitry Andric * 12090b57cec5SDimitry Andric * @see DIVariable::getLine() 12100b57cec5SDimitry Andric */ 12110b57cec5SDimitry Andric unsigned LLVMDIVariableGetLine(LLVMMetadataRef Var); 12120b57cec5SDimitry Andric 12130b57cec5SDimitry Andric /** 12140b57cec5SDimitry Andric * Create a new temporary \c MDNode. Suitable for use in constructing cyclic 12150b57cec5SDimitry Andric * \c MDNode structures. A temporary \c MDNode is not uniqued, may be RAUW'd, 12160b57cec5SDimitry Andric * and must be manually deleted with \c LLVMDisposeTemporaryMDNode. 12170b57cec5SDimitry Andric * \param Ctx The context in which to construct the temporary node. 12180b57cec5SDimitry Andric * \param Data The metadata elements. 12190b57cec5SDimitry Andric * \param NumElements Number of metadata elements. 12200b57cec5SDimitry Andric */ 12210b57cec5SDimitry Andric LLVMMetadataRef LLVMTemporaryMDNode(LLVMContextRef Ctx, LLVMMetadataRef *Data, 12220b57cec5SDimitry Andric size_t NumElements); 12230b57cec5SDimitry Andric 12240b57cec5SDimitry Andric /** 12250b57cec5SDimitry Andric * Deallocate a temporary node. 12260b57cec5SDimitry Andric * 12270b57cec5SDimitry Andric * Calls \c replaceAllUsesWith(nullptr) before deleting, so any remaining 12280b57cec5SDimitry Andric * references will be reset. 12290b57cec5SDimitry Andric * \param TempNode The temporary metadata node. 12300b57cec5SDimitry Andric */ 12310b57cec5SDimitry Andric void LLVMDisposeTemporaryMDNode(LLVMMetadataRef TempNode); 12320b57cec5SDimitry Andric 12330b57cec5SDimitry Andric /** 12340b57cec5SDimitry Andric * Replace all uses of temporary metadata. 12350b57cec5SDimitry Andric * \param TempTargetMetadata The temporary metadata node. 12360b57cec5SDimitry Andric * \param Replacement The replacement metadata node. 12370b57cec5SDimitry Andric */ 12380b57cec5SDimitry Andric void LLVMMetadataReplaceAllUsesWith(LLVMMetadataRef TempTargetMetadata, 12390b57cec5SDimitry Andric LLVMMetadataRef Replacement); 12400b57cec5SDimitry Andric 12410b57cec5SDimitry Andric /** 12420b57cec5SDimitry Andric * Create a new descriptor for the specified global variable that is temporary 12430b57cec5SDimitry Andric * and meant to be RAUWed. 12440b57cec5SDimitry Andric * \param Scope Variable scope. 12450b57cec5SDimitry Andric * \param Name Name of the variable. 12460b57cec5SDimitry Andric * \param NameLen The length of the C string passed to \c Name. 12470b57cec5SDimitry Andric * \param Linkage Mangled name of the variable. 12480b57cec5SDimitry Andric * \param LnkLen The length of the C string passed to \c Linkage. 12490b57cec5SDimitry Andric * \param File File where this variable is defined. 12500b57cec5SDimitry Andric * \param LineNo Line number. 12510b57cec5SDimitry Andric * \param Ty Variable Type. 12520b57cec5SDimitry Andric * \param LocalToUnit Boolean flag indicate whether this variable is 12530b57cec5SDimitry Andric * externally visible or not. 12540b57cec5SDimitry Andric * \param Decl Reference to the corresponding declaration. 12550b57cec5SDimitry Andric * \param AlignInBits Variable alignment(or 0 if no alignment attr was 12560b57cec5SDimitry Andric * specified) 12570b57cec5SDimitry Andric */ 12580b57cec5SDimitry Andric LLVMMetadataRef LLVMDIBuilderCreateTempGlobalVariableFwdDecl( 12590b57cec5SDimitry Andric LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, 12600b57cec5SDimitry Andric size_t NameLen, const char *Linkage, size_t LnkLen, LLVMMetadataRef File, 12610b57cec5SDimitry Andric unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit, 12620b57cec5SDimitry Andric LLVMMetadataRef Decl, uint32_t AlignInBits); 12630b57cec5SDimitry Andric 12640b57cec5SDimitry Andric /** 1265*0fca6ea1SDimitry Andric * Only use in "new debug format" (LLVMIsNewDbgInfoFormat() is true). 1266*0fca6ea1SDimitry Andric * See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes 1267*0fca6ea1SDimitry Andric * 1268*0fca6ea1SDimitry Andric * The debug format can be switched later after inserting the records using 1269*0fca6ea1SDimitry Andric * LLVMSetIsNewDbgInfoFormat, if needed for legacy or transitionary reasons. 1270*0fca6ea1SDimitry Andric * 1271*0fca6ea1SDimitry Andric * Insert a Declare DbgRecord before the given instruction. 12720b57cec5SDimitry Andric * \param Builder The DIBuilder. 12730b57cec5SDimitry Andric * \param Storage The storage of the variable to declare. 12740b57cec5SDimitry Andric * \param VarInfo The variable's debug info descriptor. 12750b57cec5SDimitry Andric * \param Expr A complex location expression for the variable. 12760b57cec5SDimitry Andric * \param DebugLoc Debug info location. 1277*0fca6ea1SDimitry Andric * \param Instr Instruction acting as a location for the new record. 12780b57cec5SDimitry Andric */ 1279*0fca6ea1SDimitry Andric LLVMDbgRecordRef LLVMDIBuilderInsertDeclareRecordBefore( 12800b57cec5SDimitry Andric LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo, 12810b57cec5SDimitry Andric LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr); 12820b57cec5SDimitry Andric 12830b57cec5SDimitry Andric /** 1284*0fca6ea1SDimitry Andric * Only use in "new debug format" (LLVMIsNewDbgInfoFormat() is true). 1285*0fca6ea1SDimitry Andric * See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes 1286*0fca6ea1SDimitry Andric * 1287*0fca6ea1SDimitry Andric * The debug format can be switched later after inserting the records using 1288*0fca6ea1SDimitry Andric * LLVMSetIsNewDbgInfoFormat, if needed for legacy or transitionary reasons. 1289*0fca6ea1SDimitry Andric * 1290*0fca6ea1SDimitry Andric * Insert a Declare DbgRecord at the end of the given basic block. If the basic 1291*0fca6ea1SDimitry Andric * block has a terminator instruction, the record is inserted before that 1292*0fca6ea1SDimitry Andric * terminator instruction. 12930b57cec5SDimitry Andric * \param Builder The DIBuilder. 12940b57cec5SDimitry Andric * \param Storage The storage of the variable to declare. 12950b57cec5SDimitry Andric * \param VarInfo The variable's debug info descriptor. 12960b57cec5SDimitry Andric * \param Expr A complex location expression for the variable. 12970b57cec5SDimitry Andric * \param DebugLoc Debug info location. 1298*0fca6ea1SDimitry Andric * \param Block Basic block acting as a location for the new record. 12990b57cec5SDimitry Andric */ 1300*0fca6ea1SDimitry Andric LLVMDbgRecordRef LLVMDIBuilderInsertDeclareRecordAtEnd( 13010b57cec5SDimitry Andric LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo, 13020b57cec5SDimitry Andric LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block); 13030b57cec5SDimitry Andric 13040b57cec5SDimitry Andric /** 1305*0fca6ea1SDimitry Andric * Only use in "new debug format" (LLVMIsNewDbgInfoFormat() is true). 1306*0fca6ea1SDimitry Andric * See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes 1307*0fca6ea1SDimitry Andric * 1308*0fca6ea1SDimitry Andric * The debug format can be switched later after inserting the records using 1309*0fca6ea1SDimitry Andric * LLVMSetIsNewDbgInfoFormat, if needed for legacy or transitionary reasons. 1310*0fca6ea1SDimitry Andric * 1311*0fca6ea1SDimitry Andric * Insert a new debug record before the given instruction. 13120b57cec5SDimitry Andric * \param Builder The DIBuilder. 13130b57cec5SDimitry Andric * \param Val The value of the variable. 13140b57cec5SDimitry Andric * \param VarInfo The variable's debug info descriptor. 13150b57cec5SDimitry Andric * \param Expr A complex location expression for the variable. 13160b57cec5SDimitry Andric * \param DebugLoc Debug info location. 1317*0fca6ea1SDimitry Andric * \param Instr Instruction acting as a location for the new record. 13180b57cec5SDimitry Andric */ 1319*0fca6ea1SDimitry Andric LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueRecordBefore( 1320*0fca6ea1SDimitry Andric LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo, 1321*0fca6ea1SDimitry Andric LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr); 13220b57cec5SDimitry Andric 13230b57cec5SDimitry Andric /** 1324*0fca6ea1SDimitry Andric * Only use in "new debug format" (LLVMIsNewDbgInfoFormat() is true). 1325*0fca6ea1SDimitry Andric * See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes 1326*0fca6ea1SDimitry Andric * 1327*0fca6ea1SDimitry Andric * The debug format can be switched later after inserting the records using 1328*0fca6ea1SDimitry Andric * LLVMSetIsNewDbgInfoFormat, if needed for legacy or transitionary reasons. 1329*0fca6ea1SDimitry Andric * 1330*0fca6ea1SDimitry Andric * Insert a new debug record at the end of the given basic block. If the 1331*0fca6ea1SDimitry Andric * basic block has a terminator instruction, the record is inserted before 1332*0fca6ea1SDimitry Andric * that terminator instruction. 13330b57cec5SDimitry Andric * \param Builder The DIBuilder. 13340b57cec5SDimitry Andric * \param Val The value of the variable. 13350b57cec5SDimitry Andric * \param VarInfo The variable's debug info descriptor. 13360b57cec5SDimitry Andric * \param Expr A complex location expression for the variable. 13370b57cec5SDimitry Andric * \param DebugLoc Debug info location. 1338*0fca6ea1SDimitry Andric * \param Block Basic block acting as a location for the new record. 13390b57cec5SDimitry Andric */ 1340*0fca6ea1SDimitry Andric LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueRecordAtEnd( 1341*0fca6ea1SDimitry Andric LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo, 1342*0fca6ea1SDimitry Andric LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block); 13430b57cec5SDimitry Andric 13440b57cec5SDimitry Andric /** 13450b57cec5SDimitry Andric * Create a new descriptor for a local auto variable. 13460b57cec5SDimitry Andric * \param Builder The DIBuilder. 13470b57cec5SDimitry Andric * \param Scope The local scope the variable is declared in. 13480b57cec5SDimitry Andric * \param Name Variable name. 13490b57cec5SDimitry Andric * \param NameLen Length of variable name. 13500b57cec5SDimitry Andric * \param File File where this variable is defined. 13510b57cec5SDimitry Andric * \param LineNo Line number. 13520b57cec5SDimitry Andric * \param Ty Metadata describing the type of the variable. 13530b57cec5SDimitry Andric * \param AlwaysPreserve If true, this descriptor will survive optimizations. 13540b57cec5SDimitry Andric * \param Flags Flags. 13550b57cec5SDimitry Andric * \param AlignInBits Variable alignment. 13560b57cec5SDimitry Andric */ 13570b57cec5SDimitry Andric LLVMMetadataRef LLVMDIBuilderCreateAutoVariable( 13580b57cec5SDimitry Andric LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, 13590b57cec5SDimitry Andric size_t NameLen, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty, 13600b57cec5SDimitry Andric LLVMBool AlwaysPreserve, LLVMDIFlags Flags, uint32_t AlignInBits); 13610b57cec5SDimitry Andric 13620b57cec5SDimitry Andric /** 13630b57cec5SDimitry Andric * Create a new descriptor for a function parameter variable. 13640b57cec5SDimitry Andric * \param Builder The DIBuilder. 13650b57cec5SDimitry Andric * \param Scope The local scope the variable is declared in. 13660b57cec5SDimitry Andric * \param Name Variable name. 13670b57cec5SDimitry Andric * \param NameLen Length of variable name. 13680b57cec5SDimitry Andric * \param ArgNo Unique argument number for this variable; starts at 1. 13690b57cec5SDimitry Andric * \param File File where this variable is defined. 13700b57cec5SDimitry Andric * \param LineNo Line number. 13710b57cec5SDimitry Andric * \param Ty Metadata describing the type of the variable. 13720b57cec5SDimitry Andric * \param AlwaysPreserve If true, this descriptor will survive optimizations. 13730b57cec5SDimitry Andric * \param Flags Flags. 13740b57cec5SDimitry Andric */ 13750b57cec5SDimitry Andric LLVMMetadataRef LLVMDIBuilderCreateParameterVariable( 13760b57cec5SDimitry Andric LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, 13770b57cec5SDimitry Andric size_t NameLen, unsigned ArgNo, LLVMMetadataRef File, unsigned LineNo, 13780b57cec5SDimitry Andric LLVMMetadataRef Ty, LLVMBool AlwaysPreserve, LLVMDIFlags Flags); 13790b57cec5SDimitry Andric 13800b57cec5SDimitry Andric /** 13810b57cec5SDimitry Andric * Get the metadata of the subprogram attached to a function. 13820b57cec5SDimitry Andric * 13830b57cec5SDimitry Andric * @see llvm::Function::getSubprogram() 13840b57cec5SDimitry Andric */ 13850b57cec5SDimitry Andric LLVMMetadataRef LLVMGetSubprogram(LLVMValueRef Func); 13860b57cec5SDimitry Andric 13870b57cec5SDimitry Andric /** 13880b57cec5SDimitry Andric * Set the subprogram attached to a function. 13890b57cec5SDimitry Andric * 13900b57cec5SDimitry Andric * @see llvm::Function::setSubprogram() 13910b57cec5SDimitry Andric */ 13920b57cec5SDimitry Andric void LLVMSetSubprogram(LLVMValueRef Func, LLVMMetadataRef SP); 13930b57cec5SDimitry Andric 13940b57cec5SDimitry Andric /** 13950b57cec5SDimitry Andric * Get the line associated with a given subprogram. 13960b57cec5SDimitry Andric * \param Subprogram The subprogram object. 13970b57cec5SDimitry Andric * 13980b57cec5SDimitry Andric * @see DISubprogram::getLine() 13990b57cec5SDimitry Andric */ 14000b57cec5SDimitry Andric unsigned LLVMDISubprogramGetLine(LLVMMetadataRef Subprogram); 14010b57cec5SDimitry Andric 14020b57cec5SDimitry Andric /** 14030b57cec5SDimitry Andric * Get the debug location for the given instruction. 14040b57cec5SDimitry Andric * 14050b57cec5SDimitry Andric * @see llvm::Instruction::getDebugLoc() 14060b57cec5SDimitry Andric */ 14070b57cec5SDimitry Andric LLVMMetadataRef LLVMInstructionGetDebugLoc(LLVMValueRef Inst); 14080b57cec5SDimitry Andric 14090b57cec5SDimitry Andric /** 14100b57cec5SDimitry Andric * Set the debug location for the given instruction. 14110b57cec5SDimitry Andric * 14120b57cec5SDimitry Andric * To clear the location metadata of the given instruction, pass NULL to \p Loc. 14130b57cec5SDimitry Andric * 14140b57cec5SDimitry Andric * @see llvm::Instruction::setDebugLoc() 14150b57cec5SDimitry Andric */ 14160b57cec5SDimitry Andric void LLVMInstructionSetDebugLoc(LLVMValueRef Inst, LLVMMetadataRef Loc); 14170b57cec5SDimitry Andric 14180b57cec5SDimitry Andric /** 14190b57cec5SDimitry Andric * Obtain the enumerated type of a Metadata instance. 14200b57cec5SDimitry Andric * 14210b57cec5SDimitry Andric * @see llvm::Metadata::getMetadataID() 14220b57cec5SDimitry Andric */ 14230b57cec5SDimitry Andric LLVMMetadataKind LLVMGetMetadataKind(LLVMMetadataRef Metadata); 14240b57cec5SDimitry Andric 1425349cc55cSDimitry Andric /** 1426349cc55cSDimitry Andric * @} 1427349cc55cSDimitry Andric */ 1428349cc55cSDimitry Andric 1429480093f4SDimitry Andric LLVM_C_EXTERN_C_END 14300b57cec5SDimitry Andric 14310b57cec5SDimitry Andric #endif 1432