Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1 | //===------------ DebugInfo.h - LLVM C API Debug Info API -----------------===// |
| 2 | // |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame] | 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | /// |
| 9 | /// This file declares the C API endpoints for generating DWARF Debug Info |
| 10 | /// |
| 11 | /// Note: This interface is experimental. It is *NOT* stable, and may be |
| 12 | /// changed without warning. |
| 13 | /// |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
| 16 | #ifndef LLVM_C_DEBUGINFO_H |
| 17 | #define LLVM_C_DEBUGINFO_H |
| 18 | |
| 19 | #include "llvm-c/Core.h" |
| 20 | |
| 21 | #ifdef __cplusplus |
| 22 | extern "C" { |
| 23 | #endif |
| 24 | |
| 25 | /** |
| 26 | * Debug info flags. |
| 27 | */ |
| 28 | typedef enum { |
| 29 | LLVMDIFlagZero = 0, |
| 30 | LLVMDIFlagPrivate = 1, |
| 31 | LLVMDIFlagProtected = 2, |
| 32 | LLVMDIFlagPublic = 3, |
| 33 | LLVMDIFlagFwdDecl = 1 << 2, |
| 34 | LLVMDIFlagAppleBlock = 1 << 3, |
| 35 | LLVMDIFlagBlockByrefStruct = 1 << 4, |
| 36 | LLVMDIFlagVirtual = 1 << 5, |
| 37 | LLVMDIFlagArtificial = 1 << 6, |
| 38 | LLVMDIFlagExplicit = 1 << 7, |
| 39 | LLVMDIFlagPrototyped = 1 << 8, |
| 40 | LLVMDIFlagObjcClassComplete = 1 << 9, |
| 41 | LLVMDIFlagObjectPointer = 1 << 10, |
| 42 | LLVMDIFlagVector = 1 << 11, |
| 43 | LLVMDIFlagStaticMember = 1 << 12, |
| 44 | LLVMDIFlagLValueReference = 1 << 13, |
| 45 | LLVMDIFlagRValueReference = 1 << 14, |
| 46 | LLVMDIFlagReserved = 1 << 15, |
| 47 | LLVMDIFlagSingleInheritance = 1 << 16, |
| 48 | LLVMDIFlagMultipleInheritance = 2 << 16, |
| 49 | LLVMDIFlagVirtualInheritance = 3 << 16, |
| 50 | LLVMDIFlagIntroducedVirtual = 1 << 18, |
| 51 | LLVMDIFlagBitField = 1 << 19, |
| 52 | LLVMDIFlagNoReturn = 1 << 20, |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 53 | LLVMDIFlagTypePassByValue = 1 << 22, |
| 54 | LLVMDIFlagTypePassByReference = 1 << 23, |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame] | 55 | LLVMDIFlagEnumClass = 1 << 24, |
| 56 | LLVMDIFlagFixedEnum = LLVMDIFlagEnumClass, // Deprecated. |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 57 | LLVMDIFlagThunk = 1 << 25, |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame^] | 58 | LLVMDIFlagNonTrivial = 1 << 26, |
Andrew Scull | 0372a57 | 2018-11-16 15:47:06 +0000 | [diff] [blame] | 59 | LLVMDIFlagBigEndian = 1 << 27, |
| 60 | LLVMDIFlagLittleEndian = 1 << 28, |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 61 | LLVMDIFlagIndirectVirtualBase = (1 << 2) | (1 << 5), |
| 62 | LLVMDIFlagAccessibility = LLVMDIFlagPrivate | LLVMDIFlagProtected | |
| 63 | LLVMDIFlagPublic, |
| 64 | LLVMDIFlagPtrToMemberRep = LLVMDIFlagSingleInheritance | |
| 65 | LLVMDIFlagMultipleInheritance | |
| 66 | LLVMDIFlagVirtualInheritance |
| 67 | } LLVMDIFlags; |
| 68 | |
| 69 | /** |
| 70 | * Source languages known by DWARF. |
| 71 | */ |
| 72 | typedef enum { |
| 73 | LLVMDWARFSourceLanguageC89, |
| 74 | LLVMDWARFSourceLanguageC, |
| 75 | LLVMDWARFSourceLanguageAda83, |
| 76 | LLVMDWARFSourceLanguageC_plus_plus, |
| 77 | LLVMDWARFSourceLanguageCobol74, |
| 78 | LLVMDWARFSourceLanguageCobol85, |
| 79 | LLVMDWARFSourceLanguageFortran77, |
| 80 | LLVMDWARFSourceLanguageFortran90, |
| 81 | LLVMDWARFSourceLanguagePascal83, |
| 82 | LLVMDWARFSourceLanguageModula2, |
| 83 | // New in DWARF v3: |
| 84 | LLVMDWARFSourceLanguageJava, |
| 85 | LLVMDWARFSourceLanguageC99, |
| 86 | LLVMDWARFSourceLanguageAda95, |
| 87 | LLVMDWARFSourceLanguageFortran95, |
| 88 | LLVMDWARFSourceLanguagePLI, |
| 89 | LLVMDWARFSourceLanguageObjC, |
| 90 | LLVMDWARFSourceLanguageObjC_plus_plus, |
| 91 | LLVMDWARFSourceLanguageUPC, |
| 92 | LLVMDWARFSourceLanguageD, |
| 93 | // New in DWARF v4: |
| 94 | LLVMDWARFSourceLanguagePython, |
| 95 | // New in DWARF v5: |
| 96 | LLVMDWARFSourceLanguageOpenCL, |
| 97 | LLVMDWARFSourceLanguageGo, |
| 98 | LLVMDWARFSourceLanguageModula3, |
| 99 | LLVMDWARFSourceLanguageHaskell, |
| 100 | LLVMDWARFSourceLanguageC_plus_plus_03, |
| 101 | LLVMDWARFSourceLanguageC_plus_plus_11, |
| 102 | LLVMDWARFSourceLanguageOCaml, |
| 103 | LLVMDWARFSourceLanguageRust, |
| 104 | LLVMDWARFSourceLanguageC11, |
| 105 | LLVMDWARFSourceLanguageSwift, |
| 106 | LLVMDWARFSourceLanguageJulia, |
| 107 | LLVMDWARFSourceLanguageDylan, |
| 108 | LLVMDWARFSourceLanguageC_plus_plus_14, |
| 109 | LLVMDWARFSourceLanguageFortran03, |
| 110 | LLVMDWARFSourceLanguageFortran08, |
| 111 | LLVMDWARFSourceLanguageRenderScript, |
| 112 | LLVMDWARFSourceLanguageBLISS, |
| 113 | // Vendor extensions: |
| 114 | LLVMDWARFSourceLanguageMips_Assembler, |
| 115 | LLVMDWARFSourceLanguageGOOGLE_RenderScript, |
| 116 | LLVMDWARFSourceLanguageBORLAND_Delphi |
| 117 | } LLVMDWARFSourceLanguage; |
| 118 | |
| 119 | /** |
| 120 | * The amount of debug information to emit. |
| 121 | */ |
| 122 | typedef enum { |
| 123 | LLVMDWARFEmissionNone = 0, |
| 124 | LLVMDWARFEmissionFull, |
| 125 | LLVMDWARFEmissionLineTablesOnly |
| 126 | } LLVMDWARFEmissionKind; |
| 127 | |
| 128 | /** |
Andrew Scull | 0372a57 | 2018-11-16 15:47:06 +0000 | [diff] [blame] | 129 | * The kind of metadata nodes. |
| 130 | */ |
| 131 | enum { |
| 132 | LLVMMDStringMetadataKind, |
| 133 | LLVMConstantAsMetadataMetadataKind, |
| 134 | LLVMLocalAsMetadataMetadataKind, |
| 135 | LLVMDistinctMDOperandPlaceholderMetadataKind, |
| 136 | LLVMMDTupleMetadataKind, |
| 137 | LLVMDILocationMetadataKind, |
| 138 | LLVMDIExpressionMetadataKind, |
| 139 | LLVMDIGlobalVariableExpressionMetadataKind, |
| 140 | LLVMGenericDINodeMetadataKind, |
| 141 | LLVMDISubrangeMetadataKind, |
| 142 | LLVMDIEnumeratorMetadataKind, |
| 143 | LLVMDIBasicTypeMetadataKind, |
| 144 | LLVMDIDerivedTypeMetadataKind, |
| 145 | LLVMDICompositeTypeMetadataKind, |
| 146 | LLVMDISubroutineTypeMetadataKind, |
| 147 | LLVMDIFileMetadataKind, |
| 148 | LLVMDICompileUnitMetadataKind, |
| 149 | LLVMDISubprogramMetadataKind, |
| 150 | LLVMDILexicalBlockMetadataKind, |
| 151 | LLVMDILexicalBlockFileMetadataKind, |
| 152 | LLVMDINamespaceMetadataKind, |
| 153 | LLVMDIModuleMetadataKind, |
| 154 | LLVMDITemplateTypeParameterMetadataKind, |
| 155 | LLVMDITemplateValueParameterMetadataKind, |
| 156 | LLVMDIGlobalVariableMetadataKind, |
| 157 | LLVMDILocalVariableMetadataKind, |
| 158 | LLVMDILabelMetadataKind, |
| 159 | LLVMDIObjCPropertyMetadataKind, |
| 160 | LLVMDIImportedEntityMetadataKind, |
| 161 | LLVMDIMacroMetadataKind, |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame^] | 162 | LLVMDIMacroFileMetadataKind, |
| 163 | LLVMDICommonBlockMetadataKind |
Andrew Scull | 0372a57 | 2018-11-16 15:47:06 +0000 | [diff] [blame] | 164 | }; |
| 165 | typedef unsigned LLVMMetadataKind; |
| 166 | |
| 167 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 168 | * An LLVM DWARF type encoding. |
| 169 | */ |
| 170 | typedef unsigned LLVMDWARFTypeEncoding; |
| 171 | |
| 172 | /** |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 173 | * The current debug metadata version number. |
| 174 | */ |
| 175 | unsigned LLVMDebugMetadataVersion(void); |
| 176 | |
| 177 | /** |
| 178 | * The version of debug metadata that's present in the provided \c Module. |
| 179 | */ |
| 180 | unsigned LLVMGetModuleDebugMetadataVersion(LLVMModuleRef Module); |
| 181 | |
| 182 | /** |
| 183 | * Strip debug info in the module if it exists. |
| 184 | * To do this, we remove all calls to the debugger intrinsics and any named |
| 185 | * metadata for debugging. We also remove debug locations for instructions. |
| 186 | * Return true if module is modified. |
| 187 | */ |
| 188 | LLVMBool LLVMStripModuleDebugInfo(LLVMModuleRef Module); |
| 189 | |
| 190 | /** |
| 191 | * Construct a builder for a module, and do not allow for unresolved nodes |
| 192 | * attached to the module. |
| 193 | */ |
| 194 | LLVMDIBuilderRef LLVMCreateDIBuilderDisallowUnresolved(LLVMModuleRef M); |
| 195 | |
| 196 | /** |
| 197 | * Construct a builder for a module and collect unresolved nodes attached |
| 198 | * to the module in order to resolve cycles during a call to |
| 199 | * \c LLVMDIBuilderFinalize. |
| 200 | */ |
| 201 | LLVMDIBuilderRef LLVMCreateDIBuilder(LLVMModuleRef M); |
| 202 | |
| 203 | /** |
| 204 | * Deallocates the \c DIBuilder and everything it owns. |
| 205 | * @note You must call \c LLVMDIBuilderFinalize before this |
| 206 | */ |
| 207 | void LLVMDisposeDIBuilder(LLVMDIBuilderRef Builder); |
| 208 | |
| 209 | /** |
| 210 | * Construct any deferred debug info descriptors. |
| 211 | */ |
| 212 | void LLVMDIBuilderFinalize(LLVMDIBuilderRef Builder); |
| 213 | |
| 214 | /** |
| 215 | * A CompileUnit provides an anchor for all debugging |
| 216 | * information generated during this instance of compilation. |
| 217 | * \param Lang Source programming language, eg. |
| 218 | * \c LLVMDWARFSourceLanguageC99 |
| 219 | * \param FileRef File info. |
| 220 | * \param Producer Identify the producer of debugging information |
| 221 | * and code. Usually this is a compiler |
| 222 | * version string. |
| 223 | * \param ProducerLen The length of the C string passed to \c Producer. |
| 224 | * \param isOptimized A boolean flag which indicates whether optimization |
| 225 | * is enabled or not. |
| 226 | * \param Flags This string lists command line options. This |
| 227 | * string is directly embedded in debug info |
| 228 | * output which may be used by a tool |
| 229 | * analyzing generated debugging information. |
| 230 | * \param FlagsLen The length of the C string passed to \c Flags. |
| 231 | * \param RuntimeVer This indicates runtime version for languages like |
| 232 | * Objective-C. |
| 233 | * \param SplitName The name of the file that we'll split debug info |
| 234 | * out into. |
| 235 | * \param SplitNameLen The length of the C string passed to \c SplitName. |
| 236 | * \param Kind The kind of debug information to generate. |
| 237 | * \param DWOId The DWOId if this is a split skeleton compile unit. |
| 238 | * \param SplitDebugInlining Whether to emit inline debug info. |
| 239 | * \param DebugInfoForProfiling Whether to emit extra debug info for |
| 240 | * profile collection. |
| 241 | */ |
| 242 | LLVMMetadataRef LLVMDIBuilderCreateCompileUnit( |
| 243 | LLVMDIBuilderRef Builder, LLVMDWARFSourceLanguage Lang, |
| 244 | LLVMMetadataRef FileRef, const char *Producer, size_t ProducerLen, |
| 245 | LLVMBool isOptimized, const char *Flags, size_t FlagsLen, |
| 246 | unsigned RuntimeVer, const char *SplitName, size_t SplitNameLen, |
| 247 | LLVMDWARFEmissionKind Kind, unsigned DWOId, LLVMBool SplitDebugInlining, |
| 248 | LLVMBool DebugInfoForProfiling); |
| 249 | |
| 250 | /** |
| 251 | * Create a file descriptor to hold debugging information for a file. |
| 252 | * \param Builder The \c DIBuilder. |
| 253 | * \param Filename File name. |
| 254 | * \param FilenameLen The length of the C string passed to \c Filename. |
| 255 | * \param Directory Directory. |
| 256 | * \param DirectoryLen The length of the C string passed to \c Directory. |
| 257 | */ |
| 258 | LLVMMetadataRef |
| 259 | LLVMDIBuilderCreateFile(LLVMDIBuilderRef Builder, const char *Filename, |
| 260 | size_t FilenameLen, const char *Directory, |
| 261 | size_t DirectoryLen); |
| 262 | |
| 263 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 264 | * Creates a new descriptor for a module with the specified parent scope. |
| 265 | * \param Builder The \c DIBuilder. |
| 266 | * \param ParentScope The parent scope containing this module declaration. |
| 267 | * \param Name Module name. |
| 268 | * \param NameLen The length of the C string passed to \c Name. |
| 269 | * \param ConfigMacros A space-separated shell-quoted list of -D macro |
| 270 | definitions as they would appear on a command line. |
| 271 | * \param ConfigMacrosLen The length of the C string passed to \c ConfigMacros. |
| 272 | * \param IncludePath The path to the module map file. |
| 273 | * \param IncludePathLen The length of the C string passed to \c IncludePath. |
| 274 | * \param ISysRoot The Clang system root (value of -isysroot). |
| 275 | * \param ISysRootLen The length of the C string passed to \c ISysRoot. |
| 276 | */ |
| 277 | LLVMMetadataRef |
| 278 | LLVMDIBuilderCreateModule(LLVMDIBuilderRef Builder, LLVMMetadataRef ParentScope, |
| 279 | const char *Name, size_t NameLen, |
| 280 | const char *ConfigMacros, size_t ConfigMacrosLen, |
| 281 | const char *IncludePath, size_t IncludePathLen, |
| 282 | const char *ISysRoot, size_t ISysRootLen); |
| 283 | |
| 284 | /** |
| 285 | * Creates a new descriptor for a namespace with the specified parent scope. |
| 286 | * \param Builder The \c DIBuilder. |
| 287 | * \param ParentScope The parent scope containing this module declaration. |
| 288 | * \param Name NameSpace name. |
| 289 | * \param NameLen The length of the C string passed to \c Name. |
| 290 | * \param ExportSymbols Whether or not the namespace exports symbols, e.g. |
| 291 | * this is true of C++ inline namespaces. |
| 292 | */ |
| 293 | LLVMMetadataRef |
| 294 | LLVMDIBuilderCreateNameSpace(LLVMDIBuilderRef Builder, |
| 295 | LLVMMetadataRef ParentScope, |
| 296 | const char *Name, size_t NameLen, |
| 297 | LLVMBool ExportSymbols); |
| 298 | |
| 299 | /** |
| 300 | * Create a new descriptor for the specified subprogram. |
| 301 | * \param Builder The \c DIBuilder. |
| 302 | * \param Scope Function scope. |
| 303 | * \param Name Function name. |
| 304 | * \param NameLen Length of enumeration name. |
| 305 | * \param LinkageName Mangled function name. |
| 306 | * \param LinkageNameLen Length of linkage name. |
| 307 | * \param File File where this variable is defined. |
| 308 | * \param LineNo Line number. |
| 309 | * \param Ty Function type. |
| 310 | * \param IsLocalToUnit True if this function is not externally visible. |
| 311 | * \param IsDefinition True if this is a function definition. |
| 312 | * \param ScopeLine Set to the beginning of the scope this starts |
| 313 | * \param Flags E.g.: \c LLVMDIFlagLValueReference. These flags are |
| 314 | * used to emit dwarf attributes. |
| 315 | * \param IsOptimized True if optimization is ON. |
| 316 | */ |
| 317 | LLVMMetadataRef LLVMDIBuilderCreateFunction( |
| 318 | LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, |
| 319 | size_t NameLen, const char *LinkageName, size_t LinkageNameLen, |
| 320 | LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty, |
| 321 | LLVMBool IsLocalToUnit, LLVMBool IsDefinition, |
| 322 | unsigned ScopeLine, LLVMDIFlags Flags, LLVMBool IsOptimized); |
| 323 | |
| 324 | /** |
| 325 | * Create a descriptor for a lexical block with the specified parent context. |
| 326 | * \param Builder The \c DIBuilder. |
| 327 | * \param Scope Parent lexical block. |
| 328 | * \param File Source file. |
| 329 | * \param Line The line in the source file. |
| 330 | * \param Column The column in the source file. |
| 331 | */ |
| 332 | LLVMMetadataRef LLVMDIBuilderCreateLexicalBlock( |
| 333 | LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, |
| 334 | LLVMMetadataRef File, unsigned Line, unsigned Column); |
| 335 | |
| 336 | /** |
| 337 | * Create a descriptor for a lexical block with a new file attached. |
| 338 | * \param Builder The \c DIBuilder. |
| 339 | * \param Scope Lexical block. |
| 340 | * \param File Source file. |
| 341 | * \param Discriminator DWARF path discriminator value. |
| 342 | */ |
| 343 | LLVMMetadataRef |
| 344 | LLVMDIBuilderCreateLexicalBlockFile(LLVMDIBuilderRef Builder, |
| 345 | LLVMMetadataRef Scope, |
| 346 | LLVMMetadataRef File, |
| 347 | unsigned Discriminator); |
| 348 | |
| 349 | /** |
| 350 | * Create a descriptor for an imported namespace. Suitable for e.g. C++ |
| 351 | * using declarations. |
| 352 | * \param Builder The \c DIBuilder. |
| 353 | * \param Scope The scope this module is imported into |
| 354 | * \param File File where the declaration is located. |
| 355 | * \param Line Line number of the declaration. |
| 356 | */ |
| 357 | LLVMMetadataRef |
| 358 | LLVMDIBuilderCreateImportedModuleFromNamespace(LLVMDIBuilderRef Builder, |
| 359 | LLVMMetadataRef Scope, |
| 360 | LLVMMetadataRef NS, |
| 361 | LLVMMetadataRef File, |
| 362 | unsigned Line); |
| 363 | |
| 364 | /** |
| 365 | * Create a descriptor for an imported module that aliases another |
| 366 | * imported entity descriptor. |
| 367 | * \param Builder The \c DIBuilder. |
| 368 | * \param Scope The scope this module is imported into |
| 369 | * \param ImportedEntity Previous imported entity to alias. |
| 370 | * \param File File where the declaration is located. |
| 371 | * \param Line Line number of the declaration. |
| 372 | */ |
| 373 | LLVMMetadataRef |
| 374 | LLVMDIBuilderCreateImportedModuleFromAlias(LLVMDIBuilderRef Builder, |
| 375 | LLVMMetadataRef Scope, |
| 376 | LLVMMetadataRef ImportedEntity, |
| 377 | LLVMMetadataRef File, |
| 378 | unsigned Line); |
| 379 | |
| 380 | /** |
| 381 | * Create a descriptor for an imported module. |
| 382 | * \param Builder The \c DIBuilder. |
| 383 | * \param Scope The scope this module is imported into |
| 384 | * \param M The module being imported here |
| 385 | * \param File File where the declaration is located. |
| 386 | * \param Line Line number of the declaration. |
| 387 | */ |
| 388 | LLVMMetadataRef |
| 389 | LLVMDIBuilderCreateImportedModuleFromModule(LLVMDIBuilderRef Builder, |
| 390 | LLVMMetadataRef Scope, |
| 391 | LLVMMetadataRef M, |
| 392 | LLVMMetadataRef File, |
| 393 | unsigned Line); |
| 394 | |
| 395 | /** |
| 396 | * Create a descriptor for an imported function, type, or variable. Suitable |
| 397 | * for e.g. FORTRAN-style USE declarations. |
| 398 | * \param Builder The DIBuilder. |
| 399 | * \param Scope The scope this module is imported into. |
| 400 | * \param Decl The declaration (or definition) of a function, type, |
| 401 | or variable. |
| 402 | * \param File File where the declaration is located. |
| 403 | * \param Line Line number of the declaration. |
| 404 | * \param Name A name that uniquely identifies this imported declaration. |
| 405 | * \param NameLen The length of the C string passed to \c Name. |
| 406 | */ |
| 407 | LLVMMetadataRef |
| 408 | LLVMDIBuilderCreateImportedDeclaration(LLVMDIBuilderRef Builder, |
| 409 | LLVMMetadataRef Scope, |
| 410 | LLVMMetadataRef Decl, |
| 411 | LLVMMetadataRef File, |
| 412 | unsigned Line, |
| 413 | const char *Name, size_t NameLen); |
| 414 | |
| 415 | /** |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 416 | * Creates a new DebugLocation that describes a source location. |
| 417 | * \param Line The line in the source file. |
| 418 | * \param Column The column in the source file. |
| 419 | * \param Scope The scope in which the location resides. |
| 420 | * \param InlinedAt The scope where this location was inlined, if at all. |
| 421 | * (optional). |
| 422 | * \note If the item to which this location is attached cannot be |
| 423 | * attributed to a source line, pass 0 for the line and column. |
| 424 | */ |
| 425 | LLVMMetadataRef |
| 426 | LLVMDIBuilderCreateDebugLocation(LLVMContextRef Ctx, unsigned Line, |
| 427 | unsigned Column, LLVMMetadataRef Scope, |
| 428 | LLVMMetadataRef InlinedAt); |
| 429 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 430 | /** |
| 431 | * Get the line number of this debug location. |
| 432 | * \param Location The debug location. |
| 433 | * |
| 434 | * @see DILocation::getLine() |
| 435 | */ |
| 436 | unsigned LLVMDILocationGetLine(LLVMMetadataRef Location); |
| 437 | |
| 438 | /** |
| 439 | * Get the column number of this debug location. |
| 440 | * \param Location The debug location. |
| 441 | * |
| 442 | * @see DILocation::getColumn() |
| 443 | */ |
| 444 | unsigned LLVMDILocationGetColumn(LLVMMetadataRef Location); |
| 445 | |
| 446 | /** |
| 447 | * Get the local scope associated with this debug location. |
| 448 | * \param Location The debug location. |
| 449 | * |
| 450 | * @see DILocation::getScope() |
| 451 | */ |
| 452 | LLVMMetadataRef LLVMDILocationGetScope(LLVMMetadataRef Location); |
| 453 | |
| 454 | /** |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame^] | 455 | * Get the "inline at" location associated with this debug location. |
| 456 | * \param Location The debug location. |
| 457 | * |
| 458 | * @see DILocation::getInlinedAt() |
| 459 | */ |
| 460 | LLVMMetadataRef LLVMDILocationGetInlinedAt(LLVMMetadataRef Location); |
| 461 | |
| 462 | /** |
| 463 | * Get the metadata of the file associated with a given scope. |
| 464 | * \param Scope The scope object. |
| 465 | * |
| 466 | * @see DIScope::getFile() |
| 467 | */ |
| 468 | LLVMMetadataRef LLVMDIScopeGetFile(LLVMMetadataRef Scope); |
| 469 | |
| 470 | /** |
| 471 | * Get the directory of a given file. |
| 472 | * \param File The file object. |
| 473 | * \param Len The length of the returned string. |
| 474 | * |
| 475 | * @see DIFile::getDirectory() |
| 476 | */ |
| 477 | const char *LLVMDIFileGetDirectory(LLVMMetadataRef File, unsigned *Len); |
| 478 | |
| 479 | /** |
| 480 | * Get the name of a given file. |
| 481 | * \param File The file object. |
| 482 | * \param Len The length of the returned string. |
| 483 | * |
| 484 | * @see DIFile::getFilename() |
| 485 | */ |
| 486 | const char *LLVMDIFileGetFilename(LLVMMetadataRef File, unsigned *Len); |
| 487 | |
| 488 | /** |
| 489 | * Get the source of a given file. |
| 490 | * \param File The file object. |
| 491 | * \param Len The length of the returned string. |
| 492 | * |
| 493 | * @see DIFile::getSource() |
| 494 | */ |
| 495 | const char *LLVMDIFileGetSource(LLVMMetadataRef File, unsigned *Len); |
| 496 | |
| 497 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 498 | * Create a type array. |
| 499 | * \param Builder The DIBuilder. |
| 500 | * \param Data The type elements. |
| 501 | * \param NumElements Number of type elements. |
| 502 | */ |
| 503 | LLVMMetadataRef LLVMDIBuilderGetOrCreateTypeArray(LLVMDIBuilderRef Builder, |
| 504 | LLVMMetadataRef *Data, |
| 505 | size_t NumElements); |
| 506 | |
| 507 | /** |
| 508 | * Create subroutine type. |
| 509 | * \param Builder The DIBuilder. |
| 510 | * \param File The file in which the subroutine resides. |
| 511 | * \param ParameterTypes An array of subroutine parameter types. This |
| 512 | * includes return type at 0th index. |
| 513 | * \param NumParameterTypes The number of parameter types in \c ParameterTypes |
| 514 | * \param Flags E.g.: \c LLVMDIFlagLValueReference. |
| 515 | * These flags are used to emit dwarf attributes. |
| 516 | */ |
| 517 | LLVMMetadataRef |
| 518 | LLVMDIBuilderCreateSubroutineType(LLVMDIBuilderRef Builder, |
| 519 | LLVMMetadataRef File, |
| 520 | LLVMMetadataRef *ParameterTypes, |
| 521 | unsigned NumParameterTypes, |
| 522 | LLVMDIFlags Flags); |
| 523 | |
| 524 | /** |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame^] | 525 | * Create debugging information entry for an enumerator. |
| 526 | * @param Builder The DIBuilder. |
| 527 | * @param Name Enumerator name. |
| 528 | * @param NameLen Length of enumerator name. |
| 529 | * @param Value Enumerator value. |
| 530 | * @param IsUnsigned True if the value is unsigned. |
| 531 | */ |
| 532 | LLVMMetadataRef LLVMDIBuilderCreateEnumerator(LLVMDIBuilderRef Builder, |
| 533 | const char *Name, size_t NameLen, |
| 534 | int64_t Value, |
| 535 | LLVMBool IsUnsigned); |
| 536 | |
| 537 | /** |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 538 | * Create debugging information entry for an enumeration. |
| 539 | * \param Builder The DIBuilder. |
| 540 | * \param Scope Scope in which this enumeration is defined. |
| 541 | * \param Name Enumeration name. |
| 542 | * \param NameLen Length of enumeration name. |
| 543 | * \param File File where this member is defined. |
| 544 | * \param LineNumber Line number. |
| 545 | * \param SizeInBits Member size. |
| 546 | * \param AlignInBits Member alignment. |
| 547 | * \param Elements Enumeration elements. |
| 548 | * \param NumElements Number of enumeration elements. |
| 549 | * \param ClassTy Underlying type of a C++11/ObjC fixed enum. |
| 550 | */ |
| 551 | LLVMMetadataRef LLVMDIBuilderCreateEnumerationType( |
| 552 | LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, |
| 553 | size_t NameLen, LLVMMetadataRef File, unsigned LineNumber, |
| 554 | uint64_t SizeInBits, uint32_t AlignInBits, LLVMMetadataRef *Elements, |
| 555 | unsigned NumElements, LLVMMetadataRef ClassTy); |
| 556 | |
| 557 | /** |
| 558 | * Create debugging information entry for a union. |
| 559 | * \param Builder The DIBuilder. |
| 560 | * \param Scope Scope in which this union is defined. |
| 561 | * \param Name Union name. |
| 562 | * \param NameLen Length of union name. |
| 563 | * \param File File where this member is defined. |
| 564 | * \param LineNumber Line number. |
| 565 | * \param SizeInBits Member size. |
| 566 | * \param AlignInBits Member alignment. |
| 567 | * \param Flags Flags to encode member attribute, e.g. private |
| 568 | * \param Elements Union elements. |
| 569 | * \param NumElements Number of union elements. |
| 570 | * \param RunTimeLang Optional parameter, Objective-C runtime version. |
| 571 | * \param UniqueId A unique identifier for the union. |
| 572 | * \param UniqueIdLen Length of unique identifier. |
| 573 | */ |
| 574 | LLVMMetadataRef LLVMDIBuilderCreateUnionType( |
| 575 | LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, |
| 576 | size_t NameLen, LLVMMetadataRef File, unsigned LineNumber, |
| 577 | uint64_t SizeInBits, uint32_t AlignInBits, LLVMDIFlags Flags, |
| 578 | LLVMMetadataRef *Elements, unsigned NumElements, unsigned RunTimeLang, |
| 579 | const char *UniqueId, size_t UniqueIdLen); |
| 580 | |
| 581 | |
| 582 | /** |
| 583 | * Create debugging information entry for an array. |
| 584 | * \param Builder The DIBuilder. |
| 585 | * \param Size Array size. |
| 586 | * \param AlignInBits Alignment. |
| 587 | * \param Ty Element type. |
| 588 | * \param Subscripts Subscripts. |
| 589 | * \param NumSubscripts Number of subscripts. |
| 590 | */ |
| 591 | LLVMMetadataRef |
| 592 | LLVMDIBuilderCreateArrayType(LLVMDIBuilderRef Builder, uint64_t Size, |
| 593 | uint32_t AlignInBits, LLVMMetadataRef Ty, |
| 594 | LLVMMetadataRef *Subscripts, |
| 595 | unsigned NumSubscripts); |
| 596 | |
| 597 | /** |
| 598 | * Create debugging information entry for a vector type. |
| 599 | * \param Builder The DIBuilder. |
| 600 | * \param Size Vector size. |
| 601 | * \param AlignInBits Alignment. |
| 602 | * \param Ty Element type. |
| 603 | * \param Subscripts Subscripts. |
| 604 | * \param NumSubscripts Number of subscripts. |
| 605 | */ |
| 606 | LLVMMetadataRef |
| 607 | LLVMDIBuilderCreateVectorType(LLVMDIBuilderRef Builder, uint64_t Size, |
| 608 | uint32_t AlignInBits, LLVMMetadataRef Ty, |
| 609 | LLVMMetadataRef *Subscripts, |
| 610 | unsigned NumSubscripts); |
| 611 | |
| 612 | /** |
| 613 | * Create a DWARF unspecified type. |
| 614 | * \param Builder The DIBuilder. |
| 615 | * \param Name The unspecified type's name. |
| 616 | * \param NameLen Length of type name. |
| 617 | */ |
| 618 | LLVMMetadataRef |
| 619 | LLVMDIBuilderCreateUnspecifiedType(LLVMDIBuilderRef Builder, const char *Name, |
| 620 | size_t NameLen); |
| 621 | |
| 622 | /** |
| 623 | * Create debugging information entry for a basic |
| 624 | * type. |
| 625 | * \param Builder The DIBuilder. |
| 626 | * \param Name Type name. |
| 627 | * \param NameLen Length of type name. |
| 628 | * \param SizeInBits Size of the type. |
| 629 | * \param Encoding DWARF encoding code, e.g. \c LLVMDWARFTypeEncoding_float. |
Andrew Scull | 0372a57 | 2018-11-16 15:47:06 +0000 | [diff] [blame] | 630 | * \param Flags Flags to encode optional attribute like endianity |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 631 | */ |
| 632 | LLVMMetadataRef |
| 633 | LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef Builder, const char *Name, |
| 634 | size_t NameLen, uint64_t SizeInBits, |
Andrew Scull | 0372a57 | 2018-11-16 15:47:06 +0000 | [diff] [blame] | 635 | LLVMDWARFTypeEncoding Encoding, |
| 636 | LLVMDIFlags Flags); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 637 | |
| 638 | /** |
| 639 | * Create debugging information entry for a pointer. |
| 640 | * \param Builder The DIBuilder. |
| 641 | * \param PointeeTy Type pointed by this pointer. |
| 642 | * \param SizeInBits Size. |
| 643 | * \param AlignInBits Alignment. (optional, pass 0 to ignore) |
| 644 | * \param AddressSpace DWARF address space. (optional, pass 0 to ignore) |
| 645 | * \param Name Pointer type name. (optional) |
| 646 | * \param NameLen Length of pointer type name. (optional) |
| 647 | */ |
| 648 | LLVMMetadataRef LLVMDIBuilderCreatePointerType( |
| 649 | LLVMDIBuilderRef Builder, LLVMMetadataRef PointeeTy, |
| 650 | uint64_t SizeInBits, uint32_t AlignInBits, unsigned AddressSpace, |
| 651 | const char *Name, size_t NameLen); |
| 652 | |
| 653 | /** |
| 654 | * Create debugging information entry for a struct. |
| 655 | * \param Builder The DIBuilder. |
| 656 | * \param Scope Scope in which this struct is defined. |
| 657 | * \param Name Struct name. |
| 658 | * \param NameLen Struct name length. |
| 659 | * \param File File where this member is defined. |
| 660 | * \param LineNumber Line number. |
| 661 | * \param SizeInBits Member size. |
| 662 | * \param AlignInBits Member alignment. |
| 663 | * \param Flags Flags to encode member attribute, e.g. private |
| 664 | * \param Elements Struct elements. |
| 665 | * \param NumElements Number of struct elements. |
| 666 | * \param RunTimeLang Optional parameter, Objective-C runtime version. |
| 667 | * \param VTableHolder The object containing the vtable for the struct. |
| 668 | * \param UniqueId A unique identifier for the struct. |
| 669 | * \param UniqueIdLen Length of the unique identifier for the struct. |
| 670 | */ |
| 671 | LLVMMetadataRef LLVMDIBuilderCreateStructType( |
| 672 | LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, |
| 673 | size_t NameLen, LLVMMetadataRef File, unsigned LineNumber, |
| 674 | uint64_t SizeInBits, uint32_t AlignInBits, LLVMDIFlags Flags, |
| 675 | LLVMMetadataRef DerivedFrom, LLVMMetadataRef *Elements, |
| 676 | unsigned NumElements, unsigned RunTimeLang, LLVMMetadataRef VTableHolder, |
| 677 | const char *UniqueId, size_t UniqueIdLen); |
| 678 | |
| 679 | /** |
| 680 | * Create debugging information entry for a member. |
| 681 | * \param Builder The DIBuilder. |
| 682 | * \param Scope Member scope. |
| 683 | * \param Name Member name. |
| 684 | * \param NameLen Length of member name. |
| 685 | * \param File File where this member is defined. |
| 686 | * \param LineNo Line number. |
| 687 | * \param SizeInBits Member size. |
| 688 | * \param AlignInBits Member alignment. |
| 689 | * \param OffsetInBits Member offset. |
| 690 | * \param Flags Flags to encode member attribute, e.g. private |
| 691 | * \param Ty Parent type. |
| 692 | */ |
| 693 | LLVMMetadataRef LLVMDIBuilderCreateMemberType( |
| 694 | LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, |
| 695 | size_t NameLen, LLVMMetadataRef File, unsigned LineNo, |
| 696 | uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, |
| 697 | LLVMDIFlags Flags, LLVMMetadataRef Ty); |
| 698 | |
| 699 | /** |
| 700 | * Create debugging information entry for a |
| 701 | * C++ static data member. |
| 702 | * \param Builder The DIBuilder. |
| 703 | * \param Scope Member scope. |
| 704 | * \param Name Member name. |
| 705 | * \param NameLen Length of member name. |
| 706 | * \param File File where this member is declared. |
| 707 | * \param LineNumber Line number. |
| 708 | * \param Type Type of the static member. |
| 709 | * \param Flags Flags to encode member attribute, e.g. private. |
| 710 | * \param ConstantVal Const initializer of the member. |
| 711 | * \param AlignInBits Member alignment. |
| 712 | */ |
| 713 | LLVMMetadataRef |
| 714 | LLVMDIBuilderCreateStaticMemberType( |
| 715 | LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, |
| 716 | size_t NameLen, LLVMMetadataRef File, unsigned LineNumber, |
| 717 | LLVMMetadataRef Type, LLVMDIFlags Flags, LLVMValueRef ConstantVal, |
| 718 | uint32_t AlignInBits); |
| 719 | |
| 720 | /** |
| 721 | * Create debugging information entry for a pointer to member. |
| 722 | * \param Builder The DIBuilder. |
| 723 | * \param PointeeType Type pointed to by this pointer. |
| 724 | * \param ClassType Type for which this pointer points to members of. |
| 725 | * \param SizeInBits Size. |
| 726 | * \param AlignInBits Alignment. |
| 727 | * \param Flags Flags. |
| 728 | */ |
| 729 | LLVMMetadataRef |
| 730 | LLVMDIBuilderCreateMemberPointerType(LLVMDIBuilderRef Builder, |
| 731 | LLVMMetadataRef PointeeType, |
| 732 | LLVMMetadataRef ClassType, |
| 733 | uint64_t SizeInBits, |
| 734 | uint32_t AlignInBits, |
| 735 | LLVMDIFlags Flags); |
| 736 | /** |
| 737 | * Create debugging information entry for Objective-C instance variable. |
| 738 | * \param Builder The DIBuilder. |
| 739 | * \param Name Member name. |
| 740 | * \param NameLen The length of the C string passed to \c Name. |
| 741 | * \param File File where this member is defined. |
| 742 | * \param LineNo Line number. |
| 743 | * \param SizeInBits Member size. |
| 744 | * \param AlignInBits Member alignment. |
| 745 | * \param OffsetInBits Member offset. |
| 746 | * \param Flags Flags to encode member attribute, e.g. private |
| 747 | * \param Ty Parent type. |
| 748 | * \param PropertyNode Property associated with this ivar. |
| 749 | */ |
| 750 | LLVMMetadataRef |
| 751 | LLVMDIBuilderCreateObjCIVar(LLVMDIBuilderRef Builder, |
| 752 | const char *Name, size_t NameLen, |
| 753 | LLVMMetadataRef File, unsigned LineNo, |
| 754 | uint64_t SizeInBits, uint32_t AlignInBits, |
| 755 | uint64_t OffsetInBits, LLVMDIFlags Flags, |
| 756 | LLVMMetadataRef Ty, LLVMMetadataRef PropertyNode); |
| 757 | |
| 758 | /** |
| 759 | * Create debugging information entry for Objective-C property. |
| 760 | * \param Builder The DIBuilder. |
| 761 | * \param Name Property name. |
| 762 | * \param NameLen The length of the C string passed to \c Name. |
| 763 | * \param File File where this property is defined. |
| 764 | * \param LineNo Line number. |
| 765 | * \param GetterName Name of the Objective C property getter selector. |
| 766 | * \param GetterNameLen The length of the C string passed to \c GetterName. |
| 767 | * \param SetterName Name of the Objective C property setter selector. |
| 768 | * \param SetterNameLen The length of the C string passed to \c SetterName. |
| 769 | * \param PropertyAttributes Objective C property attributes. |
| 770 | * \param Ty Type. |
| 771 | */ |
| 772 | LLVMMetadataRef |
| 773 | LLVMDIBuilderCreateObjCProperty(LLVMDIBuilderRef Builder, |
| 774 | const char *Name, size_t NameLen, |
| 775 | LLVMMetadataRef File, unsigned LineNo, |
| 776 | const char *GetterName, size_t GetterNameLen, |
| 777 | const char *SetterName, size_t SetterNameLen, |
| 778 | unsigned PropertyAttributes, |
| 779 | LLVMMetadataRef Ty); |
| 780 | |
| 781 | /** |
| 782 | * Create a uniqued DIType* clone with FlagObjectPointer and FlagArtificial set. |
| 783 | * \param Builder The DIBuilder. |
| 784 | * \param Type The underlying type to which this pointer points. |
| 785 | */ |
| 786 | LLVMMetadataRef |
| 787 | LLVMDIBuilderCreateObjectPointerType(LLVMDIBuilderRef Builder, |
| 788 | LLVMMetadataRef Type); |
| 789 | |
| 790 | /** |
| 791 | * Create debugging information entry for a qualified |
| 792 | * type, e.g. 'const int'. |
| 793 | * \param Builder The DIBuilder. |
| 794 | * \param Tag Tag identifying type, |
| 795 | * e.g. LLVMDWARFTypeQualifier_volatile_type |
| 796 | * \param Type Base Type. |
| 797 | */ |
| 798 | LLVMMetadataRef |
| 799 | LLVMDIBuilderCreateQualifiedType(LLVMDIBuilderRef Builder, unsigned Tag, |
| 800 | LLVMMetadataRef Type); |
| 801 | |
| 802 | /** |
| 803 | * Create debugging information entry for a c++ |
| 804 | * style reference or rvalue reference type. |
| 805 | * \param Builder The DIBuilder. |
| 806 | * \param Tag Tag identifying type, |
| 807 | * \param Type Base Type. |
| 808 | */ |
| 809 | LLVMMetadataRef |
| 810 | LLVMDIBuilderCreateReferenceType(LLVMDIBuilderRef Builder, unsigned Tag, |
| 811 | LLVMMetadataRef Type); |
| 812 | |
| 813 | /** |
| 814 | * Create C++11 nullptr type. |
| 815 | * \param Builder The DIBuilder. |
| 816 | */ |
| 817 | LLVMMetadataRef |
| 818 | LLVMDIBuilderCreateNullPtrType(LLVMDIBuilderRef Builder); |
| 819 | |
| 820 | /** |
| 821 | * Create debugging information entry for a typedef. |
| 822 | * \param Builder The DIBuilder. |
| 823 | * \param Type Original type. |
| 824 | * \param Name Typedef name. |
| 825 | * \param File File where this type is defined. |
| 826 | * \param LineNo Line number. |
| 827 | * \param Scope The surrounding context for the typedef. |
| 828 | */ |
| 829 | LLVMMetadataRef |
| 830 | LLVMDIBuilderCreateTypedef(LLVMDIBuilderRef Builder, LLVMMetadataRef Type, |
| 831 | const char *Name, size_t NameLen, |
| 832 | LLVMMetadataRef File, unsigned LineNo, |
| 833 | LLVMMetadataRef Scope); |
| 834 | |
| 835 | /** |
| 836 | * Create debugging information entry to establish inheritance relationship |
| 837 | * between two types. |
| 838 | * \param Builder The DIBuilder. |
| 839 | * \param Ty Original type. |
| 840 | * \param BaseTy Base type. Ty is inherits from base. |
| 841 | * \param BaseOffset Base offset. |
| 842 | * \param VBPtrOffset Virtual base pointer offset. |
| 843 | * \param Flags Flags to describe inheritance attribute, e.g. private |
| 844 | */ |
| 845 | LLVMMetadataRef |
| 846 | LLVMDIBuilderCreateInheritance(LLVMDIBuilderRef Builder, |
| 847 | LLVMMetadataRef Ty, LLVMMetadataRef BaseTy, |
| 848 | uint64_t BaseOffset, uint32_t VBPtrOffset, |
| 849 | LLVMDIFlags Flags); |
| 850 | |
| 851 | /** |
| 852 | * Create a permanent forward-declared type. |
| 853 | * \param Builder The DIBuilder. |
| 854 | * \param Tag A unique tag for this type. |
| 855 | * \param Name Type name. |
| 856 | * \param NameLen Length of type name. |
| 857 | * \param Scope Type scope. |
| 858 | * \param File File where this type is defined. |
| 859 | * \param Line Line number where this type is defined. |
| 860 | * \param RuntimeLang Indicates runtime version for languages like |
| 861 | * Objective-C. |
| 862 | * \param SizeInBits Member size. |
| 863 | * \param AlignInBits Member alignment. |
| 864 | * \param UniqueIdentifier A unique identifier for the type. |
| 865 | * \param UniqueIdentifierLen Length of the unique identifier. |
| 866 | */ |
| 867 | LLVMMetadataRef LLVMDIBuilderCreateForwardDecl( |
| 868 | LLVMDIBuilderRef Builder, unsigned Tag, const char *Name, |
| 869 | size_t NameLen, LLVMMetadataRef Scope, LLVMMetadataRef File, unsigned Line, |
| 870 | unsigned RuntimeLang, uint64_t SizeInBits, uint32_t AlignInBits, |
| 871 | const char *UniqueIdentifier, size_t UniqueIdentifierLen); |
| 872 | |
| 873 | /** |
| 874 | * Create a temporary forward-declared type. |
| 875 | * \param Builder The DIBuilder. |
| 876 | * \param Tag A unique tag for this type. |
| 877 | * \param Name Type name. |
| 878 | * \param NameLen Length of type name. |
| 879 | * \param Scope Type scope. |
| 880 | * \param File File where this type is defined. |
| 881 | * \param Line Line number where this type is defined. |
| 882 | * \param RuntimeLang Indicates runtime version for languages like |
| 883 | * Objective-C. |
| 884 | * \param SizeInBits Member size. |
| 885 | * \param AlignInBits Member alignment. |
| 886 | * \param Flags Flags. |
| 887 | * \param UniqueIdentifier A unique identifier for the type. |
| 888 | * \param UniqueIdentifierLen Length of the unique identifier. |
| 889 | */ |
| 890 | LLVMMetadataRef |
| 891 | LLVMDIBuilderCreateReplaceableCompositeType( |
| 892 | LLVMDIBuilderRef Builder, unsigned Tag, const char *Name, |
| 893 | size_t NameLen, LLVMMetadataRef Scope, LLVMMetadataRef File, unsigned Line, |
| 894 | unsigned RuntimeLang, uint64_t SizeInBits, uint32_t AlignInBits, |
| 895 | LLVMDIFlags Flags, const char *UniqueIdentifier, |
| 896 | size_t UniqueIdentifierLen); |
| 897 | |
| 898 | /** |
| 899 | * Create debugging information entry for a bit field member. |
| 900 | * \param Builder The DIBuilder. |
| 901 | * \param Scope Member scope. |
| 902 | * \param Name Member name. |
| 903 | * \param NameLen Length of member name. |
| 904 | * \param File File where this member is defined. |
| 905 | * \param LineNumber Line number. |
| 906 | * \param SizeInBits Member size. |
| 907 | * \param OffsetInBits Member offset. |
| 908 | * \param StorageOffsetInBits Member storage offset. |
| 909 | * \param Flags Flags to encode member attribute. |
| 910 | * \param Type Parent type. |
| 911 | */ |
| 912 | LLVMMetadataRef |
| 913 | LLVMDIBuilderCreateBitFieldMemberType(LLVMDIBuilderRef Builder, |
| 914 | LLVMMetadataRef Scope, |
| 915 | const char *Name, size_t NameLen, |
| 916 | LLVMMetadataRef File, unsigned LineNumber, |
| 917 | uint64_t SizeInBits, |
| 918 | uint64_t OffsetInBits, |
| 919 | uint64_t StorageOffsetInBits, |
| 920 | LLVMDIFlags Flags, LLVMMetadataRef Type); |
| 921 | |
| 922 | /** |
| 923 | * Create debugging information entry for a class. |
| 924 | * \param Scope Scope in which this class is defined. |
| 925 | * \param Name Class name. |
| 926 | * \param NameLen The length of the C string passed to \c Name. |
| 927 | * \param File File where this member is defined. |
| 928 | * \param LineNumber Line number. |
| 929 | * \param SizeInBits Member size. |
| 930 | * \param AlignInBits Member alignment. |
| 931 | * \param OffsetInBits Member offset. |
| 932 | * \param Flags Flags to encode member attribute, e.g. private. |
| 933 | * \param DerivedFrom Debug info of the base class of this type. |
| 934 | * \param Elements Class members. |
| 935 | * \param NumElements Number of class elements. |
| 936 | * \param VTableHolder Debug info of the base class that contains vtable |
| 937 | * for this type. This is used in |
| 938 | * DW_AT_containing_type. See DWARF documentation |
| 939 | * for more info. |
| 940 | * \param TemplateParamsNode Template type parameters. |
| 941 | * \param UniqueIdentifier A unique identifier for the type. |
| 942 | * \param UniqueIdentifierLen Length of the unique identifier. |
| 943 | */ |
| 944 | LLVMMetadataRef LLVMDIBuilderCreateClassType(LLVMDIBuilderRef Builder, |
| 945 | LLVMMetadataRef Scope, const char *Name, size_t NameLen, |
| 946 | LLVMMetadataRef File, unsigned LineNumber, uint64_t SizeInBits, |
| 947 | uint32_t AlignInBits, uint64_t OffsetInBits, LLVMDIFlags Flags, |
| 948 | LLVMMetadataRef DerivedFrom, |
| 949 | LLVMMetadataRef *Elements, unsigned NumElements, |
| 950 | LLVMMetadataRef VTableHolder, LLVMMetadataRef TemplateParamsNode, |
| 951 | const char *UniqueIdentifier, size_t UniqueIdentifierLen); |
| 952 | |
| 953 | /** |
| 954 | * Create a uniqued DIType* clone with FlagArtificial set. |
| 955 | * \param Builder The DIBuilder. |
| 956 | * \param Type The underlying type. |
| 957 | */ |
| 958 | LLVMMetadataRef |
| 959 | LLVMDIBuilderCreateArtificialType(LLVMDIBuilderRef Builder, |
| 960 | LLVMMetadataRef Type); |
| 961 | |
| 962 | /** |
| 963 | * Get the name of this DIType. |
| 964 | * \param DType The DIType. |
| 965 | * \param Length The length of the returned string. |
| 966 | * |
| 967 | * @see DIType::getName() |
| 968 | */ |
| 969 | const char *LLVMDITypeGetName(LLVMMetadataRef DType, size_t *Length); |
| 970 | |
| 971 | /** |
| 972 | * Get the size of this DIType in bits. |
| 973 | * \param DType The DIType. |
| 974 | * |
| 975 | * @see DIType::getSizeInBits() |
| 976 | */ |
| 977 | uint64_t LLVMDITypeGetSizeInBits(LLVMMetadataRef DType); |
| 978 | |
| 979 | /** |
| 980 | * Get the offset of this DIType in bits. |
| 981 | * \param DType The DIType. |
| 982 | * |
| 983 | * @see DIType::getOffsetInBits() |
| 984 | */ |
| 985 | uint64_t LLVMDITypeGetOffsetInBits(LLVMMetadataRef DType); |
| 986 | |
| 987 | /** |
| 988 | * Get the alignment of this DIType in bits. |
| 989 | * \param DType The DIType. |
| 990 | * |
| 991 | * @see DIType::getAlignInBits() |
| 992 | */ |
| 993 | uint32_t LLVMDITypeGetAlignInBits(LLVMMetadataRef DType); |
| 994 | |
| 995 | /** |
| 996 | * Get the source line where this DIType is declared. |
| 997 | * \param DType The DIType. |
| 998 | * |
| 999 | * @see DIType::getLine() |
| 1000 | */ |
| 1001 | unsigned LLVMDITypeGetLine(LLVMMetadataRef DType); |
| 1002 | |
| 1003 | /** |
| 1004 | * Get the flags associated with this DIType. |
| 1005 | * \param DType The DIType. |
| 1006 | * |
| 1007 | * @see DIType::getFlags() |
| 1008 | */ |
| 1009 | LLVMDIFlags LLVMDITypeGetFlags(LLVMMetadataRef DType); |
| 1010 | |
| 1011 | /** |
| 1012 | * Create a descriptor for a value range. |
| 1013 | * \param Builder The DIBuilder. |
| 1014 | * \param LowerBound Lower bound of the subrange, e.g. 0 for C, 1 for Fortran. |
| 1015 | * \param Count Count of elements in the subrange. |
| 1016 | */ |
| 1017 | LLVMMetadataRef LLVMDIBuilderGetOrCreateSubrange(LLVMDIBuilderRef Builder, |
| 1018 | int64_t LowerBound, |
| 1019 | int64_t Count); |
| 1020 | |
| 1021 | /** |
| 1022 | * Create an array of DI Nodes. |
| 1023 | * \param Builder The DIBuilder. |
| 1024 | * \param Data The DI Node elements. |
| 1025 | * \param NumElements Number of DI Node elements. |
| 1026 | */ |
| 1027 | LLVMMetadataRef LLVMDIBuilderGetOrCreateArray(LLVMDIBuilderRef Builder, |
| 1028 | LLVMMetadataRef *Data, |
| 1029 | size_t NumElements); |
| 1030 | |
| 1031 | /** |
| 1032 | * Create a new descriptor for the specified variable which has a complex |
| 1033 | * address expression for its address. |
| 1034 | * \param Builder The DIBuilder. |
| 1035 | * \param Addr An array of complex address operations. |
| 1036 | * \param Length Length of the address operation array. |
| 1037 | */ |
| 1038 | LLVMMetadataRef LLVMDIBuilderCreateExpression(LLVMDIBuilderRef Builder, |
| 1039 | int64_t *Addr, size_t Length); |
| 1040 | |
| 1041 | /** |
| 1042 | * Create a new descriptor for the specified variable that does not have an |
| 1043 | * address, but does have a constant value. |
| 1044 | * \param Builder The DIBuilder. |
| 1045 | * \param Value The constant value. |
| 1046 | */ |
| 1047 | LLVMMetadataRef |
| 1048 | LLVMDIBuilderCreateConstantValueExpression(LLVMDIBuilderRef Builder, |
| 1049 | int64_t Value); |
| 1050 | |
| 1051 | /** |
| 1052 | * Create a new descriptor for the specified variable. |
| 1053 | * \param Scope Variable scope. |
| 1054 | * \param Name Name of the variable. |
| 1055 | * \param NameLen The length of the C string passed to \c Name. |
| 1056 | * \param Linkage Mangled name of the variable. |
| 1057 | * \param LinkLen The length of the C string passed to \c Linkage. |
| 1058 | * \param File File where this variable is defined. |
| 1059 | * \param LineNo Line number. |
| 1060 | * \param Ty Variable Type. |
| 1061 | * \param LocalToUnit Boolean flag indicate whether this variable is |
| 1062 | * externally visible or not. |
| 1063 | * \param Expr The location of the global relative to the attached |
| 1064 | * GlobalVariable. |
| 1065 | * \param Decl Reference to the corresponding declaration. |
Andrew Scull | 0372a57 | 2018-11-16 15:47:06 +0000 | [diff] [blame] | 1066 | * variables. |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1067 | * \param AlignInBits Variable alignment(or 0 if no alignment attr was |
| 1068 | * specified) |
| 1069 | */ |
Andrew Scull | 0372a57 | 2018-11-16 15:47:06 +0000 | [diff] [blame] | 1070 | LLVMMetadataRef LLVMDIBuilderCreateGlobalVariableExpression( |
| 1071 | LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, |
| 1072 | size_t NameLen, const char *Linkage, size_t LinkLen, LLVMMetadataRef File, |
| 1073 | unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit, |
| 1074 | LLVMMetadataRef Expr, LLVMMetadataRef Decl, uint32_t AlignInBits); |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame^] | 1075 | |
| 1076 | /** |
| 1077 | * Retrieves the \c DIVariable associated with this global variable expression. |
| 1078 | * \param GVE The global variable expression. |
| 1079 | * |
| 1080 | * @see llvm::DIGlobalVariableExpression::getVariable() |
| 1081 | */ |
| 1082 | LLVMMetadataRef LLVMDIGlobalVariableExpressionGetVariable(LLVMMetadataRef GVE); |
| 1083 | |
| 1084 | /** |
| 1085 | * Retrieves the \c DIExpression associated with this global variable expression. |
| 1086 | * \param GVE The global variable expression. |
| 1087 | * |
| 1088 | * @see llvm::DIGlobalVariableExpression::getExpression() |
| 1089 | */ |
| 1090 | LLVMMetadataRef LLVMDIGlobalVariableExpressionGetExpression( |
| 1091 | LLVMMetadataRef GVE); |
| 1092 | |
| 1093 | /** |
| 1094 | * Get the metadata of the file associated with a given variable. |
| 1095 | * \param Var The variable object. |
| 1096 | * |
| 1097 | * @see DIVariable::getFile() |
| 1098 | */ |
| 1099 | LLVMMetadataRef LLVMDIVariableGetFile(LLVMMetadataRef Var); |
| 1100 | |
| 1101 | /** |
| 1102 | * Get the metadata of the scope associated with a given variable. |
| 1103 | * \param Var The variable object. |
| 1104 | * |
| 1105 | * @see DIVariable::getScope() |
| 1106 | */ |
| 1107 | LLVMMetadataRef LLVMDIVariableGetScope(LLVMMetadataRef Var); |
| 1108 | |
| 1109 | /** |
| 1110 | * Get the source line where this \c DIVariable is declared. |
| 1111 | * \param Var The DIVariable. |
| 1112 | * |
| 1113 | * @see DIVariable::getLine() |
| 1114 | */ |
| 1115 | unsigned LLVMDIVariableGetLine(LLVMMetadataRef Var); |
| 1116 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1117 | /** |
| 1118 | * Create a new temporary \c MDNode. Suitable for use in constructing cyclic |
| 1119 | * \c MDNode structures. A temporary \c MDNode is not uniqued, may be RAUW'd, |
| 1120 | * and must be manually deleted with \c LLVMDisposeTemporaryMDNode. |
| 1121 | * \param Ctx The context in which to construct the temporary node. |
| 1122 | * \param Data The metadata elements. |
| 1123 | * \param NumElements Number of metadata elements. |
| 1124 | */ |
| 1125 | LLVMMetadataRef LLVMTemporaryMDNode(LLVMContextRef Ctx, LLVMMetadataRef *Data, |
| 1126 | size_t NumElements); |
| 1127 | |
| 1128 | /** |
| 1129 | * Deallocate a temporary node. |
| 1130 | * |
| 1131 | * Calls \c replaceAllUsesWith(nullptr) before deleting, so any remaining |
| 1132 | * references will be reset. |
| 1133 | * \param TempNode The temporary metadata node. |
| 1134 | */ |
| 1135 | void LLVMDisposeTemporaryMDNode(LLVMMetadataRef TempNode); |
| 1136 | |
| 1137 | /** |
| 1138 | * Replace all uses of temporary metadata. |
| 1139 | * \param TempTargetMetadata The temporary metadata node. |
| 1140 | * \param Replacement The replacement metadata node. |
| 1141 | */ |
| 1142 | void LLVMMetadataReplaceAllUsesWith(LLVMMetadataRef TempTargetMetadata, |
| 1143 | LLVMMetadataRef Replacement); |
| 1144 | |
| 1145 | /** |
| 1146 | * Create a new descriptor for the specified global variable that is temporary |
| 1147 | * and meant to be RAUWed. |
| 1148 | * \param Scope Variable scope. |
| 1149 | * \param Name Name of the variable. |
| 1150 | * \param NameLen The length of the C string passed to \c Name. |
| 1151 | * \param Linkage Mangled name of the variable. |
| 1152 | * \param LnkLen The length of the C string passed to \c Linkage. |
| 1153 | * \param File File where this variable is defined. |
| 1154 | * \param LineNo Line number. |
| 1155 | * \param Ty Variable Type. |
| 1156 | * \param LocalToUnit Boolean flag indicate whether this variable is |
| 1157 | * externally visible or not. |
| 1158 | * \param Decl Reference to the corresponding declaration. |
| 1159 | * \param AlignInBits Variable alignment(or 0 if no alignment attr was |
| 1160 | * specified) |
| 1161 | */ |
Andrew Scull | 0372a57 | 2018-11-16 15:47:06 +0000 | [diff] [blame] | 1162 | LLVMMetadataRef LLVMDIBuilderCreateTempGlobalVariableFwdDecl( |
| 1163 | LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, |
| 1164 | size_t NameLen, const char *Linkage, size_t LnkLen, LLVMMetadataRef File, |
| 1165 | unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit, |
| 1166 | LLVMMetadataRef Decl, uint32_t AlignInBits); |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 1167 | |
| 1168 | /** |
| 1169 | * Insert a new llvm.dbg.declare intrinsic call before the given instruction. |
| 1170 | * \param Builder The DIBuilder. |
| 1171 | * \param Storage The storage of the variable to declare. |
| 1172 | * \param VarInfo The variable's debug info descriptor. |
| 1173 | * \param Expr A complex location expression for the variable. |
| 1174 | * \param DebugLoc Debug info location. |
| 1175 | * \param Instr Instruction acting as a location for the new intrinsic. |
| 1176 | */ |
| 1177 | LLVMValueRef LLVMDIBuilderInsertDeclareBefore( |
| 1178 | LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo, |
| 1179 | LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr); |
| 1180 | |
| 1181 | /** |
| 1182 | * Insert a new llvm.dbg.declare intrinsic call at the end of the given basic |
| 1183 | * block. If the basic block has a terminator instruction, the intrinsic is |
| 1184 | * inserted before that terminator instruction. |
| 1185 | * \param Builder The DIBuilder. |
| 1186 | * \param Storage The storage of the variable to declare. |
| 1187 | * \param VarInfo The variable's debug info descriptor. |
| 1188 | * \param Expr A complex location expression for the variable. |
| 1189 | * \param DebugLoc Debug info location. |
| 1190 | * \param Block Basic block acting as a location for the new intrinsic. |
| 1191 | */ |
| 1192 | LLVMValueRef LLVMDIBuilderInsertDeclareAtEnd( |
| 1193 | LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo, |
| 1194 | LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block); |
| 1195 | |
| 1196 | /** |
| 1197 | * Insert a new llvm.dbg.value intrinsic call before the given instruction. |
| 1198 | * \param Builder The DIBuilder. |
| 1199 | * \param Val The value of the variable. |
| 1200 | * \param VarInfo The variable's debug info descriptor. |
| 1201 | * \param Expr A complex location expression for the variable. |
| 1202 | * \param DebugLoc Debug info location. |
| 1203 | * \param Instr Instruction acting as a location for the new intrinsic. |
| 1204 | */ |
| 1205 | LLVMValueRef LLVMDIBuilderInsertDbgValueBefore(LLVMDIBuilderRef Builder, |
| 1206 | LLVMValueRef Val, |
| 1207 | LLVMMetadataRef VarInfo, |
| 1208 | LLVMMetadataRef Expr, |
| 1209 | LLVMMetadataRef DebugLoc, |
| 1210 | LLVMValueRef Instr); |
| 1211 | |
| 1212 | /** |
| 1213 | * Insert a new llvm.dbg.value intrinsic call at the end of the given basic |
| 1214 | * block. If the basic block has a terminator instruction, the intrinsic is |
| 1215 | * inserted before that terminator instruction. |
| 1216 | * \param Builder The DIBuilder. |
| 1217 | * \param Val The value of the variable. |
| 1218 | * \param VarInfo The variable's debug info descriptor. |
| 1219 | * \param Expr A complex location expression for the variable. |
| 1220 | * \param DebugLoc Debug info location. |
| 1221 | * \param Block Basic block acting as a location for the new intrinsic. |
| 1222 | */ |
| 1223 | LLVMValueRef LLVMDIBuilderInsertDbgValueAtEnd(LLVMDIBuilderRef Builder, |
| 1224 | LLVMValueRef Val, |
| 1225 | LLVMMetadataRef VarInfo, |
| 1226 | LLVMMetadataRef Expr, |
| 1227 | LLVMMetadataRef DebugLoc, |
| 1228 | LLVMBasicBlockRef Block); |
| 1229 | |
| 1230 | /** |
| 1231 | * Create a new descriptor for a local auto variable. |
| 1232 | * \param Builder The DIBuilder. |
| 1233 | * \param Scope The local scope the variable is declared in. |
| 1234 | * \param Name Variable name. |
| 1235 | * \param NameLen Length of variable name. |
| 1236 | * \param File File where this variable is defined. |
| 1237 | * \param LineNo Line number. |
| 1238 | * \param Ty Metadata describing the type of the variable. |
| 1239 | * \param AlwaysPreserve If true, this descriptor will survive optimizations. |
| 1240 | * \param Flags Flags. |
| 1241 | * \param AlignInBits Variable alignment. |
| 1242 | */ |
| 1243 | LLVMMetadataRef LLVMDIBuilderCreateAutoVariable( |
| 1244 | LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, |
| 1245 | size_t NameLen, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty, |
| 1246 | LLVMBool AlwaysPreserve, LLVMDIFlags Flags, uint32_t AlignInBits); |
| 1247 | |
| 1248 | /** |
| 1249 | * Create a new descriptor for a function parameter variable. |
| 1250 | * \param Builder The DIBuilder. |
| 1251 | * \param Scope The local scope the variable is declared in. |
| 1252 | * \param Name Variable name. |
| 1253 | * \param NameLen Length of variable name. |
| 1254 | * \param ArgNo Unique argument number for this variable; starts at 1. |
| 1255 | * \param File File where this variable is defined. |
| 1256 | * \param LineNo Line number. |
| 1257 | * \param Ty Metadata describing the type of the variable. |
| 1258 | * \param AlwaysPreserve If true, this descriptor will survive optimizations. |
| 1259 | * \param Flags Flags. |
| 1260 | */ |
| 1261 | LLVMMetadataRef LLVMDIBuilderCreateParameterVariable( |
| 1262 | LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, |
| 1263 | size_t NameLen, unsigned ArgNo, LLVMMetadataRef File, unsigned LineNo, |
| 1264 | LLVMMetadataRef Ty, LLVMBool AlwaysPreserve, LLVMDIFlags Flags); |
| 1265 | |
| 1266 | /** |
| 1267 | * Get the metadata of the subprogram attached to a function. |
| 1268 | * |
| 1269 | * @see llvm::Function::getSubprogram() |
| 1270 | */ |
| 1271 | LLVMMetadataRef LLVMGetSubprogram(LLVMValueRef Func); |
| 1272 | |
| 1273 | /** |
| 1274 | * Set the subprogram attached to a function. |
| 1275 | * |
| 1276 | * @see llvm::Function::setSubprogram() |
| 1277 | */ |
| 1278 | void LLVMSetSubprogram(LLVMValueRef Func, LLVMMetadataRef SP); |
| 1279 | |
Andrew Scull | 0372a57 | 2018-11-16 15:47:06 +0000 | [diff] [blame] | 1280 | /** |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame^] | 1281 | * Get the line associated with a given subprogram. |
| 1282 | * \param Subprogram The subprogram object. |
| 1283 | * |
| 1284 | * @see DISubprogram::getLine() |
| 1285 | */ |
| 1286 | unsigned LLVMDISubprogramGetLine(LLVMMetadataRef Subprogram); |
| 1287 | |
| 1288 | /** |
| 1289 | * Get the debug location for the given instruction. |
| 1290 | * |
| 1291 | * @see llvm::Instruction::getDebugLoc() |
| 1292 | */ |
| 1293 | LLVMMetadataRef LLVMInstructionGetDebugLoc(LLVMValueRef Inst); |
| 1294 | |
| 1295 | /** |
| 1296 | * Set the debug location for the given instruction. |
| 1297 | * |
| 1298 | * To clear the location metadata of the given instruction, pass NULL to \p Loc. |
| 1299 | * |
| 1300 | * @see llvm::Instruction::setDebugLoc() |
| 1301 | */ |
| 1302 | void LLVMInstructionSetDebugLoc(LLVMValueRef Inst, LLVMMetadataRef Loc); |
| 1303 | |
| 1304 | /** |
Andrew Scull | 0372a57 | 2018-11-16 15:47:06 +0000 | [diff] [blame] | 1305 | * Obtain the enumerated type of a Metadata instance. |
| 1306 | * |
| 1307 | * @see llvm::Metadata::getMetadataID() |
| 1308 | */ |
| 1309 | LLVMMetadataKind LLVMGetMetadataKind(LLVMMetadataRef Metadata); |
| 1310 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1311 | #ifdef __cplusplus |
| 1312 | } /* end extern "C" */ |
| 1313 | #endif |
| 1314 | |
| 1315 | #endif |