PageRenderTime 28ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/contrib/llvm/include/llvm-c/DebugInfo.h

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