LLVM 24.0.0git
DIBuilder.h
Go to the documentation of this file.
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"
22#include "llvm/ADT/StringRef.h"
28#include <algorithm>
29#include <cstdint>
30#include <optional>
31
32namespace llvm {
33
34 class BasicBlock;
35 class Constant;
36 class Function;
37 class Instruction;
38 class LLVMContext;
39 class Module;
40 class Value;
41 class DbgRecord;
42
43 class DIBuilder {
44 Module &M;
45 LLVMContext &VMContext;
46
47 DICompileUnit *CUNode; ///< The one compile unit created by this DIBuiler.
48
50 /// Track the RetainTypes, since they can be updated later on.
52 SmallVector<DISubprogram *, 4> AllSubprograms;
55 /// Map Macro parent (which can be DIMacroFile or nullptr) to a list of
56 /// Metadata all of type DIMacroNode.
57 /// DIMacroNode's with nullptr parent are DICompileUnit direct children.
59
60 /// Track nodes that may be unresolved.
62 bool AllowUnresolvedNodes;
63
64 /// Each subprogram's preserved local and static local variables, labels,
65 /// imported entities, and types.
66 ///
67 /// Do not use a std::vector. Some versions of libc++ apparently copy
68 /// instead of move on grow operations, and TrackingMDRef is expensive to
69 /// copy.
71 SubprogramTrackedNodes;
72
74 getImportTrackingVector(const DIScope *S) {
76 ? getSubprogramNodesTrackingVector(S)
77 : ImportedModules;
78 }
80 getSubprogramNodesTrackingVector(const DIScope *S) {
81 return SubprogramTrackedNodes[cast<DILocalScope>(S)->getSubprogram()];
82 }
83
84 /// Create a temporary.
85 ///
86 /// Create an \a temporary node and track it in \a UnresolvedNodes.
87 void trackIfUnresolved(MDNode *N);
88
89 /// Internal helper. Track metadata if untracked and insert \p DVR.
90 void insertDbgVariableRecord(DbgVariableRecord *DVR,
91 InsertPosition InsertPt);
92
93 /// Internal helper with common code used by insertDbg{Value,Addr}Intrinsic.
94 Instruction *insertDbgIntrinsic(llvm::Function *Intrinsic, llvm::Value *Val,
95 DILocalVariable *VarInfo,
96 DIExpression *Expr, const DILocation *DL,
97 InsertPosition InsertPt);
98
99 public:
100 /// Construct a builder for a module.
101 ///
102 /// If \c AllowUnresolved, collect unresolved nodes attached to the module
103 /// in order to resolve cycles during \a finalize().
104 ///
105 /// If \p CU is given a value other than nullptr, then set \p CUNode to CU.
106 LLVM_ABI explicit DIBuilder(Module &M, bool AllowUnresolved = true,
107 DICompileUnit *CU = nullptr);
108 DIBuilder(const DIBuilder &) = delete;
109 DIBuilder &operator=(const DIBuilder &) = delete;
110
111 /// Construct any deferred debug info descriptors.
112 LLVM_ABI void finalize();
113
114 /// Finalize a specific subprogram - no new variables may be added to this
115 /// subprogram afterwards.
117
118 /// A CompileUnit provides an anchor for all debugging
119 /// information generated during this instance of compilation.
120 /// \param Lang Source programming language, eg. dwarf::DW_LANG_C99
121 /// \param File File info.
122 /// \param Producer Identify the producer of debugging information
123 /// and code. Usually this is a compiler
124 /// version string.
125 /// \param isOptimized A boolean flag which indicates whether optimization
126 /// is enabled or not.
127 /// \param Flags This string lists command line options. This
128 /// string is directly embedded in debug info
129 /// output which may be used by a tool
130 /// analyzing generated debugging information.
131 /// \param RV This indicates runtime version for languages like
132 /// Objective-C.
133 /// \param SplitName The name of the file that we'll split debug info
134 /// out into.
135 /// \param Kind The kind of debug information to generate.
136 /// \param DWOId The DWOId if this is a split skeleton compile unit.
137 /// \param SplitDebugInlining Whether to emit inline debug info.
138 /// \param DebugInfoForProfiling Whether to emit extra debug info for
139 /// profile collection.
140 /// \param NameTableKind Whether to emit .debug_gnu_pubnames,
141 /// .debug_pubnames, or no pubnames at all.
142 /// \param SysRoot The clang system root (value of -isysroot).
143 /// \param SDK The SDK name. On Darwin, this is the last component
144 /// of the sysroot.
147 StringRef Producer, bool isOptimized, StringRef Flags,
148 unsigned RV, StringRef SplitName = StringRef(),
151 uint64_t DWOId = 0, bool SplitDebugInlining = true,
152 bool DebugInfoForProfiling = false,
155 bool RangesBaseAddress = false, StringRef SysRoot = {},
156 StringRef SDK = {});
157
158 /// Create a file descriptor to hold debugging information for a file.
159 /// \param Filename File name.
160 /// \param Directory Directory.
161 /// \param Checksum Optional checksum kind (e.g. CSK_MD5, CSK_SHA1, etc.)
162 /// and value.
163 /// \param Source Optional source text.
164 LLVM_ABI DIFile *createFile(
165 StringRef Filename, StringRef Directory,
166 std::optional<DIFile::ChecksumInfo<StringRef>> Checksum = std::nullopt,
167 std::optional<StringRef> Source = std::nullopt);
168
169 /// Create debugging information entry for a macro.
170 /// \param Parent Macro parent (could be nullptr).
171 /// \param Line Source line number where the macro is defined.
172 /// \param MacroType DW_MACINFO_define or DW_MACINFO_undef.
173 /// \param Name Macro name.
174 /// \param Value Macro value.
175 LLVM_ABI DIMacro *createMacro(DIMacroFile *Parent, unsigned Line,
176 unsigned MacroType, StringRef Name,
177 StringRef Value = StringRef());
178
179 /// Create debugging information temporary entry for a macro file.
180 /// List of macro node direct children will be calculated by DIBuilder,
181 /// using the \p Parent relationship.
182 /// \param Parent Macro file parent (could be nullptr).
183 /// \param Line Source line number where the macro file is included.
184 /// \param File File descriptor containing the name of the macro file.
185 LLVM_ABI DIMacroFile *createTempMacroFile(DIMacroFile *Parent,
186 unsigned Line, DIFile *File);
187
188 /// Create a single enumerator value.
189 LLVM_ABI DIEnumerator *createEnumerator(StringRef Name,
190 const APSInt &Value);
191 LLVM_ABI DIEnumerator *createEnumerator(StringRef Name, uint64_t Val,
192 bool IsUnsigned = false);
193
194 /// Create a DWARF unspecified type.
195 LLVM_ABI DIBasicType *createUnspecifiedType(StringRef Name);
196
197 /// Create C++11 nullptr type.
198 LLVM_ABI DIBasicType *createNullPtrType();
199
200 /// Create debugging information entry for a basic
201 /// type.
202 /// \param Name Type name.
203 /// \param SizeInBits Size of the type.
204 /// \param Encoding DWARF encoding code, e.g., dwarf::DW_ATE_float.
205 /// \param Flags Optional DWARF attributes, e.g., DW_AT_endianity.
206 /// \param NumExtraInhabitants The number of extra inhabitants of the type.
207 /// An extra inhabitant is a bit pattern that does not represent a valid
208 /// value for instances of a given type. This is used by the Swift language.
209 /// \param DataSizeInBits Optionally describes the number of bits used by
210 /// the value of the object when this is less than the storage size of
211 /// SizeInBits. Default value of zero indicates the object value and storage
212 /// sizes are equal.
213 LLVM_ABI DIBasicType *
214 createBasicType(StringRef Name, uint64_t SizeInBits, unsigned Encoding,
215 DINode::DIFlags Flags = DINode::FlagZero,
216 uint32_t NumExtraInhabitants = 0,
217 uint32_t DataSizeInBits = 0);
218
219 /// Create debugging information entry for a basic
220 /// type.
221 /// \param Name Type name.
222 /// \param File File where this type is defined.
223 /// \param LineNo Line number.
224 /// \param Context The surrounding context for the typedef.
225 /// \param SizeInBits Size of the type.
226 /// \param Encoding DWARF encoding code, e.g., dwarf::DW_ATE_float.
227 /// \param Flags Optional DWARF attributes, e.g., DW_AT_endianity.
228 /// \param NumExtraInhabitants The number of extra inhabitants of the type.
229 /// An extra inhabitant is a bit pattern that does not represent a valid
230 /// value for instances of a given type. This is used by the Swift language.
231 /// \param DataSizeInBits Optionally describes the number of bits used by
232 /// the value of the object when this is less than the storage size of
233 /// SizeInBits. Default value of zero indicates the object value and storage
234 /// sizes are equal.
235 LLVM_ABI DIBasicType *
236 createBasicType(StringRef Name, DIFile *File, unsigned LineNo,
237 DIScope *Context, uint64_t SizeInBits, unsigned Encoding,
238 DINode::DIFlags Flags = DINode::FlagZero,
239 uint32_t NumExtraInhabitants = 0,
240 uint32_t DataSizeInBits = 0);
241
242 /// Create debugging information entry for a binary fixed-point type.
243 /// \param Name Type name.
244 /// \param File File where this type is defined.
245 /// \param LineNo Line number.
246 /// \param Context The surrounding context for the typedef.
247 /// \param Encoding DWARF encoding code, either
248 /// dwarf::DW_ATE_signed_fixed or DW_ATE_unsigned_fixed.
249 /// \param Flags Optional DWARF attributes, e.g., DW_AT_endianity.
250 /// \param Factor Binary scale factor.
251 LLVM_ABI DIFixedPointType *
252 createBinaryFixedPointType(StringRef Name, DIFile *File, unsigned LineNo,
253 DIScope *Context, uint64_t SizeInBits,
254 uint32_t AlignInBits, unsigned Encoding,
255 DINode::DIFlags Flags, int Factor);
256
257 /// Create debugging information entry for a decimal fixed-point type.
258 /// \param Name Type name.
259 /// \param File File where this type is defined.
260 /// \param LineNo Line number.
261 /// \param Context The surrounding context for the typedef.
262 /// \param Encoding DWARF encoding code, either
263 /// dwarf::DW_ATE_signed_fixed or DW_ATE_unsigned_fixed.
264 /// \param Flags Optional DWARF attributes, e.g., DW_AT_endianity.
265 /// \param Factor Decimal scale factor.
266 LLVM_ABI DIFixedPointType *
267 createDecimalFixedPointType(StringRef Name, DIFile *File, unsigned LineNo,
268 DIScope *Context, uint64_t SizeInBits,
269 uint32_t AlignInBits, unsigned Encoding,
270 DINode::DIFlags Flags, int Factor);
271
272 /// Create debugging information entry for an arbitrary rational
273 /// fixed-point type.
274 /// \param Name Type name.
275 /// \param File File where this type is defined.
276 /// \param LineNo Line number.
277 /// \param Context The surrounding context for the typedef.
278 /// \param Encoding DWARF encoding code, either
279 /// dwarf::DW_ATE_signed_fixed or DW_ATE_unsigned_fixed.
280 /// \param Flags Optional DWARF attributes, e.g., DW_AT_endianity.
281 /// \param Numerator Numerator of scale factor.
282 /// \param Denominator Denominator of scale factor.
283 LLVM_ABI DIFixedPointType *createRationalFixedPointType(
284 StringRef Name, DIFile *File, unsigned LineNo, DIScope *Context,
285 uint64_t SizeInBits, uint32_t AlignInBits, unsigned Encoding,
286 DINode::DIFlags Flags, APInt Numerator, APInt Denominator);
287
288 /// Create debugging information entry for a string
289 /// type.
290 /// \param Name Type name.
291 /// \param SizeInBits Size of the type.
292 LLVM_ABI DIStringType *createStringType(StringRef Name,
293 uint64_t SizeInBits);
294
295 /// Create debugging information entry for Fortran
296 /// assumed length string type.
297 /// \param Name Type name.
298 /// \param StringLength String length expressed as DIVariable *.
299 /// \param StrLocationExp Optional memory location of the string.
300 LLVM_ABI DIStringType *
301 createStringType(StringRef Name, DIVariable *StringLength,
302 DIExpression *StrLocationExp = nullptr);
303
304 /// Create debugging information entry for Fortran
305 /// assumed length string type.
306 /// \param Name Type name.
307 /// \param StringLengthExp String length expressed in DIExpression form.
308 /// \param StrLocationExp Optional memory location of the string.
309 LLVM_ABI DIStringType *
310 createStringType(StringRef Name, DIExpression *StringLengthExp,
311 DIExpression *StrLocationExp = nullptr);
312
313 /// Create debugging information entry for a qualified
314 /// type, e.g. 'const int'.
315 /// \param Tag Tag identifing type, e.g. dwarf::TAG_volatile_type
316 /// \param FromTy Base Type.
317 LLVM_ABI DIDerivedType *createQualifiedType(unsigned Tag, DIType *FromTy);
318
319 /// Create debugging information entry for a pointer.
320 /// \param PointeeTy Type pointed by this pointer.
321 /// \param SizeInBits Size.
322 /// \param AlignInBits Alignment. (optional)
323 /// \param DWARFAddressSpace DWARF address space. (optional)
324 /// \param Name Pointer type name. (optional)
325 /// \param Annotations Member annotations.
326 LLVM_ABI DIDerivedType *
327 createPointerType(DIType *PointeeTy, uint64_t SizeInBits,
328 uint32_t AlignInBits = 0,
329 std::optional<unsigned> DWARFAddressSpace = std::nullopt,
330 StringRef Name = "", DINodeArray Annotations = nullptr);
331
332 /// Create a __ptrauth qualifier.
333 LLVM_ABI DIDerivedType *
334 createPtrAuthQualifiedType(DIType *FromTy, unsigned Key,
335 bool IsAddressDiscriminated,
336 unsigned ExtraDiscriminator, bool IsaPointer,
337 bool authenticatesNullValues);
338
339 /// Create debugging information entry for a pointer to member.
340 /// \param PointeeTy Type pointed to by this pointer.
341 /// \param SizeInBits Size.
342 /// \param AlignInBits Alignment. (optional)
343 /// \param Class Type for which this pointer points to members of.
344 LLVM_ABI DIDerivedType *
345 createMemberPointerType(DIType *PointeeTy, DIType *Class,
346 uint64_t SizeInBits, uint32_t AlignInBits = 0,
347 DINode::DIFlags Flags = DINode::FlagZero);
348
349 /// Create debugging information entry for a c++
350 /// style reference or rvalue reference type.
351 LLVM_ABI DIDerivedType *createReferenceType(
352 unsigned Tag, DIType *RTy, uint64_t SizeInBits = 0,
353 uint32_t AlignInBits = 0,
354 std::optional<unsigned> DWARFAddressSpace = std::nullopt);
355
356 /// Create debugging information entry for a typedef.
357 /// \param Ty Original type.
358 /// \param Name Typedef name.
359 /// \param File File where this type is defined.
360 /// \param LineNo Line number.
361 /// \param Context The surrounding context for the typedef.
362 /// \param AlignInBits Alignment. (optional)
363 /// \param Flags Flags to describe inheritance attribute, e.g. private
364 /// \param Annotations Annotations. (optional)
365 LLVM_ABI DIDerivedType *
366 createTypedef(DIType *Ty, StringRef Name, DIFile *File, unsigned LineNo,
367 DIScope *Context, uint32_t AlignInBits = 0,
368 DINode::DIFlags Flags = DINode::FlagZero,
369 DINodeArray Annotations = nullptr);
370
371 /// Create debugging information entry for a template alias.
372 /// \param Ty Original type.
373 /// \param Name Alias name.
374 /// \param File File where this type is defined.
375 /// \param LineNo Line number.
376 /// \param Context The surrounding context for the alias.
377 /// \param TParams The template arguments.
378 /// \param AlignInBits Alignment. (optional)
379 /// \param Flags Flags to describe inheritance attribute (optional),
380 /// e.g. private.
381 /// \param Annotations Annotations. (optional)
382 LLVM_ABI DIDerivedType *
383 createTemplateAlias(DIType *Ty, StringRef Name, DIFile *File,
384 unsigned LineNo, DIScope *Context, DINodeArray TParams,
385 uint32_t AlignInBits = 0,
386 DINode::DIFlags Flags = DINode::FlagZero,
387 DINodeArray Annotations = nullptr);
388
389 /// Create debugging information entry for a 'friend'.
390 LLVM_ABI DIDerivedType *createFriend(DIType *Ty, DIType *FriendTy);
391
392 /// Create debugging information entry to establish
393 /// inheritance relationship between two types.
394 /// \param Ty Original type.
395 /// \param BaseTy Base type. Ty is inherits from base.
396 /// \param BaseOffset Base offset.
397 /// \param VBPtrOffset Virtual base pointer offset.
398 /// \param Flags Flags to describe inheritance attribute,
399 /// e.g. private
400 LLVM_ABI DIDerivedType *createInheritance(DIType *Ty, DIType *BaseTy,
401 uint64_t BaseOffset,
402 uint32_t VBPtrOffset,
403 DINode::DIFlags Flags);
404
405 /// Create debugging information entry for a member.
406 /// \param Scope Member scope.
407 /// \param Name Member name.
408 /// \param File File where this member is defined.
409 /// \param LineNo Line number.
410 /// \param SizeInBits Member size.
411 /// \param AlignInBits Member alignment.
412 /// \param OffsetInBits Member offset.
413 /// \param Flags Flags to encode member attribute, e.g. private
414 /// \param Ty Parent type.
415 /// \param Annotations Member annotations.
416 LLVM_ABI DIDerivedType *createMemberType(
417 DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo,
418 Metadata *SizeInBits, uint32_t AlignInBits, Metadata *OffsetInBits,
419 DINode::DIFlags Flags, DIType *Ty, DINodeArray Annotations = nullptr);
420
421 /// Create debugging information entry for a member.
422 /// \param Scope Member scope.
423 /// \param Name Member name.
424 /// \param File File where this member is defined.
425 /// \param LineNo Line number.
426 /// \param SizeInBits Member size.
427 /// \param AlignInBits Member alignment.
428 /// \param OffsetInBits Member offset.
429 /// \param Flags Flags to encode member attribute, e.g. private
430 /// \param Ty Parent type.
431 /// \param Annotations Member annotations.
432 LLVM_ABI DIDerivedType *
433 createMemberType(DIScope *Scope, StringRef Name, DIFile *File,
434 unsigned LineNo, uint64_t SizeInBits, uint32_t AlignInBits,
435 uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *Ty,
436 DINodeArray Annotations = nullptr);
437
438 /// Create debugging information entry for a variant. A variant
439 /// normally should be a member of a variant part.
440 /// \param Scope Member scope.
441 /// \param Name Member name.
442 /// \param File File where this member is defined.
443 /// \param LineNo Line number.
444 /// \param SizeInBits Member size.
445 /// \param AlignInBits Member alignment.
446 /// \param OffsetInBits Member offset.
447 /// \param Flags Flags to encode member attribute, e.g. private
448 /// \param Discriminant The discriminant for this branch; null for
449 /// the default branch. This may be a
450 /// ConstantDataArray if the variant applies
451 /// for multiple discriminants.
452 /// \param Ty Parent type.
453 LLVM_ABI DIDerivedType *createVariantMemberType(
454 DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo,
455 uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
456 Constant *Discriminant, DINode::DIFlags Flags, DIType *Ty);
457
458 /// Create debugging information entry for a variant. A variant
459 /// created this way "inlines" multiple members into the enclosing
460 /// variant part.
461 /// \param Scope Scope in which this variant is defined.
462 /// \param Elements Variant elements.
463 /// \param Discriminant The discriminant for this branch; null for
464 /// the default branch. This may be a
465 /// ConstantDataArray if the variant applies
466 /// for multiple discriminants.
467 /// \param Ty Parent type.
468 LLVM_ABI DIDerivedType *createVariantMemberType(DIScope *Scope,
469 DINodeArray Elements,
470 Constant *Discriminant,
471 DIType *Ty);
472
473 /// Create debugging information entry for a bit field member.
474 /// \param Scope Member scope.
475 /// \param Name Member name.
476 /// \param File File where this member is defined.
477 /// \param LineNo Line number.
478 /// \param SizeInBits Member size.
479 /// \param OffsetInBits Member offset.
480 /// \param StorageOffsetInBits Member storage offset.
481 /// \param Flags Flags to encode member attribute.
482 /// \param Ty Parent type.
483 /// \param Annotations Member annotations.
484 LLVM_ABI DIDerivedType *createBitFieldMemberType(
485 DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo,
486 Metadata *SizeInBits, Metadata *OffsetInBits,
487 uint64_t StorageOffsetInBits, DINode::DIFlags Flags, DIType *Ty,
488 DINodeArray Annotations = nullptr);
489
490 /// Create debugging information entry for a bit field member.
491 /// \param Scope Member scope.
492 /// \param Name Member name.
493 /// \param File File where this member is defined.
494 /// \param LineNo Line number.
495 /// \param SizeInBits Member size.
496 /// \param OffsetInBits Member offset.
497 /// \param StorageOffsetInBits Member storage offset.
498 /// \param Flags Flags to encode member attribute.
499 /// \param Ty Parent type.
500 /// \param Annotations Member annotations.
501 LLVM_ABI DIDerivedType *createBitFieldMemberType(
502 DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo,
503 uint64_t SizeInBits, uint64_t OffsetInBits,
504 uint64_t StorageOffsetInBits, DINode::DIFlags Flags, DIType *Ty,
505 DINodeArray Annotations = nullptr);
506
507 /// Create debugging information entry for a
508 /// C++ static data member.
509 /// \param Scope Member scope.
510 /// \param Name Member name.
511 /// \param File File where this member is declared.
512 /// \param LineNo Line number.
513 /// \param Ty Type of the static member.
514 /// \param Flags Flags to encode member attribute, e.g. private.
515 /// \param Val Const initializer of the member.
516 /// \param Tag DWARF tag of the static member.
517 /// \param AlignInBits Member alignment.
518 LLVM_ABI DIDerivedType *createStaticMemberType(DIScope *Scope,
519 StringRef Name, DIFile *File,
520 unsigned LineNo, DIType *Ty,
521 DINode::DIFlags Flags,
522 Constant *Val, unsigned Tag,
523 uint32_t AlignInBits = 0);
524
525 /// Create debugging information entry for Objective-C
526 /// instance variable.
527 /// \param Name Member name.
528 /// \param File File where this member is defined.
529 /// \param LineNo Line number.
530 /// \param SizeInBits Member size.
531 /// \param AlignInBits Member alignment.
532 /// \param OffsetInBits Member offset.
533 /// \param Flags Flags to encode member attribute, e.g. private
534 /// \param Ty Parent type.
535 /// \param PropertyNode Property associated with this ivar.
536 LLVM_ABI DIDerivedType *createObjCIVar(StringRef Name, DIFile *File,
537 unsigned LineNo, uint64_t SizeInBits,
538 uint32_t AlignInBits,
539 uint64_t OffsetInBits,
540 DINode::DIFlags Flags, DIType *Ty,
541 MDNode *PropertyNode);
542
543 /// Create debugging information entry for Objective-C
544 /// property.
545 /// \param Name Property name.
546 /// \param File File where this property is defined.
547 /// \param LineNumber Line number.
548 /// \param GetterName Name of the Objective C property getter selector.
549 /// \param SetterName Name of the Objective C property setter selector.
550 /// \param PropertyAttributes Objective C property attributes.
551 /// \param Ty Type.
552 LLVM_ABI DIObjCProperty *
553 createObjCProperty(StringRef Name, DIFile *File, unsigned LineNumber,
554 StringRef GetterName, StringRef SetterName,
555 unsigned PropertyAttributes, DIType *Ty);
556
557 /// Create debugging information entry for a class.
558 /// \param Scope Scope in which this class is defined.
559 /// \param Name class name.
560 /// \param File File where this member is defined.
561 /// \param LineNumber Line number.
562 /// \param SizeInBits Member size.
563 /// \param AlignInBits Member alignment.
564 /// \param OffsetInBits Member offset.
565 /// \param Flags Flags to encode member attribute, e.g. private
566 /// \param Elements class members.
567 /// \param RunTimeLang Optional parameter, Objective-C runtime version.
568 /// \param VTableHolder Debug info of the base class that contains vtable
569 /// for this type. This is used in
570 /// DW_AT_containing_type. See DWARF documentation
571 /// for more info.
572 /// \param TemplateParms Template type parameters.
573 /// \param UniqueIdentifier A unique identifier for the class.
574 /// \param Annotations Attribute annotations, emitted as
575 /// DW_TAG_LLVM_annotation entries.
576 LLVM_ABI DICompositeType *createClassType(
577 DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
578 uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
579 DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements,
580 unsigned RunTimeLang = 0, DIType *VTableHolder = nullptr,
581 MDNode *TemplateParms = nullptr, StringRef UniqueIdentifier = "",
582 DINodeArray Annotations = nullptr);
583
584 /// Create debugging information entry for a struct.
585 /// \param Scope Scope in which this struct is defined.
586 /// \param Name Struct name.
587 /// \param File File where this member is defined.
588 /// \param LineNumber Line number.
589 /// \param SizeInBits Member size.
590 /// \param AlignInBits Member alignment.
591 /// \param Flags Flags to encode member attribute, e.g. private
592 /// \param Elements Struct elements.
593 /// \param RunTimeLang Optional parameter, Objective-C runtime version.
594 /// \param UniqueIdentifier A unique identifier for the struct.
595 /// \param Specification The type that this type completes. This is used by
596 /// Swift to represent generic types.
597 /// \param NumExtraInhabitants The number of extra inhabitants of the type.
598 /// An extra inhabitant is a bit pattern that does not represent a valid
599 /// value for instances of a given type. This is used by the Swift language.
600 /// \param Annotations Attribute annotations, emitted as
601 /// DW_TAG_LLVM_annotation entries.
602 LLVM_ABI DICompositeType *createStructType(
603 DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
604 Metadata *SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags,
605 DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang = 0,
606 DIType *VTableHolder = nullptr, StringRef UniqueIdentifier = "",
607 DIType *Specification = nullptr, uint32_t NumExtraInhabitants = 0,
608 DINodeArray Annotations = nullptr);
609
610 /// Create debugging information entry for a struct.
611 /// \param Scope Scope in which this struct is defined.
612 /// \param Name Struct name.
613 /// \param File File where this member is defined.
614 /// \param LineNumber Line number.
615 /// \param SizeInBits Member size.
616 /// \param AlignInBits Member alignment.
617 /// \param Flags Flags to encode member attribute, e.g. private
618 /// \param Elements Struct elements.
619 /// \param RunTimeLang Optional parameter, Objective-C runtime version.
620 /// \param UniqueIdentifier A unique identifier for the struct.
621 /// \param Specification The type that this type completes. This is used by
622 /// Swift to represent generic types.
623 /// \param NumExtraInhabitants The number of extra inhabitants of the type.
624 /// An extra inhabitant is a bit pattern that does not represent a valid
625 /// value for instances of a given type. This is used by the Swift language.
626 /// \param Annotations Attribute annotations, emitted as
627 /// DW_TAG_LLVM_annotation entries.
628 LLVM_ABI DICompositeType *createStructType(
629 DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
630 uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags,
631 DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang = 0,
632 DIType *VTableHolder = nullptr, StringRef UniqueIdentifier = "",
633 DIType *Specification = nullptr, uint32_t NumExtraInhabitants = 0,
634 DINodeArray Annotations = nullptr);
635
636 /// Create debugging information entry for an union.
637 /// \param Scope Scope in which this union is defined.
638 /// \param Name Union name.
639 /// \param File File where this member is defined.
640 /// \param LineNumber Line number.
641 /// \param SizeInBits Member size.
642 /// \param AlignInBits Member alignment.
643 /// \param Flags Flags to encode member attribute, e.g. private
644 /// \param Elements Union elements.
645 /// \param RunTimeLang Optional parameter, Objective-C runtime version.
646 /// \param UniqueIdentifier A unique identifier for the union.
647 /// \param Annotations Attribute annotations, emitted as
648 /// DW_TAG_LLVM_annotation entries.
649 LLVM_ABI DICompositeType *createUnionType(
650 DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
651 uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags,
652 DINodeArray Elements, unsigned RunTimeLang = 0,
653 StringRef UniqueIdentifier = "", DINodeArray Annotations = nullptr);
654
655 /// Create debugging information entry for a variant part. A
656 /// variant part normally has a discriminator (though this is not
657 /// required) and a number of variant children.
658 /// \param Scope Scope in which this union is defined.
659 /// \param Name Union name.
660 /// \param File File where this member is defined.
661 /// \param LineNumber Line number.
662 /// \param SizeInBits Member size.
663 /// \param AlignInBits Member alignment.
664 /// \param Flags Flags to encode member attribute, e.g. private
665 /// \param Discriminator Discriminant member
666 /// \param Elements Variant elements.
667 /// \param UniqueIdentifier A unique identifier for the union.
668 LLVM_ABI DICompositeType *
669 createVariantPart(DIScope *Scope, StringRef Name, DIFile *File,
670 unsigned LineNumber, uint64_t SizeInBits,
671 uint32_t AlignInBits, DINode::DIFlags Flags,
672 DIDerivedType *Discriminator, DINodeArray Elements,
673 StringRef UniqueIdentifier = "");
674
675 /// Create debugging information for template
676 /// type parameter.
677 /// \param Scope Scope in which this type is defined.
678 /// \param Name Type parameter name.
679 /// \param Ty Parameter type.
680 /// \param IsDefault Parameter is default or not
681 LLVM_ABI DITemplateTypeParameter *
682 createTemplateTypeParameter(DIScope *Scope, StringRef Name, DIType *Ty,
683 bool IsDefault);
684
685 /// Create debugging information for template
686 /// value parameter.
687 /// \param Scope Scope in which this type is defined.
688 /// \param Name Value parameter name.
689 /// \param Ty Parameter type.
690 /// \param IsDefault Parameter is default or not
691 /// \param Val Constant parameter value.
692 LLVM_ABI DITemplateValueParameter *
693 createTemplateValueParameter(DIScope *Scope, StringRef Name, DIType *Ty,
694 bool IsDefault, Constant *Val);
695
696 /// Create debugging information for a template template parameter.
697 /// \param Scope Scope in which this type is defined.
698 /// \param Name Value parameter name.
699 /// \param Ty Parameter type.
700 /// \param Val The fully qualified name of the template.
701 /// \param IsDefault Parameter is default or not.
702 LLVM_ABI DITemplateValueParameter *
703 createTemplateTemplateParameter(DIScope *Scope, StringRef Name, DIType *Ty,
704 StringRef Val, bool IsDefault = false);
705
706 /// Create debugging information for a template parameter pack.
707 /// \param Scope Scope in which this type is defined.
708 /// \param Name Value parameter name.
709 /// \param Ty Parameter type.
710 /// \param Val An array of types in the pack.
711 LLVM_ABI DITemplateValueParameter *
712 createTemplateParameterPack(DIScope *Scope, StringRef Name, DIType *Ty,
713 DINodeArray Val);
714
715 /// Create debugging information entry for an array.
716 /// \param Size Array size.
717 /// \param AlignInBits Alignment.
718 /// \param Ty Element type.
719 /// \param Subscripts Subscripts.
720 /// \param DataLocation The location of the raw data of a descriptor-based
721 /// Fortran array, either a DIExpression* or
722 /// a DIVariable*.
723 /// \param Associated The associated attribute of a descriptor-based
724 /// Fortran array, either a DIExpression* or
725 /// a DIVariable*.
726 /// \param Allocated The allocated attribute of a descriptor-based
727 /// Fortran array, either a DIExpression* or
728 /// a DIVariable*.
729 /// \param Rank The rank attribute of a descriptor-based
730 /// Fortran array, either a DIExpression* or
731 /// a DIVariable*.
732 LLVM_ABI DICompositeType *createArrayType(
733 uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts,
734 PointerUnion<DIExpression *, DIVariable *> DataLocation = nullptr,
735 PointerUnion<DIExpression *, DIVariable *> Associated = nullptr,
736 PointerUnion<DIExpression *, DIVariable *> Allocated = nullptr,
737 PointerUnion<DIExpression *, DIVariable *> Rank = nullptr);
738
739 /// Create debugging information entry for an array.
740 /// \param Scope Scope in which this enumeration is defined.
741 /// \param Name Union name.
742 /// \param File File where this member is defined.
743 /// \param LineNumber Line number.
744 /// \param Size Array size.
745 /// \param AlignInBits Alignment.
746 /// \param Ty Element type.
747 /// \param Subscripts Subscripts.
748 /// \param DataLocation The location of the raw data of a descriptor-based
749 /// Fortran array, either a DIExpression* or
750 /// a DIVariable*.
751 /// \param Associated The associated attribute of a descriptor-based
752 /// Fortran array, either a DIExpression* or
753 /// a DIVariable*.
754 /// \param Allocated The allocated attribute of a descriptor-based
755 /// Fortran array, either a DIExpression* or
756 /// a DIVariable*.
757 /// \param Rank The rank attribute of a descriptor-based
758 /// Fortran array, either a DIExpression* or
759 /// a DIVariable*.
760 /// \param BitStride The bit size of an element of the array.
761 LLVM_ABI DICompositeType *createArrayType(
762 DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
763 uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts,
764 PointerUnion<DIExpression *, DIVariable *> DataLocation = nullptr,
765 PointerUnion<DIExpression *, DIVariable *> Associated = nullptr,
766 PointerUnion<DIExpression *, DIVariable *> Allocated = nullptr,
767 PointerUnion<DIExpression *, DIVariable *> Rank = nullptr,
768 Metadata *BitStride = nullptr);
769
770 /// Create debugging information entry for a vector type.
771 /// \param Size Array size.
772 /// \param AlignInBits Alignment.
773 /// \param Ty Element type.
774 /// \param Subscripts Subscripts.
775 LLVM_ABI DICompositeType *createVectorType(uint64_t Size,
776 uint32_t AlignInBits, DIType *Ty,
777 DINodeArray Subscripts,
778 Metadata *BitStride = nullptr);
779
780 /// Create debugging information entry for an
781 /// enumeration.
782 /// \param Scope Scope in which this enumeration is defined.
783 /// \param Name Union name.
784 /// \param File File where this member is defined.
785 /// \param LineNumber Line number.
786 /// \param SizeInBits Member size.
787 /// \param AlignInBits Member alignment.
788 /// \param Elements Enumeration elements.
789 /// \param UnderlyingType Underlying type of a C++11/ObjC fixed enum.
790 /// \param RunTimeLang Optional parameter, Objective-C runtime version.
791 /// \param UniqueIdentifier A unique identifier for the enum.
792 /// \param IsScoped Boolean flag indicate if this is C++11/ObjC 'enum
793 /// class'.
794 LLVM_ABI DICompositeType *createEnumerationType(
795 DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
796 uint64_t SizeInBits, uint32_t AlignInBits, DINodeArray Elements,
797 DIType *UnderlyingType, unsigned RunTimeLang = 0,
798 StringRef UniqueIdentifier = "", bool IsScoped = false,
799 std::optional<uint32_t> EnumKind = std::nullopt);
800 /// Create debugging information entry for a set.
801 /// \param Scope Scope in which this set is defined.
802 /// \param Name Set name.
803 /// \param File File where this set is defined.
804 /// \param LineNo Line number.
805 /// \param SizeInBits Set size.
806 /// \param AlignInBits Set alignment.
807 /// \param Ty Base type of the set.
808 LLVM_ABI DIDerivedType *createSetType(DIScope *Scope, StringRef Name,
809 DIFile *File, unsigned LineNo,
810 uint64_t SizeInBits,
811 uint32_t AlignInBits, DIType *Ty);
812
813 /// Create subroutine type.
814 /// \param ParameterTypes An array of subroutine parameter types. This
815 /// includes return type at 0th index.
816 /// \param Flags E.g.: LValueReference.
817 /// These flags are used to emit dwarf attributes.
818 /// \param CC Calling convention, e.g. dwarf::DW_CC_normal
819 LLVM_ABI DISubroutineType *
820 createSubroutineType(DITypeArray ParameterTypes,
821 DINode::DIFlags Flags = DINode::FlagZero,
822 unsigned CC = 0);
823
824 /// Create a distinct clone of \p SP with FlagArtificial set.
825 LLVM_ABI static DISubprogram *createArtificialSubprogram(DISubprogram *SP);
826
827 /// Create a uniqued clone of \p Ty with FlagArtificial set.
828 LLVM_ABI static DIType *createArtificialType(DIType *Ty);
829
830 /// Create a uniqued clone of \p Ty with FlagObjectPointer set.
831 /// If \p Implicit is true, also set FlagArtificial.
832 LLVM_ABI static DIType *createObjectPointerType(DIType *Ty, bool Implicit);
833
834 /// Create a type describing a subrange of another type.
835 /// \param Scope Scope in which this set is defined.
836 /// \param Name Set name.
837 /// \param File File where this set is defined.
838 /// \param LineNo Line number.
839 /// \param SizeInBits Size.
840 /// \param AlignInBits Alignment.
841 /// \param Flags Flags to encode attributes.
842 /// \param Ty Base type.
843 /// \param LowerBound Lower bound.
844 /// \param UpperBound Upper bound.
845 /// \param Stride Stride, if any.
846 /// \param Bias Bias, if any.
847 LLVM_ABI DISubrangeType *
848 createSubrangeType(StringRef Name, DIFile *File, unsigned LineNo,
849 DIScope *Scope, uint64_t SizeInBits,
850 uint32_t AlignInBits, DINode::DIFlags Flags, DIType *Ty,
851 Metadata *LowerBound, Metadata *UpperBound,
852 Metadata *Stride, Metadata *Bias);
853
854 /// Create a permanent forward-declared type.
855 LLVM_ABI DICompositeType *
856 createForwardDecl(unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F,
857 unsigned Line, unsigned RuntimeLang = 0,
858 uint64_t SizeInBits = 0, uint32_t AlignInBits = 0,
859 StringRef UniqueIdentifier = "",
860 std::optional<uint32_t> EnumKind = std::nullopt);
861
862 /// Create a temporary forward-declared type.
864 unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line,
865 unsigned RuntimeLang = 0, uint64_t SizeInBits = 0,
866 uint32_t AlignInBits = 0, DINode::DIFlags Flags = DINode::FlagFwdDecl,
867 StringRef UniqueIdentifier = "", DINodeArray Annotations = nullptr,
868 std::optional<uint32_t> EnumKind = std::nullopt);
869
870 /// Retain DIScope* in a module even if it is not referenced
871 /// through debug info anchors.
872 LLVM_ABI void retainType(DIScope *T);
873
874 /// Create unspecified parameter type
875 /// for a subroutine type.
877
878 /// Get a DINodeArray, create one if required.
879 LLVM_ABI DINodeArray getOrCreateArray(ArrayRef<Metadata *> Elements);
880
881 /// Get a DIMacroNodeArray, create one if required.
882 LLVM_ABI DIMacroNodeArray
884
885 /// Get a DITypeArray, create one if required.
887
888 /// Create a descriptor for a value range. This
889 /// implicitly uniques the values returned.
890 LLVM_ABI DISubrange *getOrCreateSubrange(int64_t Lo, int64_t Count);
891 LLVM_ABI DISubrange *getOrCreateSubrange(int64_t Lo, Metadata *CountNode);
893 Metadata *LowerBound,
894 Metadata *UpperBound,
895 Metadata *Stride);
896
897 LLVM_ABI DIGenericSubrange *
902
903 /// Create a new descriptor for the specified variable.
904 /// \param Context Variable scope.
905 /// \param Name Name of the variable.
906 /// \param LinkageName Mangled name of the variable.
907 /// \param File File where this variable is defined.
908 /// \param LineNo Line number.
909 /// \param Ty Variable Type.
910 /// \param IsLocalToUnit Boolean flag indicate whether this variable is
911 /// externally visible or not.
912 /// \param Expr The location of the global relative to the attached
913 /// GlobalVariable.
914 /// \param Decl Reference to the corresponding declaration.
915 /// \param AlignInBits Variable alignment(or 0 if no alignment attr was
916 /// specified)
917 LLVM_ABI DIGlobalVariableExpression *createGlobalVariableExpression(
918 DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
919 unsigned LineNo, DIType *Ty, bool IsLocalToUnit, bool isDefined = true,
920 DIExpression *Expr = nullptr, MDNode *Decl = nullptr,
921 MDTuple *TemplateParams = nullptr, uint32_t AlignInBits = 0,
922 DINodeArray Annotations = nullptr);
923
924 /// Identical to createGlobalVariable
925 /// except that the resulting DbgNode is temporary and meant to be RAUWed.
927 DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
928 unsigned LineNo, DIType *Ty, bool IsLocalToUnit, MDNode *Decl = nullptr,
929 MDTuple *TemplateParams = nullptr, uint32_t AlignInBits = 0);
930
931 /// Create a new descriptor for an auto variable. This is a local variable
932 /// that is not a subprogram parameter.
933 ///
934 /// \c Scope must be a \a DILocalScope, and thus its scope chain eventually
935 /// leads to a \a DISubprogram.
936 ///
937 /// If \c AlwaysPreserve, this variable will be referenced from its
938 /// containing subprogram, and will survive some optimizations.
939 LLVM_ABI DILocalVariable *
940 createAutoVariable(DIScope *Scope, StringRef Name, DIFile *File,
941 unsigned LineNo, DIType *Ty, bool AlwaysPreserve = false,
942 DINode::DIFlags Flags = DINode::FlagZero,
943 uint32_t AlignInBits = 0);
944
945 /// Create a new descriptor for an label.
946 ///
947 /// \c Scope must be a \a DILocalScope, and thus its scope chain eventually
948 /// leads to a \a DISubprogram.
949 LLVM_ABI DILabel *createLabel(DIScope *Scope, StringRef Name, DIFile *File,
950 unsigned LineNo, unsigned Column,
951 bool IsArtificial,
952 std::optional<unsigned> CoroSuspendIdx,
953 bool AlwaysPreserve = false);
954
955 /// Create a new descriptor for a parameter variable.
956 ///
957 /// \c Scope must be a \a DILocalScope, and thus its scope chain eventually
958 /// leads to a \a DISubprogram.
959 ///
960 /// \c ArgNo is the index (starting from \c 1) of this variable in the
961 /// subprogram parameters. \c ArgNo should not conflict with other
962 /// parameters of the same subprogram.
963 ///
964 /// If \c AlwaysPreserve, this variable will be referenced from its
965 /// containing subprogram, and will survive some optimizations.
966 LLVM_ABI DILocalVariable *
967 createParameterVariable(DIScope *Scope, StringRef Name, unsigned ArgNo,
968 DIFile *File, unsigned LineNo, DIType *Ty,
969 bool AlwaysPreserve = false,
970 DINode::DIFlags Flags = DINode::FlagZero,
971 DINodeArray Annotations = nullptr);
972
973 /// Create a new descriptor for the specified
974 /// variable which has a complex address expression for its address.
975 /// \param Addr An array of complex address operations.
976 LLVM_ABI DIExpression *createExpression(ArrayRef<uint64_t> Addr = {});
977
978 /// Create an expression for a variable that does not have an address, but
979 /// does have a constant value.
981 return DIExpression::get(
982 VMContext, {dwarf::DW_OP_constu, Val, dwarf::DW_OP_stack_value});
983 }
984
985 /// Create a new descriptor for the specified subprogram.
986 /// See comments in DISubprogram* for descriptions of these fields.
987 /// \param Scope Function scope.
988 /// \param Name Function name.
989 /// \param LinkageName Mangled function name.
990 /// \param File File where this variable is defined.
991 /// \param LineNo Line number.
992 /// \param Ty Function type.
993 /// \param ScopeLine Set to the beginning of the scope this starts
994 /// \param Flags e.g. is this function prototyped or not.
995 /// These flags are used to emit dwarf attributes.
996 /// \param SPFlags Additional flags specific to subprograms.
997 /// \param TParams Function template parameters.
998 /// \param ThrownTypes Exception types this function may throw.
999 /// \param Annotations Attribute Annotations.
1000 /// \param TargetFuncName The name of the target function if this is
1001 /// a trampoline.
1002 /// \param UseKeyInstructions Instruct DWARF emission to interpret Key
1003 /// Instructions metadata on instructions to determine is_stmt placement.
1005 DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File,
1006 unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine,
1007 DINode::DIFlags Flags = DINode::FlagZero,
1008 DISubprogram::DISPFlags SPFlags = DISubprogram::SPFlagZero,
1009 DITemplateParameterArray TParams = nullptr,
1010 DISubprogram *Decl = nullptr, DITypeArray ThrownTypes = nullptr,
1011 DINodeArray Annotations = nullptr, StringRef TargetFuncName = "",
1012 bool UseKeyInstructions = false);
1013
1014 /// Identical to createFunction,
1015 /// except that the resulting DbgNode is meant to be RAUWed.
1017 DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File,
1018 unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine,
1019 DINode::DIFlags Flags = DINode::FlagZero,
1020 DISubprogram::DISPFlags SPFlags = DISubprogram::SPFlagZero,
1021 DITemplateParameterArray TParams = nullptr,
1022 DISubprogram *Decl = nullptr, DITypeArray ThrownTypes = nullptr);
1023
1024 /// Create a new descriptor for the specified C++ method.
1025 /// See comments in \a DISubprogram* for descriptions of these fields.
1026 /// \param Scope Function scope.
1027 /// \param Name Function name.
1028 /// \param LinkageName Mangled function name.
1029 /// \param File File where this variable is defined.
1030 /// \param LineNo Line number.
1031 /// \param Ty Function type.
1032 /// \param VTableIndex Index no of this method in virtual table, or -1u if
1033 /// unrepresentable.
1034 /// \param ThisAdjustment
1035 /// MS ABI-specific adjustment of 'this' that occurs
1036 /// in the prologue.
1037 /// \param VTableHolder Type that holds vtable.
1038 /// \param Flags e.g. is this function prototyped or not.
1039 /// This flags are used to emit dwarf attributes.
1040 /// \param SPFlags Additional flags specific to subprograms.
1041 /// \param TParams Function template parameters.
1042 /// \param ThrownTypes Exception types this function may throw.
1043 /// \param UseKeyInstructions Enable Key Instructions debug info.
1045 DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File,
1046 unsigned LineNo, DISubroutineType *Ty, unsigned VTableIndex = 0,
1047 int ThisAdjustment = 0, DIType *VTableHolder = nullptr,
1048 DINode::DIFlags Flags = DINode::FlagZero,
1049 DISubprogram::DISPFlags SPFlags = DISubprogram::SPFlagZero,
1050 DITemplateParameterArray TParams = nullptr,
1051 DITypeArray ThrownTypes = nullptr, bool UseKeyInstructions = false);
1052
1053 /// Create common block entry for a Fortran common block.
1054 /// \param Scope Scope of this common block.
1055 /// \param decl Global variable declaration.
1056 /// \param Name The name of this common block.
1057 /// \param File The file this common block is defined.
1058 /// \param LineNo Line number.
1060 DIGlobalVariable *decl,
1061 StringRef Name, DIFile *File,
1062 unsigned LineNo);
1063
1064 /// This creates new descriptor for a namespace with the specified
1065 /// parent scope.
1066 /// \param Scope Namespace scope
1067 /// \param Name Name of this namespace
1068 /// \param ExportSymbols True for C++ inline namespaces.
1070 bool ExportSymbols);
1071
1072 /// This creates new descriptor for a module with the specified
1073 /// parent scope.
1074 /// \param Scope Parent scope
1075 /// \param Name Name of this module
1076 /// \param ConfigurationMacros
1077 /// A space-separated shell-quoted list of -D macro
1078 /// definitions as they would appear on a command line.
1079 /// \param IncludePath The path to the module map file.
1080 /// \param APINotesFile The path to an API notes file for this module.
1081 /// \param File Source file of the module.
1082 /// Used for Fortran modules.
1083 /// \param LineNo Source line number of the module.
1084 /// Used for Fortran modules.
1085 /// \param IsDecl This is a module declaration; default to false;
1086 /// when set to true, only Scope and Name are required
1087 /// as this entry is just a hint for the debugger to find
1088 /// the corresponding definition in the global scope.
1090 StringRef ConfigurationMacros,
1091 StringRef IncludePath,
1092 StringRef APINotesFile = {},
1093 DIFile *File = nullptr, unsigned LineNo = 0,
1094 bool IsDecl = false);
1095
1096 /// This creates a descriptor for a lexical block with a new file
1097 /// attached. This merely extends the existing
1098 /// lexical block as it crosses a file.
1099 /// \param Scope Lexical block.
1100 /// \param File Source file.
1101 /// \param Discriminator DWARF path discriminator value.
1102 LLVM_ABI DILexicalBlockFile *
1103 createLexicalBlockFile(DIScope *Scope, DIFile *File,
1104 unsigned Discriminator = 0);
1105
1106 /// This creates a descriptor for a lexical block with the
1107 /// specified parent context.
1108 /// \param Scope Parent lexical scope.
1109 /// \param File Source file.
1110 /// \param Line Line number.
1111 /// \param Col Column number.
1112 LLVM_ABI DILexicalBlock *createLexicalBlock(DIScope *Scope, DIFile *File,
1113 unsigned Line, unsigned Col);
1114
1115 /// Create a descriptor for an imported module.
1116 /// \param Context The scope this module is imported into
1117 /// \param NS The namespace being imported here.
1118 /// \param File File where the declaration is located.
1119 /// \param Line Line number of the declaration.
1120 /// \param Elements Renamed elements.
1121 LLVM_ABI DIImportedEntity *
1122 createImportedModule(DIScope *Context, DINamespace *NS, DIFile *File,
1123 unsigned Line, DINodeArray Elements = nullptr);
1124
1125 /// Create a descriptor for an imported module.
1126 /// \param Context The scope this module is imported into.
1127 /// \param NS An aliased namespace.
1128 /// \param File File where the declaration is located.
1129 /// \param Line Line number of the declaration.
1130 /// \param Elements Renamed elements.
1131 LLVM_ABI DIImportedEntity *
1132 createImportedModule(DIScope *Context, DIImportedEntity *NS, DIFile *File,
1133 unsigned Line, DINodeArray Elements = nullptr);
1134
1135 /// Create a descriptor for an imported module.
1136 /// \param Context The scope this module is imported into.
1137 /// \param M The module being imported here
1138 /// \param File File where the declaration is located.
1139 /// \param Line Line number of the declaration.
1140 /// \param Elements Renamed elements.
1141 LLVM_ABI DIImportedEntity *
1142 createImportedModule(DIScope *Context, DIModule *M, DIFile *File,
1143 unsigned Line, DINodeArray Elements = nullptr);
1144
1145 /// Create a descriptor for an imported function.
1146 /// \param Context The scope this module is imported into.
1147 /// \param Decl The declaration (or definition) of a function, type, or
1148 /// variable.
1149 /// \param File File where the declaration is located.
1150 /// \param Line Line number of the declaration.
1151 /// \param Elements Renamed elements.
1152 LLVM_ABI DIImportedEntity *
1153 createImportedDeclaration(DIScope *Context, DINode *Decl, DIFile *File,
1154 unsigned Line, StringRef Name = "",
1155 DINodeArray Elements = nullptr);
1156
1157 /// Insert a new #dbg_declare record.
1158 /// \param Storage llvm::Value of the variable
1159 /// \param VarInfo Variable's debug info descriptor.
1160 /// \param Expr A complex location expression.
1161 /// \param DL Debug info location.
1162 /// \param InsertAtEnd Location for the new record.
1163 LLVM_ABI DbgRecord *insertDeclare(Value *Storage, DILocalVariable *VarInfo,
1164 DIExpression *Expr, const DILocation *DL,
1165 BasicBlock *InsertAtEnd);
1166
1167 /// Insert a new #dbg_assign record.
1168 /// \param LinkedInstr Instruction with a DIAssignID to link with the new
1169 /// record. The record will be inserted after this
1170 /// instruction.
1171 /// \param Val The value component of this #dbg_assign.
1172 /// \param SrcVar Variable's debug info descriptor.
1173 /// \param ValExpr A complex location expression to modify \p Val.
1174 /// \param Addr The address component (store destination).
1175 /// \param AddrExpr A complex location expression to modify \p Addr.
1176 /// NOTE: \p ValExpr carries the FragInfo for the
1177 /// variable.
1178 /// \param DL Debug info location, usually: (line: 0,
1179 /// column: 0, scope: var-decl-scope). See
1180 /// getDebugValueLoc.
1181 LLVM_ABI DbgRecord *insertDbgAssign(Instruction *LinkedInstr, Value *Val,
1182 DILocalVariable *SrcVar,
1183 DIExpression *ValExpr, Value *Addr,
1184 DIExpression *AddrExpr,
1185 const DILocation *DL);
1186
1187 /// Insert a new #dbg_declare record.
1188 /// \param Storage llvm::Value of the variable
1189 /// \param VarInfo Variable's debug info descriptor.
1190 /// \param Expr A complex location expression.
1191 /// \param DL Debug info location.
1192 /// \param InsertPt Location for the new record.
1193 LLVM_ABI DbgRecord *insertDeclare(llvm::Value *Storage,
1194 DILocalVariable *VarInfo,
1195 DIExpression *Expr, const DILocation *DL,
1196 InsertPosition InsertPt);
1197
1198 /// Insert a new #dbg_declare_value record.
1199 /// \param Storage llvm::Value of the variable
1200 /// \param VarInfo Variable's debug info descriptor.
1201 /// \param Expr A complex location expression.
1202 /// \param DL Debug info location.
1203 /// \param InsertPt Location for the new record.
1204 LLVM_ABI DbgRecord *insertDeclareValue(Value *Storage,
1205 DILocalVariable *VarInfo,
1206 DIExpression *Expr,
1207 const DILocation *DL,
1208 InsertPosition InsertPt);
1209
1210 /// Insert a new #dbg_label record.
1211 /// \param LabelInfo Label's debug info descriptor.
1212 /// \param DL Debug info location.
1213 /// \param InsertPt Location for the new record.
1214 LLVM_ABI DbgRecord *insertLabel(DILabel *LabelInfo, const DILocation *DL,
1215 InsertPosition InsertPt);
1216
1217 /// Insert a new #dbg_value record.
1218 /// \param Val llvm::Value of the variable
1219 /// \param VarInfo Variable's debug info descriptor.
1220 /// \param Expr A complex location expression.
1221 /// \param DL Debug info location.
1222 /// \param InsertPt Location for the new record.
1223 LLVM_ABI DbgRecord *insertDbgValue(llvm::Value *Val,
1224 DILocalVariable *VarInfo,
1225 DIExpression *Expr, const DILocation *DL,
1226 InsertPosition InsertPt);
1227
1228 /// Replace the vtable holder in the given type.
1229 ///
1230 /// If this creates a self reference, it may orphan some unresolved cycles
1231 /// in the operands of \c T, so \a DIBuilder needs to track that.
1232 LLVM_ABI void replaceVTableHolder(DICompositeType *&T,
1233 DIType *VTableHolder);
1234
1235 /// Replace arrays on a composite type.
1236 ///
1237 /// If \c T is resolved, but the arrays aren't -- which can happen if \c T
1238 /// has a self-reference -- \a DIBuilder needs to track the array to
1239 /// resolve cycles.
1240 LLVM_ABI void replaceArrays(DICompositeType *&T, DINodeArray Elements,
1241 DINodeArray TParams = DINodeArray());
1242
1243 /// Replace a temporary node.
1244 ///
1245 /// Call \a MDNode::replaceAllUsesWith() on \c N, replacing it with \c
1246 /// Replacement.
1247 ///
1248 /// If \c Replacement is the same as \c N.get(), instead call \a
1249 /// MDNode::replaceWithUniqued(). In this case, the uniqued node could
1250 /// have a different address, so we return the final address.
1251 template <class NodeTy>
1252 NodeTy *replaceTemporary(TempMDNode &&N, NodeTy *Replacement) {
1253 if (N.get() == Replacement)
1254 return cast<NodeTy>(MDNode::replaceWithUniqued(std::move(N)));
1255
1256 N->replaceAllUsesWith(Replacement);
1257 return Replacement;
1258 }
1259 };
1260
1261 // Create wrappers for C Binding types (see CBindingWrapping.h).
1263
1264} // end namespace llvm
1265
1266#endif // LLVM_IR_DIBUILDER_H
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
#define DEFINE_ISA_CONVERSION_FUNCTIONS(ty, ref)
#define LLVM_ABI
Definition Compiler.h:215
dxil translate DXIL Translate Metadata
This file defines the DenseMap class.
This file contains constants used for implementing Dwarf debug support.
#define F(x, y, z)
Definition MD5.cpp:54
This file implements a map that provides insertion order iteration.
#define T
static constexpr StringLiteral Filename
This file implements a set that has insertion order iteration characteristics.
This file defines the SmallVector class.
Annotations lets you mark points and ranges inside source code, for tests:
Definition Annotations.h:67
LLVM Basic Block Representation.
Definition BasicBlock.h:62
This is an important base class in LLVM.
Definition Constant.h:43
static LLVM_ABI DIType * createObjectPointerType(DIType *Ty, bool Implicit)
Create a uniqued clone of Ty with FlagObjectPointer set.
LLVM_ABI DIBasicType * createUnspecifiedParameter()
Create unspecified parameter type for a subroutine type.
LLVM_ABI DIGlobalVariable * createTempGlobalVariableFwdDecl(DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DIType *Ty, bool IsLocalToUnit, MDNode *Decl=nullptr, MDTuple *TemplateParams=nullptr, uint32_t AlignInBits=0)
Identical to createGlobalVariable except that the resulting DbgNode is temporary and meant to be RAUW...
LLVM_ABI DITemplateValueParameter * createTemplateTemplateParameter(DIScope *Scope, StringRef Name, DIType *Ty, StringRef Val, bool IsDefault=false)
Create debugging information for a template template parameter.
NodeTy * replaceTemporary(TempMDNode &&N, NodeTy *Replacement)
Replace a temporary node.
Definition DIBuilder.h:1252
LLVM_ABI DIDerivedType * createTypedef(DIType *Ty, StringRef Name, DIFile *File, unsigned LineNo, DIScope *Context, uint32_t AlignInBits=0, DINode::DIFlags Flags=DINode::FlagZero, DINodeArray Annotations=nullptr)
Create debugging information entry for a typedef.
LLVM_ABI DbgRecord * insertDbgAssign(Instruction *LinkedInstr, Value *Val, DILocalVariable *SrcVar, DIExpression *ValExpr, Value *Addr, DIExpression *AddrExpr, const DILocation *DL)
Insert a new dbg_assign record.
DIBuilder & operator=(const DIBuilder &)=delete
LLVM_ABI void finalize()
Construct any deferred debug info descriptors.
Definition DIBuilder.cpp:74
LLVM_ABI DIMacro * createMacro(DIMacroFile *Parent, unsigned Line, unsigned MacroType, StringRef Name, StringRef Value=StringRef())
Create debugging information entry for a macro.
LLVM_ABI DIDerivedType * createInheritance(DIType *Ty, DIType *BaseTy, uint64_t BaseOffset, uint32_t VBPtrOffset, DINode::DIFlags Flags)
Create debugging information entry to establish inheritance relationship between two types.
LLVM_ABI DICompositeType * createVectorType(uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts, Metadata *BitStride=nullptr)
Create debugging information entry for a vector type.
LLVM_ABI DIDerivedType * createStaticMemberType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, DIType *Ty, DINode::DIFlags Flags, Constant *Val, unsigned Tag, uint32_t AlignInBits=0)
Create debugging information entry for a C++ static data member.
LLVM_ABI DIDerivedType * createVariantMemberType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, Constant *Discriminant, DINode::DIFlags Flags, DIType *Ty)
Create debugging information entry for a variant.
LLVM_ABI DILexicalBlockFile * createLexicalBlockFile(DIScope *Scope, DIFile *File, unsigned Discriminator=0)
This creates a descriptor for a lexical block with a new file attached.
LLVM_ABI void finalizeSubprogram(DISubprogram *SP)
Finalize a specific subprogram - no new variables may be added to this subprogram afterwards.
Definition DIBuilder.cpp:54
LLVM_ABI DIDerivedType * createQualifiedType(unsigned Tag, DIType *FromTy)
Create debugging information entry for a qualified type, e.g.
LLVM_ABI DISubprogram * createTempFunctionFwdDecl(DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine, DINode::DIFlags Flags=DINode::FlagZero, DISubprogram::DISPFlags SPFlags=DISubprogram::SPFlagZero, DITemplateParameterArray TParams=nullptr, DISubprogram *Decl=nullptr, DITypeArray ThrownTypes=nullptr)
Identical to createFunction, except that the resulting DbgNode is meant to be RAUWed.
LLVM_ABI DIDerivedType * createObjCIVar(StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *Ty, MDNode *PropertyNode)
Create debugging information entry for Objective-C instance variable.
static LLVM_ABI DIType * createArtificialType(DIType *Ty)
Create a uniqued clone of Ty with FlagArtificial set.
LLVM_ABI DIDerivedType * createBitFieldMemberType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, Metadata *SizeInBits, Metadata *OffsetInBits, uint64_t StorageOffsetInBits, DINode::DIFlags Flags, DIType *Ty, DINodeArray Annotations=nullptr)
Create debugging information entry for a bit field member.
LLVM_ABI DISubroutineType * createSubroutineType(DITypeArray ParameterTypes, DINode::DIFlags Flags=DINode::FlagZero, unsigned CC=0)
Create subroutine type.
LLVM_ABI DICompositeType * createUnionType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags, DINodeArray Elements, unsigned RunTimeLang=0, StringRef UniqueIdentifier="", DINodeArray Annotations=nullptr)
Create debugging information entry for an union.
LLVM_ABI DISubprogram * createMethod(DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DISubroutineType *Ty, unsigned VTableIndex=0, int ThisAdjustment=0, DIType *VTableHolder=nullptr, DINode::DIFlags Flags=DINode::FlagZero, DISubprogram::DISPFlags SPFlags=DISubprogram::SPFlagZero, DITemplateParameterArray TParams=nullptr, DITypeArray ThrownTypes=nullptr, bool UseKeyInstructions=false)
Create a new descriptor for the specified C++ method.
LLVM_ABI DINamespace * createNameSpace(DIScope *Scope, StringRef Name, bool ExportSymbols)
This creates new descriptor for a namespace with the specified parent scope.
LLVM_ABI DIStringType * createStringType(StringRef Name, uint64_t SizeInBits)
Create debugging information entry for a string type.
LLVM_ABI DILexicalBlock * createLexicalBlock(DIScope *Scope, DIFile *File, unsigned Line, unsigned Col)
This creates a descriptor for a lexical block with the specified parent context.
LLVM_ABI DICompositeType * createStructType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, Metadata *SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang=0, DIType *VTableHolder=nullptr, StringRef UniqueIdentifier="", DIType *Specification=nullptr, uint32_t NumExtraInhabitants=0, DINodeArray Annotations=nullptr)
Create debugging information entry for a struct.
LLVM_ABI DIMacroNodeArray getOrCreateMacroArray(ArrayRef< Metadata * > Elements)
Get a DIMacroNodeArray, create one if required.
LLVM_ABI DbgRecord * insertDbgValue(llvm::Value *Val, DILocalVariable *VarInfo, DIExpression *Expr, const DILocation *DL, InsertPosition InsertPt)
Insert a new dbg_value record.
LLVM_ABI DIDerivedType * createMemberType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, Metadata *SizeInBits, uint32_t AlignInBits, Metadata *OffsetInBits, DINode::DIFlags Flags, DIType *Ty, DINodeArray Annotations=nullptr)
Create debugging information entry for a member.
LLVM_ABI DIDerivedType * createSetType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint32_t AlignInBits, DIType *Ty)
Create debugging information entry for a set.
LLVM_ABI void replaceVTableHolder(DICompositeType *&T, DIType *VTableHolder)
Replace the vtable holder in the given type.
DIExpression * createConstantValueExpression(uint64_t Val)
Create an expression for a variable that does not have an address, but does have a constant value.
Definition DIBuilder.h:980
LLVM_ABI DIBasicType * createNullPtrType()
Create C++11 nullptr type.
LLVM_ABI DICommonBlock * createCommonBlock(DIScope *Scope, DIGlobalVariable *decl, StringRef Name, DIFile *File, unsigned LineNo)
Create common block entry for a Fortran common block.
LLVM_ABI DIDerivedType * createFriend(DIType *Ty, DIType *FriendTy)
Create debugging information entry for a 'friend'.
LLVM_ABI DILabel * createLabel(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, unsigned Column, bool IsArtificial, std::optional< unsigned > CoroSuspendIdx, bool AlwaysPreserve=false)
Create a new descriptor for an label.
LLVM_ABI void retainType(DIScope *T)
Retain DIScope* in a module even if it is not referenced through debug info anchors.
LLVM_ABI DIDerivedType * createTemplateAlias(DIType *Ty, StringRef Name, DIFile *File, unsigned LineNo, DIScope *Context, DINodeArray TParams, uint32_t AlignInBits=0, DINode::DIFlags Flags=DINode::FlagZero, DINodeArray Annotations=nullptr)
Create debugging information entry for a template alias.
DIBuilder(const DIBuilder &)=delete
LLVM_ABI DISubprogram * createFunction(DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine, DINode::DIFlags Flags=DINode::FlagZero, DISubprogram::DISPFlags SPFlags=DISubprogram::SPFlagZero, DITemplateParameterArray TParams=nullptr, DISubprogram *Decl=nullptr, DITypeArray ThrownTypes=nullptr, DINodeArray Annotations=nullptr, StringRef TargetFuncName="", bool UseKeyInstructions=false)
Create a new descriptor for the specified subprogram.
LLVM_ABI DIDerivedType * createPointerType(DIType *PointeeTy, uint64_t SizeInBits, uint32_t AlignInBits=0, std::optional< unsigned > DWARFAddressSpace=std::nullopt, StringRef Name="", DINodeArray Annotations=nullptr)
Create debugging information entry for a pointer.
LLVM_ABI DITemplateValueParameter * createTemplateParameterPack(DIScope *Scope, StringRef Name, DIType *Ty, DINodeArray Val)
Create debugging information for a template parameter pack.
LLVM_ABI DIGlobalVariableExpression * createGlobalVariableExpression(DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DIType *Ty, bool IsLocalToUnit, bool isDefined=true, DIExpression *Expr=nullptr, MDNode *Decl=nullptr, MDTuple *TemplateParams=nullptr, uint32_t AlignInBits=0, DINodeArray Annotations=nullptr)
Create a new descriptor for the specified variable.
LLVM_ABI DICompositeType * createClassType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang=0, DIType *VTableHolder=nullptr, MDNode *TemplateParms=nullptr, StringRef UniqueIdentifier="", DINodeArray Annotations=nullptr)
Create debugging information entry for a class.
LLVM_ABI DIFixedPointType * createRationalFixedPointType(StringRef Name, DIFile *File, unsigned LineNo, DIScope *Context, uint64_t SizeInBits, uint32_t AlignInBits, unsigned Encoding, DINode::DIFlags Flags, APInt Numerator, APInt Denominator)
Create debugging information entry for an arbitrary rational fixed-point type.
LLVM_ABI DICompositeType * createReplaceableCompositeType(unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line, unsigned RuntimeLang=0, uint64_t SizeInBits=0, uint32_t AlignInBits=0, DINode::DIFlags Flags=DINode::FlagFwdDecl, StringRef UniqueIdentifier="", DINodeArray Annotations=nullptr, std::optional< uint32_t > EnumKind=std::nullopt)
Create a temporary forward-declared type.
LLVM_ABI DIFixedPointType * createDecimalFixedPointType(StringRef Name, DIFile *File, unsigned LineNo, DIScope *Context, uint64_t SizeInBits, uint32_t AlignInBits, unsigned Encoding, DINode::DIFlags Flags, int Factor)
Create debugging information entry for a decimal fixed-point type.
LLVM_ABI DITypeArray getOrCreateTypeArray(ArrayRef< Metadata * > Elements)
Get a DITypeArray, create one if required.
LLVM_ABI DICompositeType * createEnumerationType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, DINodeArray Elements, DIType *UnderlyingType, unsigned RunTimeLang=0, StringRef UniqueIdentifier="", bool IsScoped=false, std::optional< uint32_t > EnumKind=std::nullopt)
Create debugging information entry for an enumeration.
LLVM_ABI DIFixedPointType * createBinaryFixedPointType(StringRef Name, DIFile *File, unsigned LineNo, DIScope *Context, uint64_t SizeInBits, uint32_t AlignInBits, unsigned Encoding, DINode::DIFlags Flags, int Factor)
Create debugging information entry for a binary fixed-point type.
LLVM_ABI DbgRecord * insertDeclareValue(Value *Storage, DILocalVariable *VarInfo, DIExpression *Expr, const DILocation *DL, InsertPosition InsertPt)
Insert a new dbg_declare_value record.
LLVM_ABI DIBasicType * createBasicType(StringRef Name, uint64_t SizeInBits, unsigned Encoding, DINode::DIFlags Flags=DINode::FlagZero, uint32_t NumExtraInhabitants=0, uint32_t DataSizeInBits=0)
Create debugging information entry for a basic type.
LLVM_ABI DISubrange * getOrCreateSubrange(int64_t Lo, int64_t Count)
Create a descriptor for a value range.
LLVM_ABI DISubrangeType * createSubrangeType(StringRef Name, DIFile *File, unsigned LineNo, DIScope *Scope, uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags, DIType *Ty, Metadata *LowerBound, Metadata *UpperBound, Metadata *Stride, Metadata *Bias)
Create a type describing a subrange of another type.
LLVM_ABI DIDerivedType * createReferenceType(unsigned Tag, DIType *RTy, uint64_t SizeInBits=0, uint32_t AlignInBits=0, std::optional< unsigned > DWARFAddressSpace=std::nullopt)
Create debugging information entry for a c++ style reference or rvalue reference type.
LLVM_ABI DIMacroFile * createTempMacroFile(DIMacroFile *Parent, unsigned Line, DIFile *File)
Create debugging information temporary entry for a macro file.
LLVM_ABI DICompositeType * createArrayType(uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts, PointerUnion< DIExpression *, DIVariable * > DataLocation=nullptr, PointerUnion< DIExpression *, DIVariable * > Associated=nullptr, PointerUnion< DIExpression *, DIVariable * > Allocated=nullptr, PointerUnion< DIExpression *, DIVariable * > Rank=nullptr)
Create debugging information entry for an array.
LLVM_ABI DIDerivedType * createMemberPointerType(DIType *PointeeTy, DIType *Class, uint64_t SizeInBits, uint32_t AlignInBits=0, DINode::DIFlags Flags=DINode::FlagZero)
Create debugging information entry for a pointer to member.
LLVM_ABI DbgRecord * insertDeclare(Value *Storage, DILocalVariable *VarInfo, DIExpression *Expr, const DILocation *DL, BasicBlock *InsertAtEnd)
Insert a new dbg_declare record.
LLVM_ABI DINodeArray getOrCreateArray(ArrayRef< Metadata * > Elements)
Get a DINodeArray, create one if required.
LLVM_ABI DICompileUnit * createCompileUnit(DISourceLanguageName Lang, DIFile *File, StringRef Producer, bool isOptimized, StringRef Flags, unsigned RV, StringRef SplitName=StringRef(), DICompileUnit::DebugEmissionKind Kind=DICompileUnit::DebugEmissionKind::FullDebug, uint64_t DWOId=0, bool SplitDebugInlining=true, bool DebugInfoForProfiling=false, DICompileUnit::DebugNameTableKind NameTableKind=DICompileUnit::DebugNameTableKind::Default, bool RangesBaseAddress=false, StringRef SysRoot={}, StringRef SDK={})
A CompileUnit provides an anchor for all debugging information generated during this instance of comp...
LLVM_ABI DIEnumerator * createEnumerator(StringRef Name, const APSInt &Value)
Create a single enumerator value.
LLVM_ABI DITemplateTypeParameter * createTemplateTypeParameter(DIScope *Scope, StringRef Name, DIType *Ty, bool IsDefault)
Create debugging information for template type parameter.
LLVM_ABI DIBuilder(Module &M, bool AllowUnresolved=true, DICompileUnit *CU=nullptr)
Construct a builder for a module.
Definition DIBuilder.cpp:27
LLVM_ABI DIExpression * createExpression(ArrayRef< uint64_t > Addr={})
Create a new descriptor for the specified variable which has a complex address expression for its add...
LLVM_ABI DIDerivedType * createPtrAuthQualifiedType(DIType *FromTy, unsigned Key, bool IsAddressDiscriminated, unsigned ExtraDiscriminator, bool IsaPointer, bool authenticatesNullValues)
Create a __ptrauth qualifier.
LLVM_ABI DbgRecord * insertLabel(DILabel *LabelInfo, const DILocation *DL, InsertPosition InsertPt)
Insert a new dbg_label record.
LLVM_ABI DICompositeType * createForwardDecl(unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line, unsigned RuntimeLang=0, uint64_t SizeInBits=0, uint32_t AlignInBits=0, StringRef UniqueIdentifier="", std::optional< uint32_t > EnumKind=std::nullopt)
Create a permanent forward-declared type.
LLVM_ABI DICompositeType * createVariantPart(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags, DIDerivedType *Discriminator, DINodeArray Elements, StringRef UniqueIdentifier="")
Create debugging information entry for a variant part.
LLVM_ABI DIImportedEntity * createImportedModule(DIScope *Context, DINamespace *NS, DIFile *File, unsigned Line, DINodeArray Elements=nullptr)
Create a descriptor for an imported module.
LLVM_ABI DIImportedEntity * createImportedDeclaration(DIScope *Context, DINode *Decl, DIFile *File, unsigned Line, StringRef Name="", DINodeArray Elements=nullptr)
Create a descriptor for an imported function.
LLVM_ABI DILocalVariable * createAutoVariable(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, DIType *Ty, bool AlwaysPreserve=false, DINode::DIFlags Flags=DINode::FlagZero, uint32_t AlignInBits=0)
Create a new descriptor for an auto variable.
static LLVM_ABI DISubprogram * createArtificialSubprogram(DISubprogram *SP)
Create a distinct clone of SP with FlagArtificial set.
LLVM_ABI DIGenericSubrange * getOrCreateGenericSubrange(DIGenericSubrange::BoundType Count, DIGenericSubrange::BoundType LowerBound, DIGenericSubrange::BoundType UpperBound, DIGenericSubrange::BoundType Stride)
LLVM_ABI DIBasicType * createUnspecifiedType(StringRef Name)
Create a DWARF unspecified type.
LLVM_ABI DIObjCProperty * createObjCProperty(StringRef Name, DIFile *File, unsigned LineNumber, StringRef GetterName, StringRef SetterName, unsigned PropertyAttributes, DIType *Ty)
Create debugging information entry for Objective-C property.
LLVM_ABI DITemplateValueParameter * createTemplateValueParameter(DIScope *Scope, StringRef Name, DIType *Ty, bool IsDefault, Constant *Val)
Create debugging information for template value parameter.
LLVM_ABI DILocalVariable * createParameterVariable(DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File, unsigned LineNo, DIType *Ty, bool AlwaysPreserve=false, DINode::DIFlags Flags=DINode::FlagZero, DINodeArray Annotations=nullptr)
Create a new descriptor for a parameter variable.
LLVM_ABI DIFile * createFile(StringRef Filename, StringRef Directory, std::optional< DIFile::ChecksumInfo< StringRef > > Checksum=std::nullopt, std::optional< StringRef > Source=std::nullopt)
Create a file descriptor to hold debugging information for a file.
LLVM_ABI void replaceArrays(DICompositeType *&T, DINodeArray Elements, DINodeArray TParams=DINodeArray())
Replace arrays on a composite type.
LLVM_ABI DIModule * createModule(DIScope *Scope, StringRef Name, StringRef ConfigurationMacros, StringRef IncludePath, StringRef APINotesFile={}, DIFile *File=nullptr, unsigned LineNo=0, bool IsDecl=false)
This creates new descriptor for a module with the specified parent scope.
Debug common block.
DWARF expression.
PointerUnion< DIVariable *, DIExpression * > BoundType
Represents a module in the programming language, for example, a Clang module, or a Fortran module.
Debug lexical block.
DIFlags
Debug info flags.
Base class for scope-like contexts.
Wrapper structure that holds source language identity metadata that includes language name,...
Subprogram description. Uses SubclassData1.
DISPFlags
Debug info subprogram flags.
Type array for a subprogram.
Base class for types.
Base class for non-instruction debug metadata records that have positions within IR.
Record of a variable value-assignment, aka a non instruction representation of the dbg....
This is an important class for using LLVM in a threaded context.
Definition LLVMContext.h:68
Metadata node.
Definition Metadata.h:1069
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition Metadata.h:1567
static std::enable_if_t< std::is_base_of< MDNode, T >::value, T * > replaceWithUniqued(std::unique_ptr< T, TempMDNodeDeleter > N)
Replace a temporary node with a uniqued one.
Definition Metadata.h:1301
This class implements a map that also provides access to all stored values in a deterministic order.
Definition MapVector.h:38
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:67
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
LLVM Value Representation.
Definition Value.h:75
struct LLVMOpaqueDIBuilder * LLVMDIBuilderRef
Represents an LLVM debug info builder.
Definition Types.h:117
This namespace contains an enum with a value for every intrinsic/builtin function known by LLVM.
This is an optimization pass for GlobalISel generic memory operations.
@ Implicit
Not emitted register (e.g. carry, or temporary result).
bool isa_and_nonnull(const Y &Val)
Definition Casting.h:676
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Count
Definition InstrProf.h:145
ArrayRef(const T &OneElt) -> ArrayRef< T >
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:559
#define N