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