1 //===- DIBuilder.h - Debug Information Builder ------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines a DIBuilder that is useful for creating debugging
10 // information entries in LLVM IR form.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_IR_DIBUILDER_H
15 #define LLVM_IR_DIBUILDER_H
16 
17 #include "llvm/ADT/ArrayRef.h"
18 #include "llvm/ADT/DenseMap.h"
19 #include "llvm/ADT/MapVector.h"
20 #include "llvm/ADT/SetVector.h"
21 #include "llvm/ADT/SmallVector.h"
22 #include "llvm/ADT/StringRef.h"
23 #include "llvm/BinaryFormat/Dwarf.h"
24 #include "llvm/IR/DebugInfoMetadata.h"
25 #include "llvm/IR/TrackingMDRef.h"
26 #include "llvm/Support/Casting.h"
27 #include <algorithm>
28 #include <cstdint>
29 #include <optional>
30 
31 namespace llvm {
32 
33   class BasicBlock;
34   class Constant;
35   class Function;
36   class Instruction;
37   class LLVMContext;
38   class Module;
39   class Value;
40   class DbgAssignIntrinsic;
41 
42   class DIBuilder {
43     Module &M;
44     LLVMContext &VMContext;
45 
46     DICompileUnit *CUNode;   ///< The one compile unit created by this DIBuiler.
47     Function *DeclareFn;     ///< llvm.dbg.declare
48     Function *ValueFn;       ///< llvm.dbg.value
49     Function *LabelFn;       ///< llvm.dbg.label
50     Function *AssignFn;      ///< llvm.dbg.assign
51 
52     SmallVector<TrackingMDNodeRef, 4> AllEnumTypes;
53     /// Track the RetainTypes, since they can be updated later on.
54     SmallVector<TrackingMDNodeRef, 4> AllRetainTypes;
55     SmallVector<DISubprogram *, 4> AllSubprograms;
56     SmallVector<Metadata *, 4> AllGVs;
57     SmallVector<TrackingMDNodeRef, 4> ImportedModules;
58     /// Map Macro parent (which can be DIMacroFile or nullptr) to a list of
59     /// Metadata all of type DIMacroNode.
60     /// DIMacroNode's with nullptr parent are DICompileUnit direct children.
61     MapVector<MDNode *, SetVector<Metadata *>> AllMacrosPerParent;
62 
63     /// Track nodes that may be unresolved.
64     SmallVector<TrackingMDNodeRef, 4> UnresolvedNodes;
65     bool AllowUnresolvedNodes;
66 
67     /// Each subprogram's preserved local variables, labels and imported
68     /// entities.
69     ///
70     /// Do not use a std::vector.  Some versions of libc++ apparently copy
71     /// instead of move on grow operations, and TrackingMDRef is expensive to
72     /// copy.
73     DenseMap<DISubprogram *, SmallVector<TrackingMDNodeRef, 4>>
74         SubprogramTrackedNodes;
75 
76     SmallVectorImpl<TrackingMDNodeRef> &
77     getImportTrackingVector(const DIScope *S) {
78       return isa_and_nonnull<DILocalScope>(S)
79                  ? getSubprogramNodesTrackingVector(S)
80                  : ImportedModules;
81     }
82     SmallVectorImpl<TrackingMDNodeRef> &
83     getSubprogramNodesTrackingVector(const DIScope *S) {
84       return SubprogramTrackedNodes[cast<DILocalScope>(S)->getSubprogram()];
85     }
86 
87     /// Create a temporary.
88     ///
89     /// Create an \a temporary node and track it in \a UnresolvedNodes.
90     void trackIfUnresolved(MDNode *N);
91 
92     /// Internal helper for insertDeclare.
93     Instruction *insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo,
94                                DIExpression *Expr, const DILocation *DL,
95                                BasicBlock *InsertBB, Instruction *InsertBefore);
96 
97     /// Internal helper for insertLabel.
98     Instruction *insertLabel(DILabel *LabelInfo, const DILocation *DL,
99                              BasicBlock *InsertBB, Instruction *InsertBefore);
100 
101     /// Internal helper with common code used by insertDbg{Value,Addr}Intrinsic.
102     Instruction *insertDbgIntrinsic(llvm::Function *Intrinsic, llvm::Value *Val,
103                                     DILocalVariable *VarInfo,
104                                     DIExpression *Expr, const DILocation *DL,
105                                     BasicBlock *InsertBB,
106                                     Instruction *InsertBefore);
107 
108     /// Internal helper for insertDbgValueIntrinsic.
109     Instruction *
110     insertDbgValueIntrinsic(llvm::Value *Val, DILocalVariable *VarInfo,
111                             DIExpression *Expr, const DILocation *DL,
112                             BasicBlock *InsertBB, Instruction *InsertBefore);
113 
114   public:
115     /// Construct a builder for a module.
116     ///
117     /// If \c AllowUnresolved, collect unresolved nodes attached to the module
118     /// in order to resolve cycles during \a finalize().
119     ///
120     /// If \p CU is given a value other than nullptr, then set \p CUNode to CU.
121     explicit DIBuilder(Module &M, bool AllowUnresolved = true,
122                        DICompileUnit *CU = nullptr);
123     DIBuilder(const DIBuilder &) = delete;
124     DIBuilder &operator=(const DIBuilder &) = delete;
125 
126     /// Construct any deferred debug info descriptors.
127     void finalize();
128 
129     /// Finalize a specific subprogram - no new variables may be added to this
130     /// subprogram afterwards.
131     void finalizeSubprogram(DISubprogram *SP);
132 
133     /// A CompileUnit provides an anchor for all debugging
134     /// information generated during this instance of compilation.
135     /// \param Lang          Source programming language, eg. dwarf::DW_LANG_C99
136     /// \param File          File info.
137     /// \param Producer      Identify the producer of debugging information
138     ///                      and code.  Usually this is a compiler
139     ///                      version string.
140     /// \param isOptimized   A boolean flag which indicates whether optimization
141     ///                      is enabled or not.
142     /// \param Flags         This string lists command line options. This
143     ///                      string is directly embedded in debug info
144     ///                      output which may be used by a tool
145     ///                      analyzing generated debugging information.
146     /// \param RV            This indicates runtime version for languages like
147     ///                      Objective-C.
148     /// \param SplitName     The name of the file that we'll split debug info
149     ///                      out into.
150     /// \param Kind          The kind of debug information to generate.
151     /// \param DWOId         The DWOId if this is a split skeleton compile unit.
152     /// \param SplitDebugInlining    Whether to emit inline debug info.
153     /// \param DebugInfoForProfiling Whether to emit extra debug info for
154     ///                              profile collection.
155     /// \param NameTableKind  Whether to emit .debug_gnu_pubnames,
156     ///                      .debug_pubnames, or no pubnames at all.
157     /// \param SysRoot       The clang system root (value of -isysroot).
158     /// \param SDK           The SDK name. On Darwin, this is the last component
159     ///                      of the sysroot.
160     DICompileUnit *
161     createCompileUnit(unsigned Lang, DIFile *File, StringRef Producer,
162                       bool isOptimized, StringRef Flags, unsigned RV,
163                       StringRef SplitName = StringRef(),
164                       DICompileUnit::DebugEmissionKind Kind =
165                           DICompileUnit::DebugEmissionKind::FullDebug,
166                       uint64_t DWOId = 0, bool SplitDebugInlining = true,
167                       bool DebugInfoForProfiling = false,
168                       DICompileUnit::DebugNameTableKind NameTableKind =
169                           DICompileUnit::DebugNameTableKind::Default,
170                       bool RangesBaseAddress = false, StringRef SysRoot = {},
171                       StringRef SDK = {});
172 
173     /// Create a file descriptor to hold debugging information for a file.
174     /// \param Filename  File name.
175     /// \param Directory Directory.
176     /// \param Checksum  Optional checksum kind (e.g. CSK_MD5, CSK_SHA1, etc.)
177     ///                  and value.
178     /// \param Source    Optional source text.
179     DIFile *createFile(
180         StringRef Filename, StringRef Directory,
181         std::optional<DIFile::ChecksumInfo<StringRef>> Checksum = std::nullopt,
182         std::optional<StringRef> Source = std::nullopt);
183 
184     /// Create debugging information entry for a macro.
185     /// \param Parent     Macro parent (could be nullptr).
186     /// \param Line       Source line number where the macro is defined.
187     /// \param MacroType  DW_MACINFO_define or DW_MACINFO_undef.
188     /// \param Name       Macro name.
189     /// \param Value      Macro value.
190     DIMacro *createMacro(DIMacroFile *Parent, unsigned Line, unsigned MacroType,
191                          StringRef Name, StringRef Value = StringRef());
192 
193     /// Create debugging information temporary entry for a macro file.
194     /// List of macro node direct children will be calculated by DIBuilder,
195     /// using the \p Parent relationship.
196     /// \param Parent     Macro file parent (could be nullptr).
197     /// \param Line       Source line number where the macro file is included.
198     /// \param File       File descriptor containing the name of the macro file.
199     DIMacroFile *createTempMacroFile(DIMacroFile *Parent, unsigned Line,
200                                      DIFile *File);
201 
202     /// Create a single enumerator value.
203     DIEnumerator *createEnumerator(StringRef Name, const APSInt &Value);
204     DIEnumerator *createEnumerator(StringRef Name, uint64_t Val,
205                                    bool IsUnsigned = false);
206 
207     /// Create a DWARF unspecified type.
208     DIBasicType *createUnspecifiedType(StringRef Name);
209 
210     /// Create C++11 nullptr type.
211     DIBasicType *createNullPtrType();
212 
213     /// Create debugging information entry for a basic
214     /// type.
215     /// \param Name        Type name.
216     /// \param SizeInBits  Size of the type.
217     /// \param Encoding    DWARF encoding code, e.g., dwarf::DW_ATE_float.
218     /// \param Flags       Optional DWARF attributes, e.g., DW_AT_endianity.
219     DIBasicType *createBasicType(StringRef Name, uint64_t SizeInBits,
220                                  unsigned Encoding,
221                                  DINode::DIFlags Flags = DINode::FlagZero);
222 
223     /// Create debugging information entry for a string
224     /// type.
225     /// \param Name        Type name.
226     /// \param SizeInBits  Size of the type.
227     DIStringType *createStringType(StringRef Name, uint64_t SizeInBits);
228 
229     /// Create debugging information entry for Fortran
230     /// assumed length string type.
231     /// \param Name            Type name.
232     /// \param StringLength    String length expressed as DIVariable *.
233     /// \param StrLocationExp  Optional memory location of the string.
234     DIStringType *createStringType(StringRef Name, DIVariable *StringLength,
235                                    DIExpression *StrLocationExp = nullptr);
236 
237     /// Create debugging information entry for Fortran
238     /// assumed length string type.
239     /// \param Name             Type name.
240     /// \param StringLengthExp  String length expressed in DIExpression form.
241     /// \param StrLocationExp   Optional memory location of the string.
242     DIStringType *createStringType(StringRef Name,
243                                    DIExpression *StringLengthExp,
244                                    DIExpression *StrLocationExp = nullptr);
245 
246     /// Create debugging information entry for a qualified
247     /// type, e.g. 'const int'.
248     /// \param Tag         Tag identifing type, e.g. dwarf::TAG_volatile_type
249     /// \param FromTy      Base Type.
250     DIDerivedType *createQualifiedType(unsigned Tag, DIType *FromTy);
251 
252     /// Create debugging information entry for a pointer.
253     /// \param PointeeTy         Type pointed by this pointer.
254     /// \param SizeInBits        Size.
255     /// \param AlignInBits       Alignment. (optional)
256     /// \param DWARFAddressSpace DWARF address space. (optional)
257     /// \param Name              Pointer type name. (optional)
258     /// \param Annotations       Member annotations.
259     DIDerivedType *
260     createPointerType(DIType *PointeeTy, uint64_t SizeInBits,
261                       uint32_t AlignInBits = 0,
262                       std::optional<unsigned> DWARFAddressSpace = std::nullopt,
263                       StringRef Name = "", DINodeArray Annotations = nullptr);
264 
265     /// Create debugging information entry for a pointer to member.
266     /// \param PointeeTy Type pointed to by this pointer.
267     /// \param SizeInBits  Size.
268     /// \param AlignInBits Alignment. (optional)
269     /// \param Class Type for which this pointer points to members of.
270     DIDerivedType *
271     createMemberPointerType(DIType *PointeeTy, DIType *Class,
272                             uint64_t SizeInBits, uint32_t AlignInBits = 0,
273                             DINode::DIFlags Flags = DINode::FlagZero);
274 
275     /// Create debugging information entry for a c++
276     /// style reference or rvalue reference type.
277     DIDerivedType *createReferenceType(
278         unsigned Tag, DIType *RTy, uint64_t SizeInBits = 0,
279         uint32_t AlignInBits = 0,
280         std::optional<unsigned> DWARFAddressSpace = std::nullopt);
281 
282     /// Create debugging information entry for a typedef.
283     /// \param Ty          Original type.
284     /// \param Name        Typedef name.
285     /// \param File        File where this type is defined.
286     /// \param LineNo      Line number.
287     /// \param Context     The surrounding context for the typedef.
288     /// \param AlignInBits Alignment. (optional)
289     /// \param Flags       Flags to describe inheritance attribute, e.g. private
290     /// \param Annotations Annotations. (optional)
291     DIDerivedType *createTypedef(DIType *Ty, StringRef Name, DIFile *File,
292                                  unsigned LineNo, DIScope *Context,
293                                  uint32_t AlignInBits = 0,
294                                  DINode::DIFlags Flags = DINode::FlagZero,
295                                  DINodeArray Annotations = nullptr);
296 
297     /// Create debugging information entry for a 'friend'.
298     DIDerivedType *createFriend(DIType *Ty, DIType *FriendTy);
299 
300     /// Create debugging information entry to establish
301     /// inheritance relationship between two types.
302     /// \param Ty           Original type.
303     /// \param BaseTy       Base type. Ty is inherits from base.
304     /// \param BaseOffset   Base offset.
305     /// \param VBPtrOffset  Virtual base pointer offset.
306     /// \param Flags        Flags to describe inheritance attribute,
307     ///                     e.g. private
308     DIDerivedType *createInheritance(DIType *Ty, DIType *BaseTy,
309                                      uint64_t BaseOffset, uint32_t VBPtrOffset,
310                                      DINode::DIFlags Flags);
311 
312     /// Create debugging information entry for a member.
313     /// \param Scope        Member scope.
314     /// \param Name         Member name.
315     /// \param File         File where this member is defined.
316     /// \param LineNo       Line number.
317     /// \param SizeInBits   Member size.
318     /// \param AlignInBits  Member alignment.
319     /// \param OffsetInBits Member offset.
320     /// \param Flags        Flags to encode member attribute, e.g. private
321     /// \param Ty           Parent type.
322     /// \param Annotations  Member annotations.
323     DIDerivedType *createMemberType(DIScope *Scope, StringRef Name,
324                                     DIFile *File, unsigned LineNo,
325                                     uint64_t SizeInBits, uint32_t AlignInBits,
326                                     uint64_t OffsetInBits,
327                                     DINode::DIFlags Flags, DIType *Ty,
328                                     DINodeArray Annotations = nullptr);
329 
330     /// Create debugging information entry for a variant.  A variant
331     /// normally should be a member of a variant part.
332     /// \param Scope        Member scope.
333     /// \param Name         Member name.
334     /// \param File         File where this member is defined.
335     /// \param LineNo       Line number.
336     /// \param SizeInBits   Member size.
337     /// \param AlignInBits  Member alignment.
338     /// \param OffsetInBits Member offset.
339     /// \param Flags        Flags to encode member attribute, e.g. private
340     /// \param Discriminant The discriminant for this branch; null for
341     ///                     the default branch
342     /// \param Ty           Parent type.
343     DIDerivedType *createVariantMemberType(DIScope *Scope, StringRef Name,
344 					   DIFile *File, unsigned LineNo,
345 					   uint64_t SizeInBits,
346 					   uint32_t AlignInBits,
347 					   uint64_t OffsetInBits,
348 					   Constant *Discriminant,
349 					   DINode::DIFlags Flags, DIType *Ty);
350 
351     /// Create debugging information entry for a bit field member.
352     /// \param Scope               Member scope.
353     /// \param Name                Member name.
354     /// \param File                File where this member is defined.
355     /// \param LineNo              Line number.
356     /// \param SizeInBits          Member size.
357     /// \param OffsetInBits        Member offset.
358     /// \param StorageOffsetInBits Member storage offset.
359     /// \param Flags               Flags to encode member attribute.
360     /// \param Ty                  Parent type.
361     /// \param Annotations         Member annotations.
362     DIDerivedType *createBitFieldMemberType(DIScope *Scope, StringRef Name,
363                                             DIFile *File, unsigned LineNo,
364                                             uint64_t SizeInBits,
365                                             uint64_t OffsetInBits,
366                                             uint64_t StorageOffsetInBits,
367                                             DINode::DIFlags Flags, DIType *Ty,
368                                             DINodeArray Annotations = nullptr);
369 
370     /// Create debugging information entry for a
371     /// C++ static data member.
372     /// \param Scope      Member scope.
373     /// \param Name       Member name.
374     /// \param File       File where this member is declared.
375     /// \param LineNo     Line number.
376     /// \param Ty         Type of the static member.
377     /// \param Flags      Flags to encode member attribute, e.g. private.
378     /// \param Val        Const initializer of the member.
379     /// \param AlignInBits  Member alignment.
380     DIDerivedType *createStaticMemberType(DIScope *Scope, StringRef Name,
381                                           DIFile *File, unsigned LineNo,
382                                           DIType *Ty, DINode::DIFlags Flags,
383                                           Constant *Val,
384                                           uint32_t AlignInBits = 0);
385 
386     /// Create debugging information entry for Objective-C
387     /// instance variable.
388     /// \param Name         Member name.
389     /// \param File         File where this member is defined.
390     /// \param LineNo       Line number.
391     /// \param SizeInBits   Member size.
392     /// \param AlignInBits  Member alignment.
393     /// \param OffsetInBits Member offset.
394     /// \param Flags        Flags to encode member attribute, e.g. private
395     /// \param Ty           Parent type.
396     /// \param PropertyNode Property associated with this ivar.
397     DIDerivedType *createObjCIVar(StringRef Name, DIFile *File, unsigned LineNo,
398                                   uint64_t SizeInBits, uint32_t AlignInBits,
399                                   uint64_t OffsetInBits, DINode::DIFlags Flags,
400                                   DIType *Ty, MDNode *PropertyNode);
401 
402     /// Create debugging information entry for Objective-C
403     /// property.
404     /// \param Name         Property name.
405     /// \param File         File where this property is defined.
406     /// \param LineNumber   Line number.
407     /// \param GetterName   Name of the Objective C property getter selector.
408     /// \param SetterName   Name of the Objective C property setter selector.
409     /// \param PropertyAttributes Objective C property attributes.
410     /// \param Ty           Type.
411     DIObjCProperty *createObjCProperty(StringRef Name, DIFile *File,
412                                        unsigned LineNumber,
413                                        StringRef GetterName,
414                                        StringRef SetterName,
415                                        unsigned PropertyAttributes, DIType *Ty);
416 
417     /// Create debugging information entry for a class.
418     /// \param Scope        Scope in which this class is defined.
419     /// \param Name         class name.
420     /// \param File         File where this member is defined.
421     /// \param LineNumber   Line number.
422     /// \param SizeInBits   Member size.
423     /// \param AlignInBits  Member alignment.
424     /// \param OffsetInBits Member offset.
425     /// \param Flags        Flags to encode member attribute, e.g. private
426     /// \param Elements     class members.
427     /// \param VTableHolder Debug info of the base class that contains vtable
428     ///                     for this type. This is used in
429     ///                     DW_AT_containing_type. See DWARF documentation
430     ///                     for more info.
431     /// \param TemplateParms Template type parameters.
432     /// \param UniqueIdentifier A unique identifier for the class.
433     DICompositeType *createClassType(
434         DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
435         uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
436         DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements,
437         DIType *VTableHolder = nullptr, MDNode *TemplateParms = nullptr,
438         StringRef UniqueIdentifier = "");
439 
440     /// Create debugging information entry for a struct.
441     /// \param Scope        Scope in which this struct is defined.
442     /// \param Name         Struct name.
443     /// \param File         File where this member is defined.
444     /// \param LineNumber   Line number.
445     /// \param SizeInBits   Member size.
446     /// \param AlignInBits  Member alignment.
447     /// \param Flags        Flags to encode member attribute, e.g. private
448     /// \param Elements     Struct elements.
449     /// \param RunTimeLang  Optional parameter, Objective-C runtime version.
450     /// \param UniqueIdentifier A unique identifier for the struct.
451     DICompositeType *createStructType(
452         DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
453         uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags,
454         DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang = 0,
455         DIType *VTableHolder = nullptr, StringRef UniqueIdentifier = "");
456 
457     /// Create debugging information entry for an union.
458     /// \param Scope        Scope in which this union is defined.
459     /// \param Name         Union name.
460     /// \param File         File where this member is defined.
461     /// \param LineNumber   Line number.
462     /// \param SizeInBits   Member size.
463     /// \param AlignInBits  Member alignment.
464     /// \param Flags        Flags to encode member attribute, e.g. private
465     /// \param Elements     Union elements.
466     /// \param RunTimeLang  Optional parameter, Objective-C runtime version.
467     /// \param UniqueIdentifier A unique identifier for the union.
468     DICompositeType *createUnionType(DIScope *Scope, StringRef Name,
469                                      DIFile *File, unsigned LineNumber,
470                                      uint64_t SizeInBits, uint32_t AlignInBits,
471                                      DINode::DIFlags Flags,
472                                      DINodeArray Elements,
473                                      unsigned RunTimeLang = 0,
474                                      StringRef UniqueIdentifier = "");
475 
476     /// Create debugging information entry for a variant part.  A
477     /// variant part normally has a discriminator (though this is not
478     /// required) and a number of variant children.
479     /// \param Scope        Scope in which this union is defined.
480     /// \param Name         Union name.
481     /// \param File         File where this member is defined.
482     /// \param LineNumber   Line number.
483     /// \param SizeInBits   Member size.
484     /// \param AlignInBits  Member alignment.
485     /// \param Flags        Flags to encode member attribute, e.g. private
486     /// \param Discriminator Discriminant member
487     /// \param Elements     Variant elements.
488     /// \param UniqueIdentifier A unique identifier for the union.
489     DICompositeType *createVariantPart(DIScope *Scope, StringRef Name,
490 				       DIFile *File, unsigned LineNumber,
491 				       uint64_t SizeInBits, uint32_t AlignInBits,
492 				       DINode::DIFlags Flags,
493 				       DIDerivedType *Discriminator,
494 				       DINodeArray Elements,
495 				       StringRef UniqueIdentifier = "");
496 
497     /// Create debugging information for template
498     /// type parameter.
499     /// \param Scope        Scope in which this type is defined.
500     /// \param Name         Type parameter name.
501     /// \param Ty           Parameter type.
502     /// \param IsDefault    Parameter is default or not
503     DITemplateTypeParameter *createTemplateTypeParameter(DIScope *Scope,
504                                                          StringRef Name,
505                                                          DIType *Ty,
506                                                          bool IsDefault);
507 
508     /// Create debugging information for template
509     /// value parameter.
510     /// \param Scope        Scope in which this type is defined.
511     /// \param Name         Value parameter name.
512     /// \param Ty           Parameter type.
513     /// \param IsDefault    Parameter is default or not
514     /// \param Val          Constant parameter value.
515     DITemplateValueParameter *
516     createTemplateValueParameter(DIScope *Scope, StringRef Name, DIType *Ty,
517                                  bool IsDefault, Constant *Val);
518 
519     /// Create debugging information for a template template parameter.
520     /// \param Scope        Scope in which this type is defined.
521     /// \param Name         Value parameter name.
522     /// \param Ty           Parameter type.
523     /// \param Val          The fully qualified name of the template.
524     /// \param IsDefault    Parameter is default or not.
525     DITemplateValueParameter *
526     createTemplateTemplateParameter(DIScope *Scope, StringRef Name, DIType *Ty,
527                                     StringRef Val, bool IsDefault = false);
528 
529     /// Create debugging information for a template parameter pack.
530     /// \param Scope        Scope in which this type is defined.
531     /// \param Name         Value parameter name.
532     /// \param Ty           Parameter type.
533     /// \param Val          An array of types in the pack.
534     DITemplateValueParameter *createTemplateParameterPack(DIScope *Scope,
535                                                           StringRef Name,
536                                                           DIType *Ty,
537                                                           DINodeArray Val);
538 
539     /// Create debugging information entry for an array.
540     /// \param Size         Array size.
541     /// \param AlignInBits  Alignment.
542     /// \param Ty           Element type.
543     /// \param Subscripts   Subscripts.
544     /// \param DataLocation The location of the raw data of a descriptor-based
545     ///                     Fortran array, either a DIExpression* or
546     ///                     a DIVariable*.
547     /// \param Associated   The associated attribute of a descriptor-based
548     ///                     Fortran array, either a DIExpression* or
549     ///                     a DIVariable*.
550     /// \param Allocated    The allocated attribute of a descriptor-based
551     ///                     Fortran array, either a DIExpression* or
552     ///                     a DIVariable*.
553     /// \param Rank         The rank attribute of a descriptor-based
554     ///                     Fortran array, either a DIExpression* or
555     ///                     a DIVariable*.
556     DICompositeType *createArrayType(
557         uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts,
558         PointerUnion<DIExpression *, DIVariable *> DataLocation = nullptr,
559         PointerUnion<DIExpression *, DIVariable *> Associated = nullptr,
560         PointerUnion<DIExpression *, DIVariable *> Allocated = nullptr,
561         PointerUnion<DIExpression *, DIVariable *> Rank = nullptr);
562 
563     /// Create debugging information entry for a vector type.
564     /// \param Size         Array size.
565     /// \param AlignInBits  Alignment.
566     /// \param Ty           Element type.
567     /// \param Subscripts   Subscripts.
568     DICompositeType *createVectorType(uint64_t Size, uint32_t AlignInBits,
569                                       DIType *Ty, DINodeArray Subscripts);
570 
571     /// Create debugging information entry for an
572     /// enumeration.
573     /// \param Scope          Scope in which this enumeration is defined.
574     /// \param Name           Union name.
575     /// \param File           File where this member is defined.
576     /// \param LineNumber     Line number.
577     /// \param SizeInBits     Member size.
578     /// \param AlignInBits    Member alignment.
579     /// \param Elements       Enumeration elements.
580     /// \param UnderlyingType Underlying type of a C++11/ObjC fixed enum.
581     /// \param UniqueIdentifier A unique identifier for the enum.
582     /// \param IsScoped Boolean flag indicate if this is C++11/ObjC 'enum class'.
583     DICompositeType *createEnumerationType(
584         DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
585         uint64_t SizeInBits, uint32_t AlignInBits, DINodeArray Elements,
586         DIType *UnderlyingType, StringRef UniqueIdentifier = "", bool IsScoped = false);
587 
588     /// Create debugging information entry for a set.
589     /// \param Scope          Scope in which this set is defined.
590     /// \param Name           Set name.
591     /// \param File           File where this set is defined.
592     /// \param LineNo         Line number.
593     /// \param SizeInBits     Set size.
594     /// \param AlignInBits    Set alignment.
595     /// \param Ty             Base type of the set.
596     DIDerivedType *createSetType(DIScope *Scope, StringRef Name, DIFile *File,
597                                  unsigned LineNo, uint64_t SizeInBits,
598                                  uint32_t AlignInBits, DIType *Ty);
599 
600     /// Create subroutine type.
601     /// \param ParameterTypes  An array of subroutine parameter types. This
602     ///                        includes return type at 0th index.
603     /// \param Flags           E.g.: LValueReference.
604     ///                        These flags are used to emit dwarf attributes.
605     /// \param CC              Calling convention, e.g. dwarf::DW_CC_normal
606     DISubroutineType *
607     createSubroutineType(DITypeRefArray ParameterTypes,
608                          DINode::DIFlags Flags = DINode::FlagZero,
609                          unsigned CC = 0);
610 
611     /// Create a distinct clone of \p SP with FlagArtificial set.
612     static DISubprogram *createArtificialSubprogram(DISubprogram *SP);
613 
614     /// Create a uniqued clone of \p Ty with FlagArtificial set.
615     static DIType *createArtificialType(DIType *Ty);
616 
617     /// Create a uniqued clone of \p Ty with FlagObjectPointer and
618     /// FlagArtificial set.
619     static DIType *createObjectPointerType(DIType *Ty);
620 
621     /// Create a permanent forward-declared type.
622     DICompositeType *createForwardDecl(unsigned Tag, StringRef Name,
623                                        DIScope *Scope, DIFile *F, unsigned Line,
624                                        unsigned RuntimeLang = 0,
625                                        uint64_t SizeInBits = 0,
626                                        uint32_t AlignInBits = 0,
627                                        StringRef UniqueIdentifier = "");
628 
629     /// Create a temporary forward-declared type.
630     DICompositeType *createReplaceableCompositeType(
631         unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line,
632         unsigned RuntimeLang = 0, uint64_t SizeInBits = 0,
633         uint32_t AlignInBits = 0, DINode::DIFlags Flags = DINode::FlagFwdDecl,
634         StringRef UniqueIdentifier = "", DINodeArray Annotations = nullptr);
635 
636     /// Retain DIScope* in a module even if it is not referenced
637     /// through debug info anchors.
638     void retainType(DIScope *T);
639 
640     /// Create unspecified parameter type
641     /// for a subroutine type.
642     DIBasicType *createUnspecifiedParameter();
643 
644     /// Get a DINodeArray, create one if required.
645     DINodeArray getOrCreateArray(ArrayRef<Metadata *> Elements);
646 
647     /// Get a DIMacroNodeArray, create one if required.
648     DIMacroNodeArray getOrCreateMacroArray(ArrayRef<Metadata *> Elements);
649 
650     /// Get a DITypeRefArray, create one if required.
651     DITypeRefArray getOrCreateTypeArray(ArrayRef<Metadata *> Elements);
652 
653     /// Create a descriptor for a value range.  This
654     /// implicitly uniques the values returned.
655     DISubrange *getOrCreateSubrange(int64_t Lo, int64_t Count);
656     DISubrange *getOrCreateSubrange(int64_t Lo, Metadata *CountNode);
657     DISubrange *getOrCreateSubrange(Metadata *Count, Metadata *LowerBound,
658                                     Metadata *UpperBound, Metadata *Stride);
659 
660     DIGenericSubrange *
661     getOrCreateGenericSubrange(DIGenericSubrange::BoundType Count,
662                                DIGenericSubrange::BoundType LowerBound,
663                                DIGenericSubrange::BoundType UpperBound,
664                                DIGenericSubrange::BoundType Stride);
665 
666     /// Create a new descriptor for the specified variable.
667     /// \param Context     Variable scope.
668     /// \param Name        Name of the variable.
669     /// \param LinkageName Mangled  name of the variable.
670     /// \param File        File where this variable is defined.
671     /// \param LineNo      Line number.
672     /// \param Ty          Variable Type.
673     /// \param IsLocalToUnit Boolean flag indicate whether this variable is
674     ///                      externally visible or not.
675     /// \param Expr        The location of the global relative to the attached
676     ///                    GlobalVariable.
677     /// \param Decl        Reference to the corresponding declaration.
678     /// \param AlignInBits Variable alignment(or 0 if no alignment attr was
679     ///                    specified)
680     DIGlobalVariableExpression *createGlobalVariableExpression(
681         DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
682         unsigned LineNo, DIType *Ty, bool IsLocalToUnit, bool isDefined = true,
683         DIExpression *Expr = nullptr, MDNode *Decl = nullptr,
684         MDTuple *TemplateParams = nullptr, uint32_t AlignInBits = 0,
685         DINodeArray Annotations = nullptr);
686 
687     /// Identical to createGlobalVariable
688     /// except that the resulting DbgNode is temporary and meant to be RAUWed.
689     DIGlobalVariable *createTempGlobalVariableFwdDecl(
690         DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
691         unsigned LineNo, DIType *Ty, bool IsLocalToUnit, MDNode *Decl = nullptr,
692         MDTuple *TemplateParams = nullptr, uint32_t AlignInBits = 0);
693 
694     /// Create a new descriptor for an auto variable.  This is a local variable
695     /// that is not a subprogram parameter.
696     ///
697     /// \c Scope must be a \a DILocalScope, and thus its scope chain eventually
698     /// leads to a \a DISubprogram.
699     ///
700     /// If \c AlwaysPreserve, this variable will be referenced from its
701     /// containing subprogram, and will survive some optimizations.
702     DILocalVariable *
703     createAutoVariable(DIScope *Scope, StringRef Name, DIFile *File,
704                        unsigned LineNo, DIType *Ty, bool AlwaysPreserve = false,
705                        DINode::DIFlags Flags = DINode::FlagZero,
706                        uint32_t AlignInBits = 0);
707 
708     /// Create a new descriptor for an label.
709     ///
710     /// \c Scope must be a \a DILocalScope, and thus its scope chain eventually
711     /// leads to a \a DISubprogram.
712     DILabel *
713     createLabel(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo,
714                 bool AlwaysPreserve = false);
715 
716     /// Create a new descriptor for a parameter variable.
717     ///
718     /// \c Scope must be a \a DILocalScope, and thus its scope chain eventually
719     /// leads to a \a DISubprogram.
720     ///
721     /// \c ArgNo is the index (starting from \c 1) of this variable in the
722     /// subprogram parameters.  \c ArgNo should not conflict with other
723     /// parameters of the same subprogram.
724     ///
725     /// If \c AlwaysPreserve, this variable will be referenced from its
726     /// containing subprogram, and will survive some optimizations.
727     DILocalVariable *
728     createParameterVariable(DIScope *Scope, StringRef Name, unsigned ArgNo,
729                             DIFile *File, unsigned LineNo, DIType *Ty,
730                             bool AlwaysPreserve = false,
731                             DINode::DIFlags Flags = DINode::FlagZero,
732                             DINodeArray Annotations = nullptr);
733 
734     /// Create a new descriptor for the specified
735     /// variable which has a complex address expression for its address.
736     /// \param Addr        An array of complex address operations.
737     DIExpression *createExpression(ArrayRef<uint64_t> Addr = std::nullopt);
738 
739     /// Create an expression for a variable that does not have an address, but
740     /// does have a constant value.
741     DIExpression *createConstantValueExpression(uint64_t Val) {
742       return DIExpression::get(
743           VMContext, {dwarf::DW_OP_constu, Val, dwarf::DW_OP_stack_value});
744     }
745 
746     /// Create a new descriptor for the specified subprogram.
747     /// See comments in DISubprogram* for descriptions of these fields.
748     /// \param Scope         Function scope.
749     /// \param Name          Function name.
750     /// \param LinkageName   Mangled function name.
751     /// \param File          File where this variable is defined.
752     /// \param LineNo        Line number.
753     /// \param Ty            Function type.
754     /// \param ScopeLine     Set to the beginning of the scope this starts
755     /// \param Flags         e.g. is this function prototyped or not.
756     ///                      These flags are used to emit dwarf attributes.
757     /// \param SPFlags       Additional flags specific to subprograms.
758     /// \param TParams       Function template parameters.
759     /// \param ThrownTypes   Exception types this function may throw.
760     /// \param Annotations   Attribute Annotations.
761     /// \param TargetFuncName The name of the target function if this is
762     ///                       a trampoline.
763     DISubprogram *
764     createFunction(DIScope *Scope, StringRef Name, StringRef LinkageName,
765                    DIFile *File, unsigned LineNo, DISubroutineType *Ty,
766                    unsigned ScopeLine, DINode::DIFlags Flags = DINode::FlagZero,
767                    DISubprogram::DISPFlags SPFlags = DISubprogram::SPFlagZero,
768                    DITemplateParameterArray TParams = nullptr,
769                    DISubprogram *Decl = nullptr,
770                    DITypeArray ThrownTypes = nullptr,
771                    DINodeArray Annotations = nullptr,
772                    StringRef TargetFuncName = "");
773 
774     /// Identical to createFunction,
775     /// except that the resulting DbgNode is meant to be RAUWed.
776     DISubprogram *createTempFunctionFwdDecl(
777         DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File,
778         unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine,
779         DINode::DIFlags Flags = DINode::FlagZero,
780         DISubprogram::DISPFlags SPFlags = DISubprogram::SPFlagZero,
781         DITemplateParameterArray TParams = nullptr,
782         DISubprogram *Decl = nullptr, DITypeArray ThrownTypes = nullptr);
783 
784     /// Create a new descriptor for the specified C++ method.
785     /// See comments in \a DISubprogram* for descriptions of these fields.
786     /// \param Scope         Function scope.
787     /// \param Name          Function name.
788     /// \param LinkageName   Mangled function name.
789     /// \param File          File where this variable is defined.
790     /// \param LineNo        Line number.
791     /// \param Ty            Function type.
792     /// \param VTableIndex   Index no of this method in virtual table, or -1u if
793     ///                      unrepresentable.
794     /// \param ThisAdjustment
795     ///                      MS ABI-specific adjustment of 'this' that occurs
796     ///                      in the prologue.
797     /// \param VTableHolder  Type that holds vtable.
798     /// \param Flags         e.g. is this function prototyped or not.
799     ///                      This flags are used to emit dwarf attributes.
800     /// \param SPFlags       Additional flags specific to subprograms.
801     /// \param TParams       Function template parameters.
802     /// \param ThrownTypes   Exception types this function may throw.
803     DISubprogram *
804     createMethod(DIScope *Scope, StringRef Name, StringRef LinkageName,
805                  DIFile *File, unsigned LineNo, DISubroutineType *Ty,
806                  unsigned VTableIndex = 0, int ThisAdjustment = 0,
807                  DIType *VTableHolder = nullptr,
808                  DINode::DIFlags Flags = DINode::FlagZero,
809                  DISubprogram::DISPFlags SPFlags = DISubprogram::SPFlagZero,
810                  DITemplateParameterArray TParams = nullptr,
811                  DITypeArray ThrownTypes = nullptr);
812 
813     /// Create common block entry for a Fortran common block.
814     /// \param Scope       Scope of this common block.
815     /// \param decl        Global variable declaration.
816     /// \param Name        The name of this common block.
817     /// \param File        The file this common block is defined.
818     /// \param LineNo      Line number.
819     DICommonBlock *createCommonBlock(DIScope *Scope, DIGlobalVariable *decl,
820                                      StringRef Name, DIFile *File,
821                                      unsigned LineNo);
822 
823     /// This creates new descriptor for a namespace with the specified
824     /// parent scope.
825     /// \param Scope       Namespace scope
826     /// \param Name        Name of this namespace
827     /// \param ExportSymbols True for C++ inline namespaces.
828     DINamespace *createNameSpace(DIScope *Scope, StringRef Name,
829                                  bool ExportSymbols);
830 
831     /// This creates new descriptor for a module with the specified
832     /// parent scope.
833     /// \param Scope       Parent scope
834     /// \param Name        Name of this module
835     /// \param ConfigurationMacros
836     ///                    A space-separated shell-quoted list of -D macro
837     ///                    definitions as they would appear on a command line.
838     /// \param IncludePath The path to the module map file.
839     /// \param APINotesFile The path to an API notes file for this module.
840     /// \param File        Source file of the module.
841     ///                    Used for Fortran modules.
842     /// \param LineNo      Source line number of the module.
843     ///                    Used for Fortran modules.
844     /// \param IsDecl      This is a module declaration; default to false;
845     ///                    when set to true, only Scope and Name are required
846     ///                    as this entry is just a hint for the debugger to find
847     ///                    the corresponding definition in the global scope.
848     DIModule *createModule(DIScope *Scope, StringRef Name,
849                            StringRef ConfigurationMacros, StringRef IncludePath,
850                            StringRef APINotesFile = {}, DIFile *File = nullptr,
851                            unsigned LineNo = 0, bool IsDecl = false);
852 
853     /// This creates a descriptor for a lexical block with a new file
854     /// attached. This merely extends the existing
855     /// lexical block as it crosses a file.
856     /// \param Scope       Lexical block.
857     /// \param File        Source file.
858     /// \param Discriminator DWARF path discriminator value.
859     DILexicalBlockFile *createLexicalBlockFile(DIScope *Scope, DIFile *File,
860                                                unsigned Discriminator = 0);
861 
862     /// This creates a descriptor for a lexical block with the
863     /// specified parent context.
864     /// \param Scope         Parent lexical scope.
865     /// \param File          Source file.
866     /// \param Line          Line number.
867     /// \param Col           Column number.
868     DILexicalBlock *createLexicalBlock(DIScope *Scope, DIFile *File,
869                                        unsigned Line, unsigned Col);
870 
871     /// Create a descriptor for an imported module.
872     /// \param Context        The scope this module is imported into
873     /// \param NS             The namespace being imported here.
874     /// \param File           File where the declaration is located.
875     /// \param Line           Line number of the declaration.
876     /// \param Elements       Renamed elements.
877     DIImportedEntity *createImportedModule(DIScope *Context, DINamespace *NS,
878                                            DIFile *File, unsigned Line,
879                                            DINodeArray Elements = nullptr);
880 
881     /// Create a descriptor for an imported module.
882     /// \param Context The scope this module is imported into.
883     /// \param NS      An aliased namespace.
884     /// \param File    File where the declaration is located.
885     /// \param Line    Line number of the declaration.
886     /// \param Elements       Renamed elements.
887     DIImportedEntity *createImportedModule(DIScope *Context,
888                                            DIImportedEntity *NS, DIFile *File,
889                                            unsigned Line,
890                                            DINodeArray Elements = nullptr);
891 
892     /// Create a descriptor for an imported module.
893     /// \param Context        The scope this module is imported into.
894     /// \param M              The module being imported here
895     /// \param File           File where the declaration is located.
896     /// \param Line           Line number of the declaration.
897     /// \param Elements       Renamed elements.
898     DIImportedEntity *createImportedModule(DIScope *Context, DIModule *M,
899                                            DIFile *File, unsigned Line,
900                                            DINodeArray Elements = nullptr);
901 
902     /// Create a descriptor for an imported function.
903     /// \param Context The scope this module is imported into.
904     /// \param Decl    The declaration (or definition) of a function, type, or
905     ///                variable.
906     /// \param File    File where the declaration is located.
907     /// \param Line    Line number of the declaration.
908     /// \param Elements       Renamed elements.
909     DIImportedEntity *createImportedDeclaration(DIScope *Context, DINode *Decl,
910                                                 DIFile *File, unsigned Line,
911                                                 StringRef Name = "",
912                                                 DINodeArray Elements = nullptr);
913 
914     /// Insert a new llvm.dbg.declare intrinsic call.
915     /// \param Storage     llvm::Value of the variable
916     /// \param VarInfo     Variable's debug info descriptor.
917     /// \param Expr        A complex location expression.
918     /// \param DL          Debug info location.
919     /// \param InsertAtEnd Location for the new intrinsic.
920     Instruction *insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo,
921                                DIExpression *Expr, const DILocation *DL,
922                                BasicBlock *InsertAtEnd);
923 
924     /// Insert a new llvm.dbg.assign intrinsic call.
925     /// \param LinkedInstr   Instruction with a DIAssignID to link with the new
926     ///                      intrinsic. The intrinsic will be inserted after
927     ///                      this instruction.
928     /// \param Val           The value component of this dbg.assign.
929     /// \param SrcVar        Variable's debug info descriptor.
930     /// \param ValExpr       A complex location expression to modify \p Val.
931     /// \param Addr          The address component (store destination).
932     /// \param AddrExpr      A complex location expression to modify \p Addr.
933     ///                      NOTE: \p ValExpr carries the FragInfo for the
934     ///                      variable.
935     /// \param DL            Debug info location, usually: (line: 0,
936     ///                      column: 0, scope: var-decl-scope). See
937     ///                      getDebugValueLoc.
938     DbgAssignIntrinsic *insertDbgAssign(Instruction *LinkedInstr, Value *Val,
939                                         DILocalVariable *SrcVar,
940                                         DIExpression *ValExpr, Value *Addr,
941                                         DIExpression *AddrExpr,
942                                         const DILocation *DL);
943 
944     /// Insert a new llvm.dbg.declare intrinsic call.
945     /// \param Storage      llvm::Value of the variable
946     /// \param VarInfo      Variable's debug info descriptor.
947     /// \param Expr         A complex location expression.
948     /// \param DL           Debug info location.
949     /// \param InsertBefore Location for the new intrinsic.
950     Instruction *insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo,
951                                DIExpression *Expr, const DILocation *DL,
952                                Instruction *InsertBefore);
953 
954     /// Insert a new llvm.dbg.label intrinsic call.
955     /// \param LabelInfo    Label's debug info descriptor.
956     /// \param DL           Debug info location.
957     /// \param InsertBefore Location for the new intrinsic.
958     Instruction *insertLabel(DILabel *LabelInfo, const DILocation *DL,
959                              Instruction *InsertBefore);
960 
961     /// Insert a new llvm.dbg.label intrinsic call.
962     /// \param LabelInfo    Label's debug info descriptor.
963     /// \param DL           Debug info location.
964     /// \param InsertAtEnd Location for the new intrinsic.
965     Instruction *insertLabel(DILabel *LabelInfo, const DILocation *DL,
966                              BasicBlock *InsertAtEnd);
967 
968     /// Insert a new llvm.dbg.value intrinsic call.
969     /// \param Val          llvm::Value of the variable
970     /// \param VarInfo      Variable's debug info descriptor.
971     /// \param Expr         A complex location expression.
972     /// \param DL           Debug info location.
973     /// \param InsertAtEnd Location for the new intrinsic.
974     Instruction *insertDbgValueIntrinsic(llvm::Value *Val,
975                                          DILocalVariable *VarInfo,
976                                          DIExpression *Expr,
977                                          const DILocation *DL,
978                                          BasicBlock *InsertAtEnd);
979 
980     /// Insert a new llvm.dbg.value intrinsic call.
981     /// \param Val          llvm::Value of the variable
982     /// \param VarInfo      Variable's debug info descriptor.
983     /// \param Expr         A complex location expression.
984     /// \param DL           Debug info location.
985     /// \param InsertBefore Location for the new intrinsic.
986     Instruction *insertDbgValueIntrinsic(llvm::Value *Val,
987                                          DILocalVariable *VarInfo,
988                                          DIExpression *Expr,
989                                          const DILocation *DL,
990                                          Instruction *InsertBefore);
991 
992     /// Replace the vtable holder in the given type.
993     ///
994     /// If this creates a self reference, it may orphan some unresolved cycles
995     /// in the operands of \c T, so \a DIBuilder needs to track that.
996     void replaceVTableHolder(DICompositeType *&T,
997                              DIType *VTableHolder);
998 
999     /// Replace arrays on a composite type.
1000     ///
1001     /// If \c T is resolved, but the arrays aren't -- which can happen if \c T
1002     /// has a self-reference -- \a DIBuilder needs to track the array to
1003     /// resolve cycles.
1004     void replaceArrays(DICompositeType *&T, DINodeArray Elements,
1005                        DINodeArray TParams = DINodeArray());
1006 
1007     /// Replace a temporary node.
1008     ///
1009     /// Call \a MDNode::replaceAllUsesWith() on \c N, replacing it with \c
1010     /// Replacement.
1011     ///
1012     /// If \c Replacement is the same as \c N.get(), instead call \a
1013     /// MDNode::replaceWithUniqued().  In this case, the uniqued node could
1014     /// have a different address, so we return the final address.
1015     template <class NodeTy>
1016     NodeTy *replaceTemporary(TempMDNode &&N, NodeTy *Replacement) {
1017       if (N.get() == Replacement)
1018         return cast<NodeTy>(MDNode::replaceWithUniqued(std::move(N)));
1019 
1020       N->replaceAllUsesWith(Replacement);
1021       return Replacement;
1022     }
1023   };
1024 
1025   // Create wrappers for C Binding types (see CBindingWrapping.h).
1026   DEFINE_ISA_CONVERSION_FUNCTIONS(DIBuilder, LLVMDIBuilderRef)
1027 
1028 } // end namespace llvm
1029 
1030 #endif // LLVM_IR_DIBUILDER_H
1031