DebugInfo.h 54 KB

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