1 //===------------ DebugInfo.h - LLVM C API Debug Info API -----------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 /// This file declares the C API endpoints for generating DWARF Debug Info
12 /// Note: This interface is experimental. It is *NOT* stable, and may be
13 /// changed without warning.
15 //===----------------------------------------------------------------------===//
17 #ifndef LLVM_C_DEBUGINFO_H
18 #define LLVM_C_DEBUGINFO_H
20 #include "llvm-c/Core.h"
31 LLVMDIFlagPrivate = 1,
32 LLVMDIFlagProtected = 2,
34 LLVMDIFlagFwdDecl = 1 << 2,
35 LLVMDIFlagAppleBlock = 1 << 3,
36 LLVMDIFlagBlockByrefStruct = 1 << 4,
37 LLVMDIFlagVirtual = 1 << 5,
38 LLVMDIFlagArtificial = 1 << 6,
39 LLVMDIFlagExplicit = 1 << 7,
40 LLVMDIFlagPrototyped = 1 << 8,
41 LLVMDIFlagObjcClassComplete = 1 << 9,
42 LLVMDIFlagObjectPointer = 1 << 10,
43 LLVMDIFlagVector = 1 << 11,
44 LLVMDIFlagStaticMember = 1 << 12,
45 LLVMDIFlagLValueReference = 1 << 13,
46 LLVMDIFlagRValueReference = 1 << 14,
47 LLVMDIFlagReserved = 1 << 15,
48 LLVMDIFlagSingleInheritance = 1 << 16,
49 LLVMDIFlagMultipleInheritance = 2 << 16,
50 LLVMDIFlagVirtualInheritance = 3 << 16,
51 LLVMDIFlagIntroducedVirtual = 1 << 18,
52 LLVMDIFlagBitField = 1 << 19,
53 LLVMDIFlagNoReturn = 1 << 20,
54 LLVMDIFlagMainSubprogram = 1 << 21,
55 LLVMDIFlagTypePassByValue = 1 << 22,
56 LLVMDIFlagTypePassByReference = 1 << 23,
57 LLVMDIFlagIndirectVirtualBase = (1 << 2) | (1 << 5),
58 LLVMDIFlagAccessibility = LLVMDIFlagPrivate | LLVMDIFlagProtected |
60 LLVMDIFlagPtrToMemberRep = LLVMDIFlagSingleInheritance |
61 LLVMDIFlagMultipleInheritance |
62 LLVMDIFlagVirtualInheritance
66 * Source languages known by DWARF.
69 LLVMDWARFSourceLanguageC89,
70 LLVMDWARFSourceLanguageC,
71 LLVMDWARFSourceLanguageAda83,
72 LLVMDWARFSourceLanguageC_plus_plus,
73 LLVMDWARFSourceLanguageCobol74,
74 LLVMDWARFSourceLanguageCobol85,
75 LLVMDWARFSourceLanguageFortran77,
76 LLVMDWARFSourceLanguageFortran90,
77 LLVMDWARFSourceLanguagePascal83,
78 LLVMDWARFSourceLanguageModula2,
80 LLVMDWARFSourceLanguageJava,
81 LLVMDWARFSourceLanguageC99,
82 LLVMDWARFSourceLanguageAda95,
83 LLVMDWARFSourceLanguageFortran95,
84 LLVMDWARFSourceLanguagePLI,
85 LLVMDWARFSourceLanguageObjC,
86 LLVMDWARFSourceLanguageObjC_plus_plus,
87 LLVMDWARFSourceLanguageUPC,
88 LLVMDWARFSourceLanguageD,
90 LLVMDWARFSourceLanguagePython,
92 LLVMDWARFSourceLanguageOpenCL,
93 LLVMDWARFSourceLanguageGo,
94 LLVMDWARFSourceLanguageModula3,
95 LLVMDWARFSourceLanguageHaskell,
96 LLVMDWARFSourceLanguageC_plus_plus_03,
97 LLVMDWARFSourceLanguageC_plus_plus_11,
98 LLVMDWARFSourceLanguageOCaml,
99 LLVMDWARFSourceLanguageRust,
100 LLVMDWARFSourceLanguageC11,
101 LLVMDWARFSourceLanguageSwift,
102 LLVMDWARFSourceLanguageJulia,
103 LLVMDWARFSourceLanguageDylan,
104 LLVMDWARFSourceLanguageC_plus_plus_14,
105 LLVMDWARFSourceLanguageFortran03,
106 LLVMDWARFSourceLanguageFortran08,
107 LLVMDWARFSourceLanguageRenderScript,
108 LLVMDWARFSourceLanguageBLISS,
109 // Vendor extensions:
110 LLVMDWARFSourceLanguageMips_Assembler,
111 LLVMDWARFSourceLanguageGOOGLE_RenderScript,
112 LLVMDWARFSourceLanguageBORLAND_Delphi
113 } LLVMDWARFSourceLanguage;
116 * The amount of debug information to emit.
119 LLVMDWARFEmissionNone = 0,
120 LLVMDWARFEmissionFull,
121 LLVMDWARFEmissionLineTablesOnly
122 } LLVMDWARFEmissionKind;
125 * An LLVM DWARF type encoding.
127 typedef unsigned LLVMDWARFTypeEncoding;
130 * The current debug metadata version number.
132 unsigned LLVMDebugMetadataVersion(void);
135 * The version of debug metadata that's present in the provided \c Module.
137 unsigned LLVMGetModuleDebugMetadataVersion(LLVMModuleRef Module);
140 * Strip debug info in the module if it exists.
141 * To do this, we remove all calls to the debugger intrinsics and any named
142 * metadata for debugging. We also remove debug locations for instructions.
143 * Return true if module is modified.
145 LLVMBool LLVMStripModuleDebugInfo(LLVMModuleRef Module);
148 * Construct a builder for a module, and do not allow for unresolved nodes
149 * attached to the module.
151 LLVMDIBuilderRef LLVMCreateDIBuilderDisallowUnresolved(LLVMModuleRef M);
154 * Construct a builder for a module and collect unresolved nodes attached
155 * to the module in order to resolve cycles during a call to
156 * \c LLVMDIBuilderFinalize.
158 LLVMDIBuilderRef LLVMCreateDIBuilder(LLVMModuleRef M);
161 * Deallocates the \c DIBuilder and everything it owns.
162 * @note You must call \c LLVMDIBuilderFinalize before this
164 void LLVMDisposeDIBuilder(LLVMDIBuilderRef Builder);
167 * Construct any deferred debug info descriptors.
169 void LLVMDIBuilderFinalize(LLVMDIBuilderRef Builder);
172 * A CompileUnit provides an anchor for all debugging
173 * information generated during this instance of compilation.
174 * \param Lang Source programming language, eg.
175 * \c LLVMDWARFSourceLanguageC99
176 * \param FileRef File info.
177 * \param Producer Identify the producer of debugging information
178 * and code. Usually this is a compiler
180 * \param ProducerLen The length of the C string passed to \c Producer.
181 * \param isOptimized A boolean flag which indicates whether optimization
183 * \param Flags This string lists command line options. This
184 * string is directly embedded in debug info
185 * output which may be used by a tool
186 * analyzing generated debugging information.
187 * \param FlagsLen The length of the C string passed to \c Flags.
188 * \param RuntimeVer This indicates runtime version for languages like
190 * \param SplitName The name of the file that we'll split debug info
192 * \param SplitNameLen The length of the C string passed to \c SplitName.
193 * \param Kind The kind of debug information to generate.
194 * \param DWOId The DWOId if this is a split skeleton compile unit.
195 * \param SplitDebugInlining Whether to emit inline debug info.
196 * \param DebugInfoForProfiling Whether to emit extra debug info for
197 * profile collection.
199 LLVMMetadataRef LLVMDIBuilderCreateCompileUnit(
200 LLVMDIBuilderRef Builder, LLVMDWARFSourceLanguage Lang,
201 LLVMMetadataRef FileRef, const char *Producer, size_t ProducerLen,
202 LLVMBool isOptimized, const char *Flags, size_t FlagsLen,
203 unsigned RuntimeVer, const char *SplitName, size_t SplitNameLen,
204 LLVMDWARFEmissionKind Kind, unsigned DWOId, LLVMBool SplitDebugInlining,
205 LLVMBool DebugInfoForProfiling);
208 * Create a file descriptor to hold debugging information for a file.
209 * \param Builder The \c DIBuilder.
210 * \param Filename File name.
211 * \param FilenameLen The length of the C string passed to \c Filename.
212 * \param Directory Directory.
213 * \param DirectoryLen The length of the C string passed to \c Directory.
216 LLVMDIBuilderCreateFile(LLVMDIBuilderRef Builder, const char *Filename,
217 size_t FilenameLen, const char *Directory,
218 size_t DirectoryLen);
221 * Creates a new descriptor for a module with the specified parent scope.
222 * \param Builder The \c DIBuilder.
223 * \param ParentScope The parent scope containing this module declaration.
224 * \param Name Module name.
225 * \param NameLen The length of the C string passed to \c Name.
226 * \param ConfigMacros A space-separated shell-quoted list of -D macro
227 definitions as they would appear on a command line.
228 * \param ConfigMacrosLen The length of the C string passed to \c ConfigMacros.
229 * \param IncludePath The path to the module map file.
230 * \param IncludePathLen The length of the C string passed to \c IncludePath.
231 * \param ISysRoot The Clang system root (value of -isysroot).
232 * \param ISysRootLen The length of the C string passed to \c ISysRoot.
235 LLVMDIBuilderCreateModule(LLVMDIBuilderRef Builder, LLVMMetadataRef ParentScope,
236 const char *Name, size_t NameLen,
237 const char *ConfigMacros, size_t ConfigMacrosLen,
238 const char *IncludePath, size_t IncludePathLen,
239 const char *ISysRoot, size_t ISysRootLen);
242 * Creates a new descriptor for a namespace with the specified parent scope.
243 * \param Builder The \c DIBuilder.
244 * \param ParentScope The parent scope containing this module declaration.
245 * \param Name NameSpace name.
246 * \param NameLen The length of the C string passed to \c Name.
247 * \param ExportSymbols Whether or not the namespace exports symbols, e.g.
248 * this is true of C++ inline namespaces.
251 LLVMDIBuilderCreateNameSpace(LLVMDIBuilderRef Builder,
252 LLVMMetadataRef ParentScope,
253 const char *Name, size_t NameLen,
254 LLVMBool ExportSymbols);
257 * Create a new descriptor for the specified subprogram.
258 * \param Builder The \c DIBuilder.
259 * \param Scope Function scope.
260 * \param Name Function name.
261 * \param NameLen Length of enumeration name.
262 * \param LinkageName Mangled function name.
263 * \param LinkageNameLen Length of linkage name.
264 * \param File File where this variable is defined.
265 * \param LineNo Line number.
266 * \param Ty Function type.
267 * \param IsLocalToUnit True if this function is not externally visible.
268 * \param IsDefinition True if this is a function definition.
269 * \param ScopeLine Set to the beginning of the scope this starts
270 * \param Flags E.g.: \c LLVMDIFlagLValueReference. These flags are
271 * used to emit dwarf attributes.
272 * \param IsOptimized True if optimization is ON.
274 LLVMMetadataRef LLVMDIBuilderCreateFunction(
275 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
276 size_t NameLen, const char *LinkageName, size_t LinkageNameLen,
277 LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty,
278 LLVMBool IsLocalToUnit, LLVMBool IsDefinition,
279 unsigned ScopeLine, LLVMDIFlags Flags, LLVMBool IsOptimized);
282 * Create a descriptor for a lexical block with the specified parent context.
283 * \param Builder The \c DIBuilder.
284 * \param Scope Parent lexical block.
285 * \param File Source file.
286 * \param Line The line in the source file.
287 * \param Column The column in the source file.
289 LLVMMetadataRef LLVMDIBuilderCreateLexicalBlock(
290 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope,
291 LLVMMetadataRef File, unsigned Line, unsigned Column);
294 * Create a descriptor for a lexical block with a new file attached.
295 * \param Builder The \c DIBuilder.
296 * \param Scope Lexical block.
297 * \param File Source file.
298 * \param Discriminator DWARF path discriminator value.
301 LLVMDIBuilderCreateLexicalBlockFile(LLVMDIBuilderRef Builder,
302 LLVMMetadataRef Scope,
303 LLVMMetadataRef File,
304 unsigned Discriminator);
307 * Creates a new DebugLocation that describes a source location.
308 * \param Line The line in the source file.
309 * \param Column The column in the source file.
310 * \param Scope The scope in which the location resides.
311 * \param InlinedAt The scope where this location was inlined, if at all.
313 * \note If the item to which this location is attached cannot be
314 * attributed to a source line, pass 0 for the line and column.
317 LLVMDIBuilderCreateDebugLocation(LLVMContextRef Ctx, unsigned Line,
318 unsigned Column, LLVMMetadataRef Scope,
319 LLVMMetadataRef InlinedAt);
322 * Create a type array.
323 * \param Builder The DIBuilder.
324 * \param Data The type elements.
325 * \param NumElements Number of type elements.
327 LLVMMetadataRef LLVMDIBuilderGetOrCreateTypeArray(LLVMDIBuilderRef Builder,
328 LLVMMetadataRef *Data,
332 * Create subroutine type.
333 * \param Builder The DIBuilder.
334 * \param File The file in which the subroutine resides.
335 * \param ParameterTypes An array of subroutine parameter types. This
336 * includes return type at 0th index.
337 * \param NumParameterTypes The number of parameter types in \c ParameterTypes
338 * \param Flags E.g.: \c LLVMDIFlagLValueReference.
339 * These flags are used to emit dwarf attributes.
342 LLVMDIBuilderCreateSubroutineType(LLVMDIBuilderRef Builder,
343 LLVMMetadataRef File,
344 LLVMMetadataRef *ParameterTypes,
345 unsigned NumParameterTypes,
349 * Create debugging information entry for an enumeration.
350 * \param Builder The DIBuilder.
351 * \param Scope Scope in which this enumeration is defined.
352 * \param Name Enumeration name.
353 * \param NameLen Length of enumeration name.
354 * \param File File where this member is defined.
355 * \param LineNumber Line number.
356 * \param SizeInBits Member size.
357 * \param AlignInBits Member alignment.
358 * \param Elements Enumeration elements.
359 * \param NumElements Number of enumeration elements.
360 * \param ClassTy Underlying type of a C++11/ObjC fixed enum.
362 LLVMMetadataRef LLVMDIBuilderCreateEnumerationType(
363 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
364 size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,
365 unsigned SizeInBits, unsigned AlignInBits, LLVMMetadataRef *Elements,
366 unsigned NumElements, LLVMMetadataRef ClassTy);
369 * Create debugging information entry for a union.
370 * \param Builder The DIBuilder.
371 * \param Scope Scope in which this union is defined.
372 * \param Name Union name.
373 * \param NameLen Length of union name.
374 * \param File File where this member is defined.
375 * \param LineNumber Line number.
376 * \param SizeInBits Member size.
377 * \param AlignInBits Member alignment.
378 * \param Flags Flags to encode member attribute, e.g. private
379 * \param Elements Union elements.
380 * \param NumElements Number of union elements.
381 * \param RunTimeLang Optional parameter, Objective-C runtime version.
382 * \param UniqueId A unique identifier for the union.
383 * \param UniqueIdLen Length of unique identifier.
385 LLVMMetadataRef LLVMDIBuilderCreateUnionType(
386 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
387 size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,
388 unsigned SizeInBits, unsigned AlignInBits, LLVMDIFlags Flags,
389 LLVMMetadataRef *Elements, unsigned NumElements, unsigned RunTimeLang,
390 const char *UniqueId, size_t UniqueIdLen);
394 * Create debugging information entry for an array.
395 * \param Builder The DIBuilder.
396 * \param Size Array size.
397 * \param AlignInBits Alignment.
398 * \param Ty Element type.
399 * \param Subscripts Subscripts.
400 * \param NumSubscripts Number of subscripts.
403 LLVMDIBuilderCreateArrayType(LLVMDIBuilderRef Builder, unsigned Size,
404 unsigned AlignInBits, LLVMMetadataRef Ty,
405 LLVMMetadataRef *Subscripts,
406 unsigned NumSubscripts);
409 * Create debugging information entry for a vector type.
410 * \param Builder The DIBuilder.
411 * \param Size Vector size.
412 * \param AlignInBits Alignment.
413 * \param Ty Element type.
414 * \param Subscripts Subscripts.
415 * \param NumSubscripts Number of subscripts.
418 LLVMDIBuilderCreateVectorType(LLVMDIBuilderRef Builder, unsigned Size,
419 unsigned AlignInBits, LLVMMetadataRef Ty,
420 LLVMMetadataRef *Subscripts,
421 unsigned NumSubscripts);
424 * Create a DWARF unspecified type.
425 * \param Builder The DIBuilder.
426 * \param Name The unspecified type's name.
427 * \param NameLen Length of type name.
430 LLVMDIBuilderCreateUnspecifiedType(LLVMDIBuilderRef Builder, const char *Name,
434 * Create debugging information entry for a basic
436 * \param Builder The DIBuilder.
437 * \param Name Type name.
438 * \param NameLen Length of type name.
439 * \param SizeInBits Size of the type.
440 * \param Encoding DWARF encoding code, e.g. \c LLVMDWARFTypeEncoding_float.
443 LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef Builder, const char *Name,
444 size_t NameLen, unsigned SizeInBits,
445 LLVMDWARFTypeEncoding Encoding);
448 * Create debugging information entry for a pointer.
449 * \param Builder The DIBuilder.
450 * \param PointeeTy Type pointed by this pointer.
451 * \param SizeInBits Size.
452 * \param AlignInBits Alignment. (optional, pass 0 to ignore)
453 * \param AddressSpace DWARF address space. (optional, pass 0 to ignore)
454 * \param Name Pointer type name. (optional)
455 * \param NameLen Length of pointer type name. (optional)
457 LLVMMetadataRef LLVMDIBuilderCreatePointerType(
458 LLVMDIBuilderRef Builder, LLVMMetadataRef PointeeTy,
459 unsigned SizeInBits, unsigned AlignInBits, unsigned AddressSpace,
460 const char *Name, size_t NameLen);
463 * Create debugging information entry for a struct.
464 * \param Builder The DIBuilder.
465 * \param Scope Scope in which this struct is defined.
466 * \param Name Struct name.
467 * \param NameLen Struct name length.
468 * \param File File where this member is defined.
469 * \param LineNumber Line number.
470 * \param SizeInBits Member size.
471 * \param AlignInBits Member alignment.
472 * \param Flags Flags to encode member attribute, e.g. private
473 * \param Elements Struct elements.
474 * \param NumElements Number of struct elements.
475 * \param RunTimeLang Optional parameter, Objective-C runtime version.
476 * \param VTableHolder The object containing the vtable for the struct.
477 * \param UniqueId A unique identifier for the struct.
478 * \param UniqueIdLen Length of the unique identifier for the struct.
480 LLVMMetadataRef LLVMDIBuilderCreateStructType(
481 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
482 size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,
483 unsigned SizeInBits, unsigned AlignInBits, LLVMDIFlags Flags,
484 LLVMMetadataRef DerivedFrom, LLVMMetadataRef *Elements,
485 unsigned NumElements, unsigned RunTimeLang, LLVMMetadataRef VTableHolder,
486 const char *UniqueId, size_t UniqueIdLen);
489 * Create debugging information entry for a member.
490 * \param Builder The DIBuilder.
491 * \param Scope Member scope.
492 * \param Name Member name.
493 * \param NameLen Length of member name.
494 * \param File File where this member is defined.
495 * \param LineNo Line number.
496 * \param SizeInBits Member size.
497 * \param AlignInBits Member alignment.
498 * \param OffsetInBits Member offset.
499 * \param Flags Flags to encode member attribute, e.g. private
500 * \param Ty Parent type.
502 LLVMMetadataRef LLVMDIBuilderCreateMemberType(
503 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
504 size_t NameLen, LLVMMetadataRef File, unsigned LineNo,
505 unsigned SizeInBits, unsigned AlignInBits, unsigned OffsetInBits,
506 LLVMDIFlags Flags, LLVMMetadataRef Ty);
509 * Create debugging information entry for a
510 * C++ static data member.
511 * \param Builder The DIBuilder.
512 * \param Scope Member scope.
513 * \param Name Member name.
514 * \param NameLen Length of member name.
515 * \param File File where this member is declared.
516 * \param LineNumber Line number.
517 * \param Type Type of the static member.
518 * \param Flags Flags to encode member attribute, e.g. private.
519 * \param ConstantVal Const initializer of the member.
520 * \param AlignInBits Member alignment.
523 LLVMDIBuilderCreateStaticMemberType(
524 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
525 size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,
526 LLVMMetadataRef Type, LLVMDIFlags Flags, LLVMValueRef ConstantVal,
527 unsigned AlignInBits);
530 * Create debugging information entry for a pointer to member.
531 * \param Builder The DIBuilder.
532 * \param PointeeType Type pointed to by this pointer.
533 * \param ClassType Type for which this pointer points to members of.
534 * \param SizeInBits Size.
535 * \param AlignInBits Alignment.
536 * \param Flags Flags.
539 LLVMDIBuilderCreateMemberPointerType(LLVMDIBuilderRef Builder,
540 LLVMMetadataRef PointeeType,
541 LLVMMetadataRef ClassType,
543 unsigned AlignInBits,
547 * Create a new DIType* with the "object pointer"
549 * \param Builder The DIBuilder.
550 * \param Type The underlying type to which this pointer points.
553 LLVMDIBuilderCreateObjectPointerType(LLVMDIBuilderRef Builder,
554 LLVMMetadataRef Type);
557 * Create debugging information entry for a qualified
558 * type, e.g. 'const int'.
559 * \param Builder The DIBuilder.
560 * \param Tag Tag identifying type,
561 * e.g. LLVMDWARFTypeQualifier_volatile_type
562 * \param Type Base Type.
565 LLVMDIBuilderCreateQualifiedType(LLVMDIBuilderRef Builder, unsigned Tag,
566 LLVMMetadataRef Type);
569 * Create debugging information entry for a c++
570 * style reference or rvalue reference type.
571 * \param Builder The DIBuilder.
572 * \param Tag Tag identifying type,
573 * \param Type Base Type.
576 LLVMDIBuilderCreateReferenceType(LLVMDIBuilderRef Builder, unsigned Tag,
577 LLVMMetadataRef Type);
580 * Create C++11 nullptr type.
581 * \param Builder The DIBuilder.
584 LLVMDIBuilderCreateNullPtrType(LLVMDIBuilderRef Builder);
587 * Create a permanent forward-declared type.
588 * \param Builder The DIBuilder.
589 * \param Tag A unique tag for this type.
590 * \param Name Type name.
591 * \param NameLen Length of type name.
592 * \param Scope Type scope.
593 * \param File File where this type is defined.
594 * \param Line Line number where this type is defined.
595 * \param RuntimeLang Indicates runtime version for languages like
597 * \param SizeInBits Member size.
598 * \param AlignInBits Member alignment.
599 * \param Flags Flags.
600 * \param UniqueIdentifier A unique identifier for the type.
601 * \param UniqueIdentifierLen Length of the unique identifier.
603 LLVMMetadataRef LLVMDIBuilderCreateForwardDecl(
604 LLVMDIBuilderRef Builder, unsigned Tag, const char *Name,
605 size_t NameLen, LLVMMetadataRef Scope, LLVMMetadataRef File, unsigned Line,
606 unsigned RuntimeLang, unsigned SizeInBits, unsigned AlignInBits,
607 const char *UniqueIdentifier, size_t UniqueIdentifierLen);
610 * Create a temporary forward-declared type.
611 * \param Builder The DIBuilder.
612 * \param Tag A unique tag for this type.
613 * \param Name Type name.
614 * \param NameLen Length of type name.
615 * \param Scope Type scope.
616 * \param File File where this type is defined.
617 * \param Line Line number where this type is defined.
618 * \param RuntimeLang Indicates runtime version for languages like
620 * \param SizeInBits Member size.
621 * \param AlignInBits Member alignment.
622 * \param Flags Flags.
623 * \param UniqueIdentifier A unique identifier for the type.
624 * \param UniqueIdentifierLen Length of the unique identifier.
627 LLVMDIBuilderCreateReplaceableCompositeType(
628 LLVMDIBuilderRef Builder, unsigned Tag, const char *Name,
629 size_t NameLen, LLVMMetadataRef Scope, LLVMMetadataRef File, unsigned Line,
630 unsigned RuntimeLang, unsigned SizeInBits, unsigned AlignInBits,
631 LLVMDIFlags Flags, const char *UniqueIdentifier,
632 size_t UniqueIdentifierLen);
635 * Create debugging information entry for a bit field member.
636 * \param Builder The DIBuilder.
637 * \param Scope Member scope.
638 * \param Name Member name.
639 * \param NameLen Length of member name.
640 * \param File File where this member is defined.
641 * \param LineNumber Line number.
642 * \param SizeInBits Member size.
643 * \param OffsetInBits Member offset.
644 * \param StorageOffsetInBits Member storage offset.
645 * \param Flags Flags to encode member attribute.
646 * \param Type Parent type.
649 LLVMDIBuilderCreateBitFieldMemberType(LLVMDIBuilderRef Builder,
650 LLVMMetadataRef Scope,
651 const char *Name, size_t NameLen,
652 LLVMMetadataRef File, unsigned LineNumber,
654 unsigned OffsetInBits,
655 unsigned StorageOffsetInBits,
656 LLVMDIFlags Flags, LLVMMetadataRef Type);
659 * Create debugging information entry for a class.
660 * \param Scope Scope in which this class is defined.
661 * \param Name class name.
662 * \param File File where this member is defined.
663 * \param LineNumber Line number.
664 * \param SizeInBits Member size.
665 * \param AlignInBits Member alignment.
666 * \param OffsetInBits Member offset.
667 * \param Flags Flags to encode member attribute, e.g. private
668 * \param Elements class members.
669 * \param NumElements Number of class elements.
670 * \param DerivedFrom Debug info of the base class of this type.
671 * \param TemplateParamsNode Template type parameters.
673 LLVMMetadataRef LLVMDIBuilderCreateClassType(LLVMDIBuilderRef Builder,
674 LLVMMetadataRef Scope, const char *Name, size_t NameLen,
675 LLVMMetadataRef File, unsigned LineNumber, unsigned SizeInBits,
676 unsigned AlignInBits, unsigned OffsetInBits, LLVMDIFlags Flags,
677 LLVMMetadataRef *Elements, unsigned NumElements,
678 LLVMMetadataRef DerivedFrom, LLVMMetadataRef TemplateParamsNode);
681 * Create a new DIType* with "artificial" flag set.
682 * \param Builder The DIBuilder.
683 * \param Type The underlying type.
686 LLVMDIBuilderCreateArtificialType(LLVMDIBuilderRef Builder,
687 LLVMMetadataRef Type);
690 * Create a descriptor for a value range.
691 * \param Builder The DIBuilder.
692 * \param LowerBound Lower bound of the subrange, e.g. 0 for C, 1 for Fortran.
693 * \param Count Count of elements in the subrange.
695 LLVMMetadataRef LLVMDIBuilderGetOrCreateSubrange(LLVMDIBuilderRef Builder,
700 * Create an array of DI Nodes.
701 * \param Builder The DIBuilder.
702 * \param Data The DI Node elements.
703 * \param NumElements Number of DI Node elements.
705 LLVMMetadataRef LLVMDIBuilderGetOrCreateArray(LLVMDIBuilderRef Builder,
706 LLVMMetadataRef *Data,
710 * Create a new descriptor for the specified variable which has a complex
711 * address expression for its address.
712 * \param Builder The DIBuilder.
713 * \param Addr An array of complex address operations.
714 * \param Length Length of the address operation array.
716 LLVMMetadataRef LLVMDIBuilderCreateExpression(LLVMDIBuilderRef Builder,
717 int64_t *Addr, size_t Length);
720 * Create a new descriptor for the specified variable that does not have an
721 * address, but does have a constant value.
722 * \param Builder The DIBuilder.
723 * \param Value The constant value.
726 LLVMDIBuilderCreateConstantValueExpression(LLVMDIBuilderRef Builder,
730 * Create a new descriptor for the specified variable.
731 * \param Scope Variable scope.
732 * \param Name Name of the variable.
733 * \param NameLen The length of the C string passed to \c Name.
734 * \param Linkage Mangled name of the variable.
735 * \param LinkLen The length of the C string passed to \c Linkage.
736 * \param File File where this variable is defined.
737 * \param LineNo Line number.
738 * \param Ty Variable Type.
739 * \param LocalToUnit Boolean flag indicate whether this variable is
740 * externally visible or not.
741 * \param Expr The location of the global relative to the attached
743 * \param Decl Reference to the corresponding declaration.
744 * \param AlignInBits Variable alignment(or 0 if no alignment attr was
748 LLVMDIBuilderCreateGlobalVariableExpression(LLVMDIBuilderRef Builder,
749 LLVMMetadataRef Scope,
750 const char *Name, size_t NameLen,
751 const char *Linkage, size_t LinkLen,
752 LLVMMetadataRef File,
755 LLVMBool LocalToUnit,
756 LLVMMetadataRef Expr,
757 LLVMMetadataRef Decl,
758 uint32_t AlignInBits);
761 * Create a new descriptor for the specified global variable that is temporary
762 * and meant to be RAUWed.
763 * \param Scope Variable scope.
764 * \param Name Name of the variable.
765 * \param NameLen The length of the C string passed to \c Name.
766 * \param Linkage Mangled name of the variable.
767 * \param LnkLen The length of the C string passed to \c Linkage.
768 * \param File File where this variable is defined.
769 * \param LineNo Line number.
770 * \param Ty Variable Type.
771 * \param LocalToUnit Boolean flag indicate whether this variable is
772 * externally visible or not.
773 * \param Expr The location of the global relative to the attached
775 * \param Decl Reference to the corresponding declaration.
776 * \param AlignInBits Variable alignment(or 0 if no alignment attr was
780 LLVMDIBuilderCreateTempGlobalVariableFwdDecl(LLVMDIBuilderRef Builder,
781 LLVMMetadataRef Scope,
782 const char *Name, size_t NameLen,
783 const char *Linkage, size_t LnkLen,
784 LLVMMetadataRef File,
787 LLVMBool LocalToUnit,
788 LLVMMetadataRef Decl,
789 uint32_t AlignInBits);
792 * Insert a new llvm.dbg.declare intrinsic call before the given instruction.
793 * \param Builder The DIBuilder.
794 * \param Storage The storage of the variable to declare.
795 * \param VarInfo The variable's debug info descriptor.
796 * \param Expr A complex location expression for the variable.
797 * \param DebugLoc Debug info location.
798 * \param Instr Instruction acting as a location for the new intrinsic.
800 LLVMValueRef LLVMDIBuilderInsertDeclareBefore(
801 LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
802 LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMValueRef Instr);
805 * Insert a new llvm.dbg.declare intrinsic call at the end of the given basic
806 * block. If the basic block has a terminator instruction, the intrinsic is
807 * inserted before that terminator instruction.
808 * \param Builder The DIBuilder.
809 * \param Storage The storage of the variable to declare.
810 * \param VarInfo The variable's debug info descriptor.
811 * \param Expr A complex location expression for the variable.
812 * \param DebugLoc Debug info location.
813 * \param Block Basic block acting as a location for the new intrinsic.
815 LLVMValueRef LLVMDIBuilderInsertDeclareAtEnd(
816 LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
817 LLVMMetadataRef Expr, LLVMMetadataRef DebugLoc, LLVMBasicBlockRef Block);
820 * Insert a new llvm.dbg.value intrinsic call before the given instruction.
821 * \param Builder The DIBuilder.
822 * \param Val The value of the variable.
823 * \param VarInfo The variable's debug info descriptor.
824 * \param Expr A complex location expression for the variable.
825 * \param DebugLoc Debug info location.
826 * \param Instr Instruction acting as a location for the new intrinsic.
828 LLVMValueRef LLVMDIBuilderInsertDbgValueBefore(LLVMDIBuilderRef Builder,
830 LLVMMetadataRef VarInfo,
831 LLVMMetadataRef Expr,
832 LLVMMetadataRef DebugLoc,
836 * Insert a new llvm.dbg.value intrinsic call at the end of the given basic
837 * block. If the basic block has a terminator instruction, the intrinsic is
838 * inserted before that terminator instruction.
839 * \param Builder The DIBuilder.
840 * \param Val The value of the variable.
841 * \param VarInfo The variable's debug info descriptor.
842 * \param Expr A complex location expression for the variable.
843 * \param DebugLoc Debug info location.
844 * \param Block Basic block acting as a location for the new intrinsic.
846 LLVMValueRef LLVMDIBuilderInsertDbgValueAtEnd(LLVMDIBuilderRef Builder,
848 LLVMMetadataRef VarInfo,
849 LLVMMetadataRef Expr,
850 LLVMMetadataRef DebugLoc,
851 LLVMBasicBlockRef Block);
854 * Create a new descriptor for a local auto variable.
855 * \param Builder The DIBuilder.
856 * \param Scope The local scope the variable is declared in.
857 * \param Name Variable name.
858 * \param NameLen Length of variable name.
859 * \param File File where this variable is defined.
860 * \param LineNo Line number.
861 * \param Ty Metadata describing the type of the variable.
862 * \param AlwaysPreserve If true, this descriptor will survive optimizations.
863 * \param Flags Flags.
864 * \param AlignInBits Variable alignment.
866 LLVMMetadataRef LLVMDIBuilderCreateAutoVariable(
867 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
868 size_t NameLen, LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Ty,
869 LLVMBool AlwaysPreserve, LLVMDIFlags Flags, uint32_t AlignInBits);
872 * Create a new descriptor for a function parameter variable.
873 * \param Builder The DIBuilder.
874 * \param Scope The local scope the variable is declared in.
875 * \param Name Variable name.
876 * \param NameLen Length of variable name.
877 * \param ArgNo Unique argument number for this variable; starts at 1.
878 * \param File File where this variable is defined.
879 * \param LineNo Line number.
880 * \param Ty Metadata describing the type of the variable.
881 * \param AlwaysPreserve If true, this descriptor will survive optimizations.
882 * \param Flags Flags.
884 LLVMMetadataRef LLVMDIBuilderCreateParameterVariable(
885 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
886 size_t NameLen, unsigned ArgNo, LLVMMetadataRef File, unsigned LineNo,
887 LLVMMetadataRef Ty, LLVMBool AlwaysPreserve, LLVMDIFlags Flags);
890 * Get the metadata of the subprogram attached to a function.
892 * @see llvm::Function::getSubprogram()
894 LLVMMetadataRef LLVMGetSubprogram(LLVMValueRef Func);
897 * Set the subprogram attached to a function.
899 * @see llvm::Function::setSubprogram()
901 void LLVMSetSubprogram(LLVMValueRef Func, LLVMMetadataRef SP);
904 } /* end extern "C" */