|
|
|||
File indexing completed on 2026-05-10 08:43:01
0001 //===------------ DebugInfo.h - LLVM C API Debug Info API -----------------===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 /// 0009 /// This file declares the C API endpoints for generating DWARF Debug Info 0010 /// 0011 /// Note: This interface is experimental. It is *NOT* stable, and may be 0012 /// changed without warning. 0013 /// 0014 //===----------------------------------------------------------------------===// 0015 0016 #ifndef LLVM_C_DEBUGINFO_H 0017 #define LLVM_C_DEBUGINFO_H 0018 0019 #include "llvm-c/ExternC.h" 0020 #include "llvm-c/Types.h" 0021 0022 LLVM_C_EXTERN_C_BEGIN 0023 0024 /** 0025 * @defgroup LLVMCCoreDebugInfo Debug Information 0026 * @ingroup LLVMCCore 0027 * 0028 * @{ 0029 */ 0030 0031 /** 0032 * Debug info flags. 0033 */ 0034 typedef enum { 0035 LLVMDIFlagZero = 0, 0036 LLVMDIFlagPrivate = 1, 0037 LLVMDIFlagProtected = 2, 0038 LLVMDIFlagPublic = 3, 0039 LLVMDIFlagFwdDecl = 1 << 2, 0040 LLVMDIFlagAppleBlock = 1 << 3, 0041 LLVMDIFlagReservedBit4 = 1 << 4, 0042 LLVMDIFlagVirtual = 1 << 5, 0043 LLVMDIFlagArtificial = 1 << 6, 0044 LLVMDIFlagExplicit = 1 << 7, 0045 LLVMDIFlagPrototyped = 1 << 8, 0046 LLVMDIFlagObjcClassComplete = 1 << 9, 0047 LLVMDIFlagObjectPointer = 1 << 10, 0048 LLVMDIFlagVector = 1 << 11, 0049 LLVMDIFlagStaticMember = 1 << 12, 0050 LLVMDIFlagLValueReference = 1 << 13, 0051 LLVMDIFlagRValueReference = 1 << 14, 0052 LLVMDIFlagReserved = 1 << 15, 0053 LLVMDIFlagSingleInheritance = 1 << 16, 0054 LLVMDIFlagMultipleInheritance = 2 << 16, 0055 LLVMDIFlagVirtualInheritance = 3 << 16, 0056 LLVMDIFlagIntroducedVirtual = 1 << 18, 0057 LLVMDIFlagBitField = 1 << 19, 0058 LLVMDIFlagNoReturn = 1 << 20, 0059 LLVMDIFlagTypePassByValue = 1 << 22, 0060 LLVMDIFlagTypePassByReference = 1 << 23, 0061 LLVMDIFlagEnumClass = 1 << 24, 0062 LLVMDIFlagFixedEnum = LLVMDIFlagEnumClass, // Deprecated. 0063 LLVMDIFlagThunk = 1 << 25, 0064 LLVMDIFlagNonTrivial = 1 << 26, 0065 LLVMDIFlagBigEndian = 1 << 27, 0066 LLVMDIFlagLittleEndian = 1 << 28, 0067 LLVMDIFlagIndirectVirtualBase = (1 << 2) | (1 << 5), 0068 LLVMDIFlagAccessibility = LLVMDIFlagPrivate | LLVMDIFlagProtected | 0069 LLVMDIFlagPublic, 0070 LLVMDIFlagPtrToMemberRep = LLVMDIFlagSingleInheritance | 0071 LLVMDIFlagMultipleInheritance | 0072 LLVMDIFlagVirtualInheritance 0073 } LLVMDIFlags; 0074 0075 /** 0076 * Source languages known by DWARF. 0077 */ 0078 typedef enum { 0079 LLVMDWARFSourceLanguageC89, 0080 LLVMDWARFSourceLanguageC, 0081 LLVMDWARFSourceLanguageAda83, 0082 LLVMDWARFSourceLanguageC_plus_plus, 0083 LLVMDWARFSourceLanguageCobol74, 0084 LLVMDWARFSourceLanguageCobol85, 0085 LLVMDWARFSourceLanguageFortran77, 0086 LLVMDWARFSourceLanguageFortran90, 0087 LLVMDWARFSourceLanguagePascal83, 0088 LLVMDWARFSourceLanguageModula2, 0089 // New in DWARF v3: 0090 LLVMDWARFSourceLanguageJava, 0091 LLVMDWARFSourceLanguageC99, 0092 LLVMDWARFSourceLanguageAda95, 0093 LLVMDWARFSourceLanguageFortran95, 0094 LLVMDWARFSourceLanguagePLI, 0095 LLVMDWARFSourceLanguageObjC, 0096 LLVMDWARFSourceLanguageObjC_plus_plus, 0097 LLVMDWARFSourceLanguageUPC, 0098 LLVMDWARFSourceLanguageD, 0099 // New in DWARF v4: 0100 LLVMDWARFSourceLanguagePython, 0101 // New in DWARF v5: 0102 LLVMDWARFSourceLanguageOpenCL, 0103 LLVMDWARFSourceLanguageGo, 0104 LLVMDWARFSourceLanguageModula3, 0105 LLVMDWARFSourceLanguageHaskell, 0106 LLVMDWARFSourceLanguageC_plus_plus_03, 0107 LLVMDWARFSourceLanguageC_plus_plus_11, 0108 LLVMDWARFSourceLanguageOCaml, 0109 LLVMDWARFSourceLanguageRust, 0110 LLVMDWARFSourceLanguageC11, 0111 LLVMDWARFSourceLanguageSwift, 0112 LLVMDWARFSourceLanguageJulia, 0113 LLVMDWARFSourceLanguageDylan, 0114 LLVMDWARFSourceLanguageC_plus_plus_14, 0115 LLVMDWARFSourceLanguageFortran03, 0116 LLVMDWARFSourceLanguageFortran08, 0117 LLVMDWARFSourceLanguageRenderScript, 0118 LLVMDWARFSourceLanguageBLISS, 0119 LLVMDWARFSourceLanguageKotlin, 0120 LLVMDWARFSourceLanguageZig, 0121 LLVMDWARFSourceLanguageCrystal, 0122 LLVMDWARFSourceLanguageC_plus_plus_17, 0123 LLVMDWARFSourceLanguageC_plus_plus_20, 0124 LLVMDWARFSourceLanguageC17, 0125 LLVMDWARFSourceLanguageFortran18, 0126 LLVMDWARFSourceLanguageAda2005, 0127 LLVMDWARFSourceLanguageAda2012, 0128 LLVMDWARFSourceLanguageHIP, 0129 LLVMDWARFSourceLanguageAssembly, 0130 LLVMDWARFSourceLanguageC_sharp, 0131 LLVMDWARFSourceLanguageMojo, 0132 LLVMDWARFSourceLanguageGLSL, 0133 LLVMDWARFSourceLanguageGLSL_ES, 0134 LLVMDWARFSourceLanguageHLSL, 0135 LLVMDWARFSourceLanguageOpenCL_CPP, 0136 LLVMDWARFSourceLanguageCPP_for_OpenCL, 0137 LLVMDWARFSourceLanguageSYCL, 0138 LLVMDWARFSourceLanguageRuby, 0139 LLVMDWARFSourceLanguageMove, 0140 LLVMDWARFSourceLanguageHylo, 0141 LLVMDWARFSourceLanguageMetal, 0142 0143 // Vendor extensions: 0144 LLVMDWARFSourceLanguageMips_Assembler, 0145 LLVMDWARFSourceLanguageGOOGLE_RenderScript, 0146 LLVMDWARFSourceLanguageBORLAND_Delphi 0147 } LLVMDWARFSourceLanguage; 0148 0149 /** 0150 * The amount of debug information to emit. 0151 */ 0152 typedef enum { 0153 LLVMDWARFEmissionNone = 0, 0154 LLVMDWARFEmissionFull, 0155 LLVMDWARFEmissionLineTablesOnly 0156 } LLVMDWARFEmissionKind; 0157 0158 /** 0159 * The kind of metadata nodes. 0160 */ 0161 enum { 0162 LLVMMDStringMetadataKind, 0163 LLVMConstantAsMetadataMetadataKind, 0164 LLVMLocalAsMetadataMetadataKind, 0165 LLVMDistinctMDOperandPlaceholderMetadataKind, 0166 LLVMMDTupleMetadataKind, 0167 LLVMDILocationMetadataKind, 0168 LLVMDIExpressionMetadataKind, 0169 LLVMDIGlobalVariableExpressionMetadataKind, 0170 LLVMGenericDINodeMetadataKind, 0171 LLVMDISubrangeMetadataKind, 0172 LLVMDIEnumeratorMetadataKind, 0173 LLVMDIBasicTypeMetadataKind, 0174 LLVMDIDerivedTypeMetadataKind, 0175 LLVMDICompositeTypeMetadataKind, 0176 LLVMDISubroutineTypeMetadataKind, 0177 LLVMDIFileMetadataKind, 0178 LLVMDICompileUnitMetadataKind, 0179 LLVMDISubprogramMetadataKind, 0180 LLVMDILexicalBlockMetadataKind, 0181 LLVMDILexicalBlockFileMetadataKind, 0182 LLVMDINamespaceMetadataKind, 0183 LLVMDIModuleMetadataKind, 0184 LLVMDITemplateTypeParameterMetadataKind, 0185 LLVMDITemplateValueParameterMetadataKind, 0186 LLVMDIGlobalVariableMetadataKind, 0187 LLVMDILocalVariableMetadataKind, 0188 LLVMDILabelMetadataKind, 0189 LLVMDIObjCPropertyMetadataKind, 0190 LLVMDIImportedEntityMetadataKind, 0191 LLVMDIMacroMetadataKind, 0192 LLVMDIMacroFileMetadataKind, 0193 LLVMDICommonBlockMetadataKind, 0194 LLVMDIStringTypeMetadataKind, 0195 LLVMDIGenericSubrangeMetadataKind, 0196 LLVMDIArgListMetadataKind, 0197 LLVMDIAssignIDMetadataKind, 0198 }; 0199 typedef unsigned LLVMMetadataKind; 0200 0201 /** 0202 * An LLVM DWARF type encoding. 0203 */ 0204 typedef unsigned LLVMDWARFTypeEncoding; 0205 0206 /** 0207 * Describes the kind of macro declaration used for LLVMDIBuilderCreateMacro. 0208 * @see llvm::dwarf::MacinfoRecordType 0209 * @note Values are from DW_MACINFO_* constants in the DWARF specification. 0210 */ 0211 typedef enum { 0212 LLVMDWARFMacinfoRecordTypeDefine = 0x01, 0213 LLVMDWARFMacinfoRecordTypeMacro = 0x02, 0214 LLVMDWARFMacinfoRecordTypeStartFile = 0x03, 0215 LLVMDWARFMacinfoRecordTypeEndFile = 0x04, 0216 LLVMDWARFMacinfoRecordTypeVendorExt = 0xff 0217 } LLVMDWARFMacinfoRecordType; 0218 0219 /** 0220 * The current debug metadata version number. 0221 */ 0222 unsigned LLVMDebugMetadataVersion(void); 0223 0224 /** 0225 * The version of debug metadata that's present in the provided \c Module. 0226 */ 0227 unsigned LLVMGetModuleDebugMetadataVersion(LLVMModuleRef Module); 0228 0229 /** 0230 * Strip debug info in the module if it exists. 0231 * To do this, we remove all calls to the debugger intrinsics and any named 0232 * metadata for debugging. We also remove debug locations for instructions. 0233 * Return true if module is modified. 0234 */ 0235 LLVMBool LLVMStripModuleDebugInfo(LLVMModuleRef Module); 0236 0237 /** 0238 * Construct a builder for a module, and do not allow for unresolved nodes 0239 * attached to the module. 0240 */ 0241 LLVMDIBuilderRef LLVMCreateDIBuilderDisallowUnresolved(LLVMModuleRef M); 0242 0243 /** 0244 * Construct a builder for a module and collect unresolved nodes attached 0245 * to the module in order to resolve cycles during a call to 0246 * \c LLVMDIBuilderFinalize. 0247 */ 0248 LLVMDIBuilderRef LLVMCreateDIBuilder(LLVMModuleRef M); 0249 0250 /** 0251 * Deallocates the \c DIBuilder and everything it owns. 0252 * @note You must call \c LLVMDIBuilderFinalize before this 0253 */ 0254 void LLVMDisposeDIBuilder(LLVMDIBuilderRef Builder); 0255 0256 /** 0257 * Construct any deferred debug info descriptors. 0258 */ 0259 void LLVMDIBuilderFinalize(LLVMDIBuilderRef Builder); 0260 0261 /** 0262 * Finalize a specific subprogram. 0263 * No new variables may be added to this subprogram afterwards. 0264 */ 0265 void LLVMDIBuilderFinalizeSubprogram(LLVMDIBuilderRef Builder, 0266 LLVMMetadataRef Subprogram); 0267 0268 /** 0269 * A CompileUnit provides an anchor for all debugging 0270 * information generated during this instance of compilation. 0271 * \param Lang Source programming language, eg. 0272 * \c LLVMDWARFSourceLanguageC99 0273 * \param FileRef File info. 0274 * \param Producer Identify the producer of debugging information 0275 * and code. Usually this is a compiler 0276 * version string. 0277 * \param ProducerLen The length of the C string passed to \c Producer. 0278 * \param isOptimized A boolean flag which indicates whether optimization 0279 * is enabled or not. 0280 * \param Flags This string lists command line options. This 0281 * string is directly embedded in debug info 0282 * output which may be used by a tool 0283 * analyzing generated debugging information. 0284 * \param FlagsLen The length of the C string passed to \c Flags. 0285 * \param RuntimeVer This indicates runtime version for languages like 0286 * Objective-C. 0287 * \param SplitName The name of the file that we'll split debug info 0288 * out into. 0289 * \param SplitNameLen The length of the C string passed to \c SplitName. 0290 * \param Kind The kind of debug information to generate. 0291 * \param DWOId The DWOId if this is a split skeleton compile unit. 0292 * \param SplitDebugInlining Whether to emit inline debug info. 0293 * \param DebugInfoForProfiling Whether to emit extra debug info for 0294 * profile collection. 0295 * \param SysRoot The Clang system root (value of -isysroot). 0296 * \param SysRootLen The length of the C string passed to \c SysRoot. 0297 * \param SDK The SDK. On Darwin, the last component of the sysroot. 0298 * \param SDKLen The length of the C string passed to \c SDK. 0299 */ 0300 LLVMMetadataRef LLVMDIBuilderCreateCompileUnit( 0301 LLVMDIBuilderRef Builder, LLVMDWARFSourceLanguage Lang, 0302 LLVMMetadataRef FileRef, const char *Producer, size_t ProducerLen, 0303 LLVMBool isOptimized, const char *Flags, size_t FlagsLen, 0304 unsigned RuntimeVer, const char *SplitName, size_t SplitNameLen, 0305 LLVMDWARFEmissionKind Kind, unsigned DWOId, LLVMBool SplitDebugInlining, 0306 LLVMBool DebugInfoForProfiling, const char *SysRoot, size_t SysRootLen, 0307 const char *SDK, size_t SDKLen); 0308 0309 /** 0310 * Create a file descriptor to hold debugging information for a file. 0311 * \param Builder The \c DIBuilder. 0312 * \param Filename File name. 0313 * \param FilenameLen The length of the C string passed to \c Filename. 0314 * \param Directory Directory. 0315 * \param DirectoryLen The length of the C string passed to \c Directory. 0316 */ 0317 LLVMMetadataRef 0318 LLVMDIBuilderCreateFile(LLVMDIBuilderRef Builder, const char *Filename, 0319 size_t FilenameLen, const char *Directory, 0320 size_t DirectoryLen); 0321 0322 /** 0323 * Creates a new descriptor for a module with the specified parent scope. 0324 * \param Builder The \c DIBuilder. 0325 * \param ParentScope The parent scope containing this module declaration. 0326 * \param Name Module name. 0327 * \param NameLen The length of the C string passed to \c Name. 0328 * \param ConfigMacros A space-separated shell-quoted list of -D macro 0329 definitions as they would appear on a command line. 0330 * \param ConfigMacrosLen The length of the C string passed to \c ConfigMacros. 0331 * \param IncludePath The path to the module map file. 0332 * \param IncludePathLen The length of the C string passed to \c IncludePath. 0333 * \param APINotesFile The path to an API notes file for the module. 0334 * \param APINotesFileLen The length of the C string passed to \c APINotestFile. 0335 */ 0336 LLVMMetadataRef 0337 LLVMDIBuilderCreateModule(LLVMDIBuilderRef Builder, LLVMMetadataRef ParentScope, 0338 const char *Name, size_t NameLen, 0339 const char *ConfigMacros, size_t ConfigMacrosLen, 0340 const char *IncludePath, size_t IncludePathLen, 0341 const char *APINotesFile, size_t APINotesFileLen); 0342 0343 /** 0344 * Creates a new descriptor for a namespace with the specified parent scope. 0345 * \param Builder The \c DIBuilder. 0346 * \param ParentScope The parent scope containing this module declaration. 0347 * \param Name NameSpace name. 0348 * \param NameLen The length of the C string passed to \c Name. 0349 * \param ExportSymbols Whether or not the namespace exports symbols, e.g. 0350 * this is true of C++ inline namespaces. 0351 */ 0352 LLVMMetadataRef 0353 LLVMDIBuilderCreateNameSpace(LLVMDIBuilderRef Builder, 0354 LLVMMetadataRef ParentScope, 0355 const char *Name, size_t NameLen, 0356 LLVMBool ExportSymbols); 0357 0358 /** 0359 * Create a new descriptor for the specified subprogram. 0360 * \param Builder The \c DIBuilder. 0361 * \param Scope Function scope. 0362 * \param Name Function name. 0363 * \param NameLen Length of enumeration name. 0364 * \param LinkageName Mangled function name. 0365 * \param LinkageNameLen Length of linkage name. 0366 * \param File File where this variable is defined. 0367 * \param LineNo Line number. 0368 * \param Ty Function type. 0369 * \param IsLocalToUnit True if this function is not externally visible. 0370 * \param IsDefinition True if this is a function definition. 0371 * \param ScopeLine Set to the beginning of the scope this starts 0372 * \param Flags E.g.: \c LLVMDIFlagLValueReference. These flags are 0373 * used to emit dwarf attributes. 0374 * \param IsOptimized True if optimization is ON. 0375 */ 0376 LLVMMetadataRef LLVMDIBuilderCreateFunction( 0377 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, 0378 size_t NameLen, const char *LinkageName, size_t LinkageNameLen, 0379 LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty, 0380 LLVMBool IsLocalToUnit, LLVMBool IsDefinition, 0381 unsigned ScopeLine, LLVMDIFlags Flags, LLVMBool IsOptimized); 0382 0383 /** 0384 * Create a descriptor for a lexical block with the specified parent context. 0385 * \param Builder The \c DIBuilder. 0386 * \param Scope Parent lexical block. 0387 * \param File Source file. 0388 * \param Line The line in the source file. 0389 * \param Column The column in the source file. 0390 */ 0391 LLVMMetadataRef LLVMDIBuilderCreateLexicalBlock( 0392 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, 0393 LLVMMetadataRef File, unsigned Line, unsigned Column); 0394 0395 /** 0396 * Create a descriptor for a lexical block with a new file attached. 0397 * \param Builder The \c DIBuilder. 0398 * \param Scope Lexical block. 0399 * \param File Source file. 0400 * \param Discriminator DWARF path discriminator value. 0401 */ 0402 LLVMMetadataRef 0403 LLVMDIBuilderCreateLexicalBlockFile(LLVMDIBuilderRef Builder, 0404 LLVMMetadataRef Scope, 0405 LLVMMetadataRef File, 0406 unsigned Discriminator); 0407 0408 /** 0409 * Create a descriptor for an imported namespace. Suitable for e.g. C++ 0410 * using declarations. 0411 * \param Builder The \c DIBuilder. 0412 * \param Scope The scope this module is imported into 0413 * \param File File where the declaration is located. 0414 * \param Line Line number of the declaration. 0415 */ 0416 LLVMMetadataRef 0417 LLVMDIBuilderCreateImportedModuleFromNamespace(LLVMDIBuilderRef Builder, 0418 LLVMMetadataRef Scope, 0419 LLVMMetadataRef NS, 0420 LLVMMetadataRef File, 0421 unsigned Line); 0422 0423 /** 0424 * Create a descriptor for an imported module that aliases another 0425 * imported entity descriptor. 0426 * \param Builder The \c DIBuilder. 0427 * \param Scope The scope this module is imported into 0428 * \param ImportedEntity Previous imported entity to alias. 0429 * \param File File where the declaration is located. 0430 * \param Line Line number of the declaration. 0431 * \param Elements Renamed elements. 0432 * \param NumElements Number of renamed elements. 0433 */ 0434 LLVMMetadataRef LLVMDIBuilderCreateImportedModuleFromAlias( 0435 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, 0436 LLVMMetadataRef ImportedEntity, LLVMMetadataRef File, unsigned Line, 0437 LLVMMetadataRef *Elements, unsigned NumElements); 0438 0439 /** 0440 * Create a descriptor for an imported module. 0441 * \param Builder The \c DIBuilder. 0442 * \param Scope The scope this module is imported into 0443 * \param M The module being imported here 0444 * \param File File where the declaration is located. 0445 * \param Line Line number of the declaration. 0446 * \param Elements Renamed elements. 0447 * \param NumElements Number of renamed elements. 0448 */ 0449 LLVMMetadataRef LLVMDIBuilderCreateImportedModuleFromModule( 0450 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, LLVMMetadataRef M, 0451 LLVMMetadataRef File, unsigned Line, LLVMMetadataRef *Elements, 0452 unsigned NumElements); 0453 0454 /** 0455 * Create a descriptor for an imported function, type, or variable. Suitable 0456 * for e.g. FORTRAN-style USE declarations. 0457 * \param Builder The DIBuilder. 0458 * \param Scope The scope this module is imported into. 0459 * \param Decl The declaration (or definition) of a function, type, 0460 or variable. 0461 * \param File File where the declaration is located. 0462 * \param Line Line number of the declaration. 0463 * \param Name A name that uniquely identifies this imported 0464 declaration. 0465 * \param NameLen The length of the C string passed to \c Name. 0466 * \param Elements Renamed elements. 0467 * \param NumElements Number of renamed elements. 0468 */ 0469 LLVMMetadataRef LLVMDIBuilderCreateImportedDeclaration( 0470 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, LLVMMetadataRef Decl, 0471 LLVMMetadataRef File, unsigned Line, const char *Name, size_t NameLen, 0472 LLVMMetadataRef *Elements, unsigned NumElements); 0473 0474 /** 0475 * Creates a new DebugLocation that describes a source location. 0476 * \param Line The line in the source file. 0477 * \param Column The column in the source file. 0478 * \param Scope The scope in which the location resides. 0479 * \param InlinedAt The scope where this location was inlined, if at all. 0480 * (optional). 0481 * \note If the item to which this location is attached cannot be 0482 * attributed to a source line, pass 0 for the line and column. 0483 */ 0484 LLVMMetadataRef 0485 LLVMDIBuilderCreateDebugLocation(LLVMContextRef Ctx, unsigned Line, 0486 unsigned Column, LLVMMetadataRef Scope, 0487 LLVMMetadataRef InlinedAt); 0488 0489 /** 0490 * Get the line number of this debug location. 0491 * \param Location The debug location. 0492 * 0493 * @see DILocation::getLine() 0494 */ 0495 unsigned LLVMDILocationGetLine(LLVMMetadataRef Location); 0496 0497 /** 0498 * Get the column number of this debug location. 0499 * \param Location The debug location. 0500 * 0501 * @see DILocation::getColumn() 0502 */ 0503 unsigned LLVMDILocationGetColumn(LLVMMetadataRef Location); 0504 0505 /** 0506 * Get the local scope associated with this debug location. 0507 * \param Location The debug location. 0508 * 0509 * @see DILocation::getScope() 0510 */ 0511 LLVMMetadataRef LLVMDILocationGetScope(LLVMMetadataRef Location); 0512 0513 /** 0514 * Get the "inline at" location associated with this debug location. 0515 * \param Location The debug location. 0516 * 0517 * @see DILocation::getInlinedAt() 0518 */ 0519 LLVMMetadataRef LLVMDILocationGetInlinedAt(LLVMMetadataRef Location); 0520 0521 /** 0522 * Get the metadata of the file associated with a given scope. 0523 * \param Scope The scope object. 0524 * 0525 * @see DIScope::getFile() 0526 */ 0527 LLVMMetadataRef LLVMDIScopeGetFile(LLVMMetadataRef Scope); 0528 0529 /** 0530 * Get the directory of a given file. 0531 * \param File The file object. 0532 * \param Len The length of the returned string. 0533 * 0534 * @see DIFile::getDirectory() 0535 */ 0536 const char *LLVMDIFileGetDirectory(LLVMMetadataRef File, unsigned *Len); 0537 0538 /** 0539 * Get the name of a given file. 0540 * \param File The file object. 0541 * \param Len The length of the returned string. 0542 * 0543 * @see DIFile::getFilename() 0544 */ 0545 const char *LLVMDIFileGetFilename(LLVMMetadataRef File, unsigned *Len); 0546 0547 /** 0548 * Get the source of a given file. 0549 * \param File The file object. 0550 * \param Len The length of the returned string. 0551 * 0552 * @see DIFile::getSource() 0553 */ 0554 const char *LLVMDIFileGetSource(LLVMMetadataRef File, unsigned *Len); 0555 0556 /** 0557 * Create a type array. 0558 * \param Builder The DIBuilder. 0559 * \param Data The type elements. 0560 * \param NumElements Number of type elements. 0561 */ 0562 LLVMMetadataRef LLVMDIBuilderGetOrCreateTypeArray(LLVMDIBuilderRef Builder, 0563 LLVMMetadataRef *Data, 0564 size_t NumElements); 0565 0566 /** 0567 * Create subroutine type. 0568 * \param Builder The DIBuilder. 0569 * \param File The file in which the subroutine resides. 0570 * \param ParameterTypes An array of subroutine parameter types. This 0571 * includes return type at 0th index. 0572 * \param NumParameterTypes The number of parameter types in \c ParameterTypes 0573 * \param Flags E.g.: \c LLVMDIFlagLValueReference. 0574 * These flags are used to emit dwarf attributes. 0575 */ 0576 LLVMMetadataRef 0577 LLVMDIBuilderCreateSubroutineType(LLVMDIBuilderRef Builder, 0578 LLVMMetadataRef File, 0579 LLVMMetadataRef *ParameterTypes, 0580 unsigned NumParameterTypes, 0581 LLVMDIFlags Flags); 0582 0583 /** 0584 * Create debugging information entry for a macro. 0585 * @param Builder The DIBuilder. 0586 * @param ParentMacroFile Macro parent (could be NULL). 0587 * @param Line Source line number where the macro is defined. 0588 * @param RecordType DW_MACINFO_define or DW_MACINFO_undef. 0589 * @param Name Macro name. 0590 * @param NameLen Macro name length. 0591 * @param Value Macro value. 0592 * @param ValueLen Macro value length. 0593 */ 0594 LLVMMetadataRef LLVMDIBuilderCreateMacro(LLVMDIBuilderRef Builder, 0595 LLVMMetadataRef ParentMacroFile, 0596 unsigned Line, 0597 LLVMDWARFMacinfoRecordType RecordType, 0598 const char *Name, size_t NameLen, 0599 const char *Value, size_t ValueLen); 0600 0601 /** 0602 * Create debugging information temporary entry for a macro file. 0603 * List of macro node direct children will be calculated by DIBuilder, 0604 * using the \p ParentMacroFile relationship. 0605 * @param Builder The DIBuilder. 0606 * @param ParentMacroFile Macro parent (could be NULL). 0607 * @param Line Source line number where the macro file is included. 0608 * @param File File descriptor containing the name of the macro file. 0609 */ 0610 LLVMMetadataRef 0611 LLVMDIBuilderCreateTempMacroFile(LLVMDIBuilderRef Builder, 0612 LLVMMetadataRef ParentMacroFile, unsigned Line, 0613 LLVMMetadataRef File); 0614 0615 /** 0616 * Create debugging information entry for an enumerator. 0617 * @param Builder The DIBuilder. 0618 * @param Name Enumerator name. 0619 * @param NameLen Length of enumerator name. 0620 * @param Value Enumerator value. 0621 * @param IsUnsigned True if the value is unsigned. 0622 */ 0623 LLVMMetadataRef LLVMDIBuilderCreateEnumerator(LLVMDIBuilderRef Builder, 0624 const char *Name, size_t NameLen, 0625 int64_t Value, 0626 LLVMBool IsUnsigned); 0627 0628 /** 0629 * Create debugging information entry for an enumeration. 0630 * \param Builder The DIBuilder. 0631 * \param Scope Scope in which this enumeration is defined. 0632 * \param Name Enumeration name. 0633 * \param NameLen Length of enumeration name. 0634 * \param File File where this member is defined. 0635 * \param LineNumber Line number. 0636 * \param SizeInBits Member size. 0637 * \param AlignInBits Member alignment. 0638 * \param Elements Enumeration elements. 0639 * \param NumElements Number of enumeration elements. 0640 * \param ClassTy Underlying type of a C++11/ObjC fixed enum. 0641 */ 0642 LLVMMetadataRef LLVMDIBuilderCreateEnumerationType( 0643 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, 0644 size_t NameLen, LLVMMetadataRef File, unsigned LineNumber, 0645 uint64_t SizeInBits, uint32_t AlignInBits, LLVMMetadataRef *Elements, 0646 unsigned NumElements, LLVMMetadataRef ClassTy); 0647 0648 /** 0649 * Create debugging information entry for a union. 0650 * \param Builder The DIBuilder. 0651 * \param Scope Scope in which this union is defined. 0652 * \param Name Union name. 0653 * \param NameLen Length of union name. 0654 * \param File File where this member is defined. 0655 * \param LineNumber Line number. 0656 * \param SizeInBits Member size. 0657 * \param AlignInBits Member alignment. 0658 * \param Flags Flags to encode member attribute, e.g. private 0659 * \param Elements Union elements. 0660 * \param NumElements Number of union elements. 0661 * \param RunTimeLang Optional parameter, Objective-C runtime version. 0662 * \param UniqueId A unique identifier for the union. 0663 * \param UniqueIdLen Length of unique identifier. 0664 */ 0665 LLVMMetadataRef LLVMDIBuilderCreateUnionType( 0666 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, 0667 size_t NameLen, LLVMMetadataRef File, unsigned LineNumber, 0668 uint64_t SizeInBits, uint32_t AlignInBits, LLVMDIFlags Flags, 0669 LLVMMetadataRef *Elements, unsigned NumElements, unsigned RunTimeLang, 0670 const char *UniqueId, size_t UniqueIdLen); 0671 0672 0673 /** 0674 * Create debugging information entry for an array. 0675 * \param Builder The DIBuilder. 0676 * \param Size Array size. 0677 * \param AlignInBits Alignment. 0678 * \param Ty Element type. 0679 * \param Subscripts Subscripts. 0680 * \param NumSubscripts Number of subscripts. 0681 */ 0682 LLVMMetadataRef 0683 LLVMDIBuilderCreateArrayType(LLVMDIBuilderRef Builder, uint64_t Size, 0684 uint32_t AlignInBits, LLVMMetadataRef Ty, 0685 LLVMMetadataRef *Subscripts, 0686 unsigned NumSubscripts); 0687 0688 /** 0689 * Create debugging information entry for a vector type. 0690 * \param Builder The DIBuilder. 0691 * \param Size Vector size. 0692 * \param AlignInBits Alignment. 0693 * \param Ty Element type. 0694 * \param Subscripts Subscripts. 0695 * \param NumSubscripts Number of subscripts. 0696 */ 0697 LLVMMetadataRef 0698 LLVMDIBuilderCreateVectorType(LLVMDIBuilderRef Builder, uint64_t Size, 0699 uint32_t AlignInBits, LLVMMetadataRef Ty, 0700 LLVMMetadataRef *Subscripts, 0701 unsigned NumSubscripts); 0702 0703 /** 0704 * Create a DWARF unspecified type. 0705 * \param Builder The DIBuilder. 0706 * \param Name The unspecified type's name. 0707 * \param NameLen Length of type name. 0708 */ 0709 LLVMMetadataRef 0710 LLVMDIBuilderCreateUnspecifiedType(LLVMDIBuilderRef Builder, const char *Name, 0711 size_t NameLen); 0712 0713 /** 0714 * Create debugging information entry for a basic 0715 * type. 0716 * \param Builder The DIBuilder. 0717 * \param Name Type name. 0718 * \param NameLen Length of type name. 0719 * \param SizeInBits Size of the type. 0720 * \param Encoding DWARF encoding code, e.g. \c LLVMDWARFTypeEncoding_float. 0721 * \param Flags Flags to encode optional attribute like endianity 0722 */ 0723 LLVMMetadataRef 0724 LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef Builder, const char *Name, 0725 size_t NameLen, uint64_t SizeInBits, 0726 LLVMDWARFTypeEncoding Encoding, 0727 LLVMDIFlags Flags); 0728 0729 /** 0730 * Create debugging information entry for a pointer. 0731 * \param Builder The DIBuilder. 0732 * \param PointeeTy Type pointed by this pointer. 0733 * \param SizeInBits Size. 0734 * \param AlignInBits Alignment. (optional, pass 0 to ignore) 0735 * \param AddressSpace DWARF address space. (optional, pass 0 to ignore) 0736 * \param Name Pointer type name. (optional) 0737 * \param NameLen Length of pointer type name. (optional) 0738 */ 0739 LLVMMetadataRef LLVMDIBuilderCreatePointerType( 0740 LLVMDIBuilderRef Builder, LLVMMetadataRef PointeeTy, 0741 uint64_t SizeInBits, uint32_t AlignInBits, unsigned AddressSpace, 0742 const char *Name, size_t NameLen); 0743 0744 /** 0745 * Create debugging information entry for a struct. 0746 * \param Builder The DIBuilder. 0747 * \param Scope Scope in which this struct is defined. 0748 * \param Name Struct name. 0749 * \param NameLen Struct name length. 0750 * \param File File where this member is defined. 0751 * \param LineNumber Line number. 0752 * \param SizeInBits Member size. 0753 * \param AlignInBits Member alignment. 0754 * \param Flags Flags to encode member attribute, e.g. private 0755 * \param Elements Struct elements. 0756 * \param NumElements Number of struct elements. 0757 * \param RunTimeLang Optional parameter, Objective-C runtime version. 0758 * \param VTableHolder The object containing the vtable for the struct. 0759 * \param UniqueId A unique identifier for the struct. 0760 * \param UniqueIdLen Length of the unique identifier for the struct. 0761 */ 0762 LLVMMetadataRef LLVMDIBuilderCreateStructType( 0763 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, 0764 size_t NameLen, LLVMMetadataRef File, unsigned LineNumber, 0765 uint64_t SizeInBits, uint32_t AlignInBits, LLVMDIFlags Flags, 0766 LLVMMetadataRef DerivedFrom, LLVMMetadataRef *Elements, 0767 unsigned NumElements, unsigned RunTimeLang, LLVMMetadataRef VTableHolder, 0768 const char *UniqueId, size_t UniqueIdLen); 0769 0770 /** 0771 * Create debugging information entry for a member. 0772 * \param Builder The DIBuilder. 0773 * \param Scope Member scope. 0774 * \param Name Member name. 0775 * \param NameLen Length of member name. 0776 * \param File File where this member is defined. 0777 * \param LineNo Line number. 0778 * \param SizeInBits Member size. 0779 * \param AlignInBits Member alignment. 0780 * \param OffsetInBits Member offset. 0781 * \param Flags Flags to encode member attribute, e.g. private 0782 * \param Ty Parent type. 0783 */ 0784 LLVMMetadataRef LLVMDIBuilderCreateMemberType( 0785 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, 0786 size_t NameLen, LLVMMetadataRef File, unsigned LineNo, 0787 uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, 0788 LLVMDIFlags Flags, LLVMMetadataRef Ty); 0789 0790 /** 0791 * Create debugging information entry for a 0792 * C++ static data member. 0793 * \param Builder The DIBuilder. 0794 * \param Scope Member scope. 0795 * \param Name Member name. 0796 * \param NameLen Length of member name. 0797 * \param File File where this member is declared. 0798 * \param LineNumber Line number. 0799 * \param Type Type of the static member. 0800 * \param Flags Flags to encode member attribute, e.g. private. 0801 * \param ConstantVal Const initializer of the member. 0802 * \param AlignInBits Member alignment. 0803 */ 0804 LLVMMetadataRef 0805 LLVMDIBuilderCreateStaticMemberType( 0806 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, 0807 size_t NameLen, LLVMMetadataRef File, unsigned LineNumber, 0808 LLVMMetadataRef Type, LLVMDIFlags Flags, LLVMValueRef ConstantVal, 0809 uint32_t AlignInBits); 0810 0811 /** 0812 * Create debugging information entry for a pointer to member. 0813 * \param Builder The DIBuilder. 0814 * \param PointeeType Type pointed to by this pointer. 0815 * \param ClassType Type for which this pointer points to members of. 0816 * \param SizeInBits Size. 0817 * \param AlignInBits Alignment. 0818 * \param Flags Flags. 0819 */ 0820 LLVMMetadataRef 0821 LLVMDIBuilderCreateMemberPointerType(LLVMDIBuilderRef Builder, 0822 LLVMMetadataRef PointeeType, 0823 LLVMMetadataRef ClassType, 0824 uint64_t SizeInBits, 0825 uint32_t AlignInBits, 0826 LLVMDIFlags Flags); 0827 /** 0828 * Create debugging information entry for Objective-C instance variable. 0829 * \param Builder The DIBuilder. 0830 * \param Name Member name. 0831 * \param NameLen The length of the C string passed to \c Name. 0832 * \param File File where this member is defined. 0833 * \param LineNo Line number. 0834 * \param SizeInBits Member size. 0835 * \param AlignInBits Member alignment. 0836 * \param OffsetInBits Member offset. 0837 * \param Flags Flags to encode member attribute, e.g. private 0838 * \param Ty Parent type. 0839 * \param PropertyNode Property associated with this ivar. 0840 */ 0841 LLVMMetadataRef 0842 LLVMDIBuilderCreateObjCIVar(LLVMDIBuilderRef Builder, 0843 const char *Name, size_t NameLen, 0844 LLVMMetadataRef File, unsigned LineNo, 0845 uint64_t SizeInBits, uint32_t AlignInBits, 0846 uint64_t OffsetInBits, LLVMDIFlags Flags, 0847 LLVMMetadataRef Ty, LLVMMetadataRef PropertyNode); 0848 0849 /** 0850 * Create debugging information entry for Objective-C property. 0851 * \param Builder The DIBuilder. 0852 * \param Name Property name. 0853 * \param NameLen The length of the C string passed to \c Name. 0854 * \param File File where this property is defined. 0855 * \param LineNo Line number. 0856 * \param GetterName Name of the Objective C property getter selector. 0857 * \param GetterNameLen The length of the C string passed to \c GetterName. 0858 * \param SetterName Name of the Objective C property setter selector. 0859 * \param SetterNameLen The length of the C string passed to \c SetterName. 0860 * \param PropertyAttributes Objective C property attributes. 0861 * \param Ty Type. 0862 */ 0863 LLVMMetadataRef 0864 LLVMDIBuilderCreateObjCProperty(LLVMDIBuilderRef Builder, 0865 const char *Name, size_t NameLen, 0866 LLVMMetadataRef File, unsigned LineNo, 0867 const char *GetterName, size_t GetterNameLen, 0868 const char *SetterName, size_t SetterNameLen, 0869 unsigned PropertyAttributes, 0870 LLVMMetadataRef Ty); 0871 0872 /** 0873 * Create a uniqued DIType* clone with FlagObjectPointer. If \c Implicit 0874 * is true, then also set FlagArtificial. 0875 * \param Builder The DIBuilder. 0876 * \param Type The underlying type to which this pointer points. 0877 * \param Implicit Indicates whether this pointer was implicitly generated 0878 * (i.e., not spelled out in source). 0879 */ 0880 LLVMMetadataRef LLVMDIBuilderCreateObjectPointerType(LLVMDIBuilderRef Builder, 0881 LLVMMetadataRef Type, 0882 LLVMBool Implicit); 0883 0884 /** 0885 * Create debugging information entry for a qualified 0886 * type, e.g. 'const int'. 0887 * \param Builder The DIBuilder. 0888 * \param Tag Tag identifying type, 0889 * e.g. LLVMDWARFTypeQualifier_volatile_type 0890 * \param Type Base Type. 0891 */ 0892 LLVMMetadataRef 0893 LLVMDIBuilderCreateQualifiedType(LLVMDIBuilderRef Builder, unsigned Tag, 0894 LLVMMetadataRef Type); 0895 0896 /** 0897 * Create debugging information entry for a c++ 0898 * style reference or rvalue reference type. 0899 * \param Builder The DIBuilder. 0900 * \param Tag Tag identifying type, 0901 * \param Type Base Type. 0902 */ 0903 LLVMMetadataRef 0904 LLVMDIBuilderCreateReferenceType(LLVMDIBuilderRef Builder, unsigned Tag, 0905 LLVMMetadataRef Type); 0906 0907 /** 0908 * Create C++11 nullptr type. 0909 * \param Builder The DIBuilder. 0910 */ 0911 LLVMMetadataRef 0912 LLVMDIBuilderCreateNullPtrType(LLVMDIBuilderRef Builder); 0913 0914 /** 0915 * Create debugging information entry for a typedef. 0916 * \param Builder The DIBuilder. 0917 * \param Type Original type. 0918 * \param Name Typedef name. 0919 * \param File File where this type is defined. 0920 * \param LineNo Line number. 0921 * \param Scope The surrounding context for the typedef. 0922 */ 0923 LLVMMetadataRef 0924 LLVMDIBuilderCreateTypedef(LLVMDIBuilderRef Builder, LLVMMetadataRef Type, 0925 const char *Name, size_t NameLen, 0926 LLVMMetadataRef File, unsigned LineNo, 0927 LLVMMetadataRef Scope, uint32_t AlignInBits); 0928 0929 /** 0930 * Create debugging information entry to establish inheritance relationship 0931 * between two types. 0932 * \param Builder The DIBuilder. 0933 * \param Ty Original type. 0934 * \param BaseTy Base type. Ty is inherits from base. 0935 * \param BaseOffset Base offset. 0936 * \param VBPtrOffset Virtual base pointer offset. 0937 * \param Flags Flags to describe inheritance attribute, e.g. private 0938 */ 0939 LLVMMetadataRef 0940 LLVMDIBuilderCreateInheritance(LLVMDIBuilderRef Builder, 0941 LLVMMetadataRef Ty, LLVMMetadataRef BaseTy, 0942 uint64_t BaseOffset, uint32_t VBPtrOffset, 0943 LLVMDIFlags Flags); 0944 0945 /** 0946 * Create a permanent forward-declared type. 0947 * \param Builder The DIBuilder. 0948 * \param Tag A unique tag for this type. 0949 * \param Name Type name. 0950 * \param NameLen Length of type name. 0951 * \param Scope Type scope. 0952 * \param File File where this type is defined. 0953 * \param Line Line number where this type is defined. 0954 * \param RuntimeLang Indicates runtime version for languages like 0955 * Objective-C. 0956 * \param SizeInBits Member size. 0957 * \param AlignInBits Member alignment. 0958 * \param UniqueIdentifier A unique identifier for the type. 0959 * \param UniqueIdentifierLen Length of the unique identifier. 0960 */ 0961 LLVMMetadataRef LLVMDIBuilderCreateForwardDecl( 0962 LLVMDIBuilderRef Builder, unsigned Tag, const char *Name, 0963 size_t NameLen, LLVMMetadataRef Scope, LLVMMetadataRef File, unsigned Line, 0964 unsigned RuntimeLang, uint64_t SizeInBits, uint32_t AlignInBits, 0965 const char *UniqueIdentifier, size_t UniqueIdentifierLen); 0966 0967 /** 0968 * Create a temporary forward-declared type. 0969 * \param Builder The DIBuilder. 0970 * \param Tag A unique tag for this type. 0971 * \param Name Type name. 0972 * \param NameLen Length of type name. 0973 * \param Scope Type scope. 0974 * \param File File where this type is defined. 0975 * \param Line Line number where this type is defined. 0976 * \param RuntimeLang Indicates runtime version for languages like 0977 * Objective-C. 0978 * \param SizeInBits Member size. 0979 * \param AlignInBits Member alignment. 0980 * \param Flags Flags. 0981 * \param UniqueIdentifier A unique identifier for the type. 0982 * \param UniqueIdentifierLen Length of the unique identifier. 0983 */ 0984 LLVMMetadataRef 0985 LLVMDIBuilderCreateReplaceableCompositeType( 0986 LLVMDIBuilderRef Builder, unsigned Tag, const char *Name, 0987 size_t NameLen, LLVMMetadataRef Scope, LLVMMetadataRef File, unsigned Line, 0988 unsigned RuntimeLang, uint64_t SizeInBits, uint32_t AlignInBits, 0989 LLVMDIFlags Flags, const char *UniqueIdentifier, 0990 size_t UniqueIdentifierLen); 0991 0992 /** 0993 * Create debugging information entry for a bit field member. 0994 * \param Builder The DIBuilder. 0995 * \param Scope Member scope. 0996 * \param Name Member name. 0997 * \param NameLen Length of member name. 0998 * \param File File where this member is defined. 0999 * \param LineNumber Line number. 1000 * \param SizeInBits Member size. 1001 * \param OffsetInBits Member offset. 1002 * \param StorageOffsetInBits Member storage offset. 1003 * \param Flags Flags to encode member attribute. 1004 * \param Type Parent type. 1005 */ 1006 LLVMMetadataRef 1007 LLVMDIBuilderCreateBitFieldMemberType(LLVMDIBuilderRef Builder, 1008 LLVMMetadataRef Scope, 1009 const char *Name, size_t NameLen, 1010 LLVMMetadataRef File, unsigned LineNumber, 1011 uint64_t SizeInBits, 1012 uint64_t OffsetInBits, 1013 uint64_t StorageOffsetInBits, 1014 LLVMDIFlags Flags, LLVMMetadataRef Type); 1015 1016 /** 1017 * Create debugging information entry for a class. 1018 * \param Scope Scope in which this class is defined. 1019 * \param Name Class name. 1020 * \param NameLen The length of the C string passed to \c Name. 1021 * \param File File where this member is defined. 1022 * \param LineNumber Line number. 1023 * \param SizeInBits Member size. 1024 * \param AlignInBits Member alignment. 1025 * \param OffsetInBits Member offset. 1026 * \param Flags Flags to encode member attribute, e.g. private. 1027 * \param DerivedFrom Debug info of the base class of this type. 1028 * \param Elements Class members. 1029 * \param NumElements Number of class elements. 1030 * \param VTableHolder Debug info of the base class that contains vtable 1031 * for this type. This is used in 1032 * DW_AT_containing_type. See DWARF documentation 1033 * for more info. 1034 * \param TemplateParamsNode Template type parameters. 1035 * \param UniqueIdentifier A unique identifier for the type. 1036 * \param UniqueIdentifierLen Length of the unique identifier. 1037 */ 1038 LLVMMetadataRef LLVMDIBuilderCreateClassType(LLVMDIBuilderRef Builder, 1039 LLVMMetadataRef Scope, const char *Name, size_t NameLen, 1040 LLVMMetadataRef File, unsigned LineNumber, uint64_t SizeInBits, 1041 uint32_t AlignInBits, uint64_t OffsetInBits, LLVMDIFlags Flags, 1042 LLVMMetadataRef DerivedFrom, 1043 LLVMMetadataRef *Elements, unsigned NumElements, 1044 LLVMMetadataRef VTableHolder, LLVMMetadataRef TemplateParamsNode, 1045 const char *UniqueIdentifier, size_t UniqueIdentifierLen); 1046 1047 /** 1048 * Create a uniqued DIType* clone with FlagArtificial set. 1049 * \param Builder The DIBuilder. 1050 * \param Type The underlying type. 1051 */ 1052 LLVMMetadataRef 1053 LLVMDIBuilderCreateArtificialType(LLVMDIBuilderRef Builder, 1054 LLVMMetadataRef Type); 1055 1056 /** 1057 * Get the name of this DIType. 1058 * \param DType The DIType. 1059 * \param Length The length of the returned string. 1060 * 1061 * @see DIType::getName() 1062 */ 1063 const char *LLVMDITypeGetName(LLVMMetadataRef DType, size_t *Length); 1064 1065 /** 1066 * Get the size of this DIType in bits. 1067 * \param DType The DIType. 1068 * 1069 * @see DIType::getSizeInBits() 1070 */ 1071 uint64_t LLVMDITypeGetSizeInBits(LLVMMetadataRef DType); 1072 1073 /** 1074 * Get the offset of this DIType in bits. 1075 * \param DType The DIType. 1076 * 1077 * @see DIType::getOffsetInBits() 1078 */ 1079 uint64_t LLVMDITypeGetOffsetInBits(LLVMMetadataRef DType); 1080 1081 /** 1082 * Get the alignment of this DIType in bits. 1083 * \param DType The DIType. 1084 * 1085 * @see DIType::getAlignInBits() 1086 */ 1087 uint32_t LLVMDITypeGetAlignInBits(LLVMMetadataRef DType); 1088 1089 /** 1090 * Get the source line where this DIType is declared. 1091 * \param DType The DIType. 1092 * 1093 * @see DIType::getLine() 1094 */ 1095 unsigned LLVMDITypeGetLine(LLVMMetadataRef DType); 1096 1097 /** 1098 * Get the flags associated with this DIType. 1099 * \param DType The DIType. 1100 * 1101 * @see DIType::getFlags() 1102 */ 1103 LLVMDIFlags LLVMDITypeGetFlags(LLVMMetadataRef DType); 1104 1105 /** 1106 * Create a descriptor for a value range. 1107 * \param Builder The DIBuilder. 1108 * \param LowerBound Lower bound of the subrange, e.g. 0 for C, 1 for Fortran. 1109 * \param Count Count of elements in the subrange. 1110 */ 1111 LLVMMetadataRef LLVMDIBuilderGetOrCreateSubrange(LLVMDIBuilderRef Builder, 1112 int64_t LowerBound, 1113 int64_t Count); 1114 1115 /** 1116 * Create an array of DI Nodes. 1117 * \param Builder The DIBuilder. 1118 * \param Data The DI Node elements. 1119 * \param NumElements Number of DI Node elements. 1120 */ 1121 LLVMMetadataRef LLVMDIBuilderGetOrCreateArray(LLVMDIBuilderRef Builder, 1122 LLVMMetadataRef *Data, 1123 size_t NumElements); 1124 1125 /** 1126 * Create a new descriptor for the specified variable which has a complex 1127 * address expression for its address. 1128 * \param Builder The DIBuilder. 1129 * \param Addr An array of complex address operations. 1130 * \param Length Length of the address operation array. 1131 */ 1132 LLVMMetadataRef LLVMDIBuilderCreateExpression(LLVMDIBuilderRef Builder, 1133 uint64_t *Addr, size_t Length); 1134 1135 /** 1136 * Create a new descriptor for the specified variable that does not have an 1137 * address, but does have a constant value. 1138 * \param Builder The DIBuilder. 1139 * \param Value The constant value. 1140 */ 1141 LLVMMetadataRef 1142 LLVMDIBuilderCreateConstantValueExpression(LLVMDIBuilderRef Builder, 1143 uint64_t Value); 1144 1145 /** 1146 * Create a new descriptor for the specified variable. 1147 * \param Scope Variable scope. 1148 * \param Name Name of the variable. 1149 * \param NameLen The length of the C string passed to \c Name. 1150 * \param Linkage Mangled name of the variable. 1151 * \param LinkLen The length of the C string passed to \c Linkage. 1152 * \param File File where this variable is defined. 1153 * \param LineNo Line number. 1154 * \param Ty Variable Type. 1155 * \param LocalToUnit Boolean flag indicate whether this variable is 1156 * externally visible or not. 1157 * \param Expr The location of the global relative to the attached 1158 * GlobalVariable. 1159 * \param Decl Reference to the corresponding declaration. 1160 * variables. 1161 * \param AlignInBits Variable alignment(or 0 if no alignment attr was 1162 * specified) 1163 */ 1164 LLVMMetadataRef LLVMDIBuilderCreateGlobalVariableExpression( 1165 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, 1166 size_t NameLen, const char *Linkage, size_t LinkLen, LLVMMetadataRef File, 1167 unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit, 1168 LLVMMetadataRef Expr, LLVMMetadataRef Decl, uint32_t AlignInBits); 1169 1170 1171 /** 1172 * Get the dwarf::Tag of a DINode 1173 */ 1174 uint16_t LLVMGetDINodeTag(LLVMMetadataRef MD); 1175 1176 /** 1177 * Retrieves the \c DIVariable associated with this global variable expression. 1178 * \param GVE The global variable expression. 1179 * 1180 * @see llvm::DIGlobalVariableExpression::getVariable() 1181 */ 1182 LLVMMetadataRef LLVMDIGlobalVariableExpressionGetVariable(LLVMMetadataRef GVE); 1183 1184 /** 1185 * Retrieves the \c DIExpression associated with this global variable expression. 1186 * \param GVE The global variable expression. 1187 * 1188 * @see llvm::DIGlobalVariableExpression::getExpression() 1189 */ 1190 LLVMMetadataRef LLVMDIGlobalVariableExpressionGetExpression( 1191 LLVMMetadataRef GVE); 1192 1193 /** 1194 * Get the metadata of the file associated with a given variable. 1195 * \param Var The variable object. 1196 * 1197 * @see DIVariable::getFile() 1198 */ 1199 LLVMMetadataRef LLVMDIVariableGetFile(LLVMMetadataRef Var); 1200 1201 /** 1202 * Get the metadata of the scope associated with a given variable. 1203 * \param Var The variable object. 1204 * 1205 * @see DIVariable::getScope() 1206 */ 1207 LLVMMetadataRef LLVMDIVariableGetScope(LLVMMetadataRef Var); 1208 1209 /** 1210 * Get the source line where this \c DIVariable is declared. 1211 * \param Var The DIVariable. 1212 * 1213 * @see DIVariable::getLine() 1214 */ 1215 unsigned LLVMDIVariableGetLine(LLVMMetadataRef Var); 1216 1217 /** 1218 * Create a new temporary \c MDNode. Suitable for use in constructing cyclic 1219 * \c MDNode structures. A temporary \c MDNode is not uniqued, may be RAUW'd, 1220 * and must be manually deleted with \c LLVMDisposeTemporaryMDNode. 1221 * \param Ctx The context in which to construct the temporary node. 1222 * \param Data The metadata elements. 1223 * \param NumElements Number of metadata elements. 1224 */ 1225 LLVMMetadataRef LLVMTemporaryMDNode(LLVMContextRef Ctx, LLVMMetadataRef *Data, 1226 size_t NumElements); 1227 1228 /** 1229 * Deallocate a temporary node. 1230 * 1231 * Calls \c replaceAllUsesWith(nullptr) before deleting, so any remaining 1232 * references will be reset. 1233 * \param TempNode The temporary metadata node. 1234 */ 1235 void LLVMDisposeTemporaryMDNode(LLVMMetadataRef TempNode); 1236 1237 /** 1238 * Replace all uses of temporary metadata. 1239 * \param TempTargetMetadata The temporary metadata node. 1240 * \param Replacement The replacement metadata node. 1241 */ 1242 void LLVMMetadataReplaceAllUsesWith(LLVMMetadataRef TempTargetMetadata, 1243 LLVMMetadataRef Replacement); 1244 1245 /** 1246 * Create a new descriptor for the specified global variable that is temporary 1247 * and meant to be RAUWed. 1248 * \param Scope Variable scope. 1249 * \param Name Name of the variable. 1250 * \param NameLen The length of the C string passed to \c Name. 1251 * \param Linkage Mangled name of the variable. 1252 * \param LnkLen The length of the C string passed to \c Linkage. 1253 * \param File File where this variable is defined. 1254 * \param LineNo Line number. 1255 * \param Ty Variable Type. 1256 * \param LocalToUnit Boolean flag indicate whether this variable is 1257 * externally visible or not. 1258 * \param Decl Reference to the corresponding declaration. 1259 * \param AlignInBits Variable alignment(or 0 if no alignment attr was 1260 * specified) 1261 */ 1262 LLVMMetadataRef LLVMDIBuilderCreateTempGlobalVariableFwdDecl( 1263 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, 1264 size_t NameLen, const char *Linkage, size_t LnkLen, LLVMMetadataRef File, 1265 unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit, 1266 LLVMMetadataRef Decl, uint32_t AlignInBits); 1267 1268 /** 1269 * Only use in "new debug format" (LLVMIsNewDbgInfoFormat() is true). 1270 * See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes 1271 * 1272 * The debug format can be switched later after inserting the records using 1273 * LLVMSetIsNewDbgInfoFormat, if needed for legacy or transitionary reasons. 1274 * 1275 * Insert a Declare DbgRecord before the given instruction. 1276 * \param Builder The DIBuilder. 1277 * \param Storage The storage of the variable to declare. 1278 * \param VarInfo The variable's debug info descriptor. 1279 * \param Expr A complex location expression for the variable. 1280 * \param DebugLoc Debug info location. 1281 * \param Instr Instruction acting as a location for the new record. 1282 */ 1283 LLVMDbgRecordRef LLVMDIBuilderInsertDeclareRecordBefore( 1284 LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo, 1285 LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr); 1286 1287 /** 1288 * Only use in "new debug format" (LLVMIsNewDbgInfoFormat() is true). 1289 * See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes 1290 * 1291 * The debug format can be switched later after inserting the records using 1292 * LLVMSetIsNewDbgInfoFormat, if needed for legacy or transitionary reasons. 1293 * 1294 * Insert a Declare DbgRecord at the end of the given basic block. If the basic 1295 * block has a terminator instruction, the record is inserted before that 1296 * terminator instruction. 1297 * \param Builder The DIBuilder. 1298 * \param Storage The storage of the variable to declare. 1299 * \param VarInfo The variable's debug info descriptor. 1300 * \param Expr A complex location expression for the variable. 1301 * \param DebugLoc Debug info location. 1302 * \param Block Basic block acting as a location for the new record. 1303 */ 1304 LLVMDbgRecordRef LLVMDIBuilderInsertDeclareRecordAtEnd( 1305 LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo, 1306 LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block); 1307 1308 /** 1309 * Only use in "new debug format" (LLVMIsNewDbgInfoFormat() is true). 1310 * See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes 1311 * 1312 * The debug format can be switched later after inserting the records using 1313 * LLVMSetIsNewDbgInfoFormat, if needed for legacy or transitionary reasons. 1314 * 1315 * Insert a new debug record before the given instruction. 1316 * \param Builder The DIBuilder. 1317 * \param Val The value of the variable. 1318 * \param VarInfo The variable's debug info descriptor. 1319 * \param Expr A complex location expression for the variable. 1320 * \param DebugLoc Debug info location. 1321 * \param Instr Instruction acting as a location for the new record. 1322 */ 1323 LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueRecordBefore( 1324 LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo, 1325 LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr); 1326 1327 /** 1328 * Only use in "new debug format" (LLVMIsNewDbgInfoFormat() is true). 1329 * See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes 1330 * 1331 * The debug format can be switched later after inserting the records using 1332 * LLVMSetIsNewDbgInfoFormat, if needed for legacy or transitionary reasons. 1333 * 1334 * Insert a new debug record at the end of the given basic block. If the 1335 * basic block has a terminator instruction, the record is inserted before 1336 * that terminator instruction. 1337 * \param Builder The DIBuilder. 1338 * \param Val The value of the variable. 1339 * \param VarInfo The variable's debug info descriptor. 1340 * \param Expr A complex location expression for the variable. 1341 * \param DebugLoc Debug info location. 1342 * \param Block Basic block acting as a location for the new record. 1343 */ 1344 LLVMDbgRecordRef LLVMDIBuilderInsertDbgValueRecordAtEnd( 1345 LLVMDIBuilderRef Builder, LLVMValueRef Val, LLVMMetadataRef VarInfo, 1346 LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block); 1347 1348 /** 1349 * Create a new descriptor for a local auto variable. 1350 * \param Builder The DIBuilder. 1351 * \param Scope The local scope the variable is declared in. 1352 * \param Name Variable name. 1353 * \param NameLen Length of variable name. 1354 * \param File File where this variable is defined. 1355 * \param LineNo Line number. 1356 * \param Ty Metadata describing the type of the variable. 1357 * \param AlwaysPreserve If true, this descriptor will survive optimizations. 1358 * \param Flags Flags. 1359 * \param AlignInBits Variable alignment. 1360 */ 1361 LLVMMetadataRef LLVMDIBuilderCreateAutoVariable( 1362 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, 1363 size_t NameLen, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty, 1364 LLVMBool AlwaysPreserve, LLVMDIFlags Flags, uint32_t AlignInBits); 1365 1366 /** 1367 * Create a new descriptor for a function parameter variable. 1368 * \param Builder The DIBuilder. 1369 * \param Scope The local scope the variable is declared in. 1370 * \param Name Variable name. 1371 * \param NameLen Length of variable name. 1372 * \param ArgNo Unique argument number for this variable; starts at 1. 1373 * \param File File where this variable is defined. 1374 * \param LineNo Line number. 1375 * \param Ty Metadata describing the type of the variable. 1376 * \param AlwaysPreserve If true, this descriptor will survive optimizations. 1377 * \param Flags Flags. 1378 */ 1379 LLVMMetadataRef LLVMDIBuilderCreateParameterVariable( 1380 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, 1381 size_t NameLen, unsigned ArgNo, LLVMMetadataRef File, unsigned LineNo, 1382 LLVMMetadataRef Ty, LLVMBool AlwaysPreserve, LLVMDIFlags Flags); 1383 1384 /** 1385 * Get the metadata of the subprogram attached to a function. 1386 * 1387 * @see llvm::Function::getSubprogram() 1388 */ 1389 LLVMMetadataRef LLVMGetSubprogram(LLVMValueRef Func); 1390 1391 /** 1392 * Set the subprogram attached to a function. 1393 * 1394 * @see llvm::Function::setSubprogram() 1395 */ 1396 void LLVMSetSubprogram(LLVMValueRef Func, LLVMMetadataRef SP); 1397 1398 /** 1399 * Get the line associated with a given subprogram. 1400 * \param Subprogram The subprogram object. 1401 * 1402 * @see DISubprogram::getLine() 1403 */ 1404 unsigned LLVMDISubprogramGetLine(LLVMMetadataRef Subprogram); 1405 1406 /** 1407 * Get the debug location for the given instruction. 1408 * 1409 * @see llvm::Instruction::getDebugLoc() 1410 */ 1411 LLVMMetadataRef LLVMInstructionGetDebugLoc(LLVMValueRef Inst); 1412 1413 /** 1414 * Set the debug location for the given instruction. 1415 * 1416 * To clear the location metadata of the given instruction, pass NULL to \p Loc. 1417 * 1418 * @see llvm::Instruction::setDebugLoc() 1419 */ 1420 void LLVMInstructionSetDebugLoc(LLVMValueRef Inst, LLVMMetadataRef Loc); 1421 1422 /** 1423 * Create a new descriptor for a label 1424 * 1425 * \param Builder The DIBuilder. 1426 * \param Scope The scope to create the label in. 1427 * \param Name Variable name. 1428 * \param NameLen Length of variable name. 1429 * \param File The file to create the label in. 1430 * \param LineNo Line Number. 1431 * \param AlwaysPreserve Preserve the label regardless of optimization. 1432 * 1433 * @see llvm::DIBuilder::createLabel() 1434 */ 1435 LLVMMetadataRef LLVMDIBuilderCreateLabel( 1436 LLVMDIBuilderRef Builder, 1437 LLVMMetadataRef Context, const char *Name, size_t NameLen, 1438 LLVMMetadataRef File, unsigned LineNo, LLVMBool AlwaysPreserve); 1439 1440 /** 1441 * Insert a new llvm.dbg.label intrinsic call 1442 * 1443 * \param Builder The DIBuilder. 1444 * \param LabelInfo The Label's debug info descriptor 1445 * \param Location The debug info location 1446 * \param InsertBefore Location for the new intrinsic. 1447 * 1448 * @see llvm::DIBuilder::insertLabel() 1449 */ 1450 LLVMDbgRecordRef LLVMDIBuilderInsertLabelBefore( 1451 LLVMDIBuilderRef Builder, LLVMMetadataRef LabelInfo, 1452 LLVMMetadataRef Location, LLVMValueRef InsertBefore); 1453 1454 /** 1455 * Insert a new llvm.dbg.label intrinsic call 1456 * 1457 * \param Builder The DIBuilder. 1458 * \param LabelInfo The Label's debug info descriptor 1459 * \param Location The debug info location 1460 * \param InsertAtEnd Location for the new intrinsic. 1461 * 1462 * @see llvm::DIBuilder::insertLabel() 1463 */ 1464 LLVMDbgRecordRef LLVMDIBuilderInsertLabelAtEnd( 1465 LLVMDIBuilderRef Builder, LLVMMetadataRef LabelInfo, 1466 LLVMMetadataRef Location, LLVMBasicBlockRef InsertAtEnd); 1467 1468 /** 1469 * Obtain the enumerated type of a Metadata instance. 1470 * 1471 * @see llvm::Metadata::getMetadataID() 1472 */ 1473 LLVMMetadataKind LLVMGetMetadataKind(LLVMMetadataRef Metadata); 1474 1475 /** 1476 * @} 1477 */ 1478 1479 LLVM_C_EXTERN_C_END 1480 1481 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|