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