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 property, i.e. an entity that
552 /// is accessed like a data member but whose access is implemented by an
553 /// accessor.
554 /// \param Name Property name.
555 /// \param File File where this property is defined.
556 /// \param LineNumber Line number.
557 /// \param Ty Type of the property.
558 /// \param BackingStorage The data member holding the property's backing
559 /// storage.
560 LLVM_ABI DIProperty *createProperty(StringRef Name, DIFile *File,
561 unsigned LineNumber, DIType *Ty,
562 DIDerivedType *BackingStorage);
563
564 /// Create debugging information entry for a class.
565 /// \param Scope Scope in which this class is defined.
566 /// \param Name class name.
567 /// \param File File where this member is defined.
568 /// \param LineNumber Line number.
569 /// \param SizeInBits Member size.
570 /// \param AlignInBits Member alignment.
571 /// \param OffsetInBits Member offset.
572 /// \param Flags Flags to encode member attribute, e.g. private
573 /// \param Elements class members.
574 /// \param RunTimeLang Optional parameter, Objective-C runtime version.
575 /// \param VTableHolder Debug info of the base class that contains vtable
576 /// for this type. This is used in
577 /// DW_AT_containing_type. See DWARF documentation
578 /// for more info.
579 /// \param TemplateParms Template type parameters.
580 /// \param UniqueIdentifier A unique identifier for the class.
581 /// \param Annotations Attribute annotations, emitted as
582 /// DW_TAG_LLVM_annotation entries.
583 LLVM_ABI DICompositeType *createClassType(
584 DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
585 uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
586 DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements,
587 unsigned RunTimeLang = 0, DIType *VTableHolder = nullptr,
588 MDNode *TemplateParms = nullptr, StringRef UniqueIdentifier = "",
589 DINodeArray Annotations = nullptr);
590
591 /// Create debugging information entry for a struct.
592 /// \param Scope Scope in which this struct is defined.
593 /// \param Name Struct name.
594 /// \param File File where this member is defined.
595 /// \param LineNumber Line number.
596 /// \param SizeInBits Member size.
597 /// \param AlignInBits Member alignment.
598 /// \param Flags Flags to encode member attribute, e.g. private
599 /// \param Elements Struct elements.
600 /// \param RunTimeLang Optional parameter, Objective-C runtime version.
601 /// \param UniqueIdentifier A unique identifier for the struct.
602 /// \param Specification The type that this type completes. This is used by
603 /// Swift to represent generic types.
604 /// \param NumExtraInhabitants The number of extra inhabitants of the type.
605 /// An extra inhabitant is a bit pattern that does not represent a valid
606 /// value for instances of a given type. This is used by the Swift language.
607 /// \param Annotations Attribute annotations, emitted as
608 /// DW_TAG_LLVM_annotation entries.
609 LLVM_ABI DICompositeType *createStructType(
610 DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
611 Metadata *SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags,
612 DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang = 0,
613 DIType *VTableHolder = nullptr, StringRef UniqueIdentifier = "",
614 DIType *Specification = nullptr, uint32_t NumExtraInhabitants = 0,
615 DINodeArray Annotations = nullptr);
616
617 /// Create debugging information entry for a struct.
618 /// \param Scope Scope in which this struct is defined.
619 /// \param Name Struct name.
620 /// \param File File where this member is defined.
621 /// \param LineNumber Line number.
622 /// \param SizeInBits Member size.
623 /// \param AlignInBits Member alignment.
624 /// \param Flags Flags to encode member attribute, e.g. private
625 /// \param Elements Struct elements.
626 /// \param RunTimeLang Optional parameter, Objective-C runtime version.
627 /// \param UniqueIdentifier A unique identifier for the struct.
628 /// \param Specification The type that this type completes. This is used by
629 /// Swift to represent generic types.
630 /// \param NumExtraInhabitants The number of extra inhabitants of the type.
631 /// An extra inhabitant is a bit pattern that does not represent a valid
632 /// value for instances of a given type. This is used by the Swift language.
633 /// \param Annotations Attribute annotations, emitted as
634 /// DW_TAG_LLVM_annotation entries.
635 LLVM_ABI DICompositeType *createStructType(
636 DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
637 uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags,
638 DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang = 0,
639 DIType *VTableHolder = nullptr, StringRef UniqueIdentifier = "",
640 DIType *Specification = nullptr, uint32_t NumExtraInhabitants = 0,
641 DINodeArray Annotations = nullptr);
642
643 /// Create debugging information entry for an union.
644 /// \param Scope Scope in which this union is defined.
645 /// \param Name Union name.
646 /// \param File File where this member is defined.
647 /// \param LineNumber Line number.
648 /// \param SizeInBits Member size.
649 /// \param AlignInBits Member alignment.
650 /// \param Flags Flags to encode member attribute, e.g. private
651 /// \param Elements Union elements.
652 /// \param RunTimeLang Optional parameter, Objective-C runtime version.
653 /// \param UniqueIdentifier A unique identifier for the union.
654 /// \param Annotations Attribute annotations, emitted as
655 /// DW_TAG_LLVM_annotation entries.
656 LLVM_ABI DICompositeType *createUnionType(
657 DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
658 uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags,
659 DINodeArray Elements, unsigned RunTimeLang = 0,
660 StringRef UniqueIdentifier = "", DINodeArray Annotations = nullptr);
661
662 /// Create debugging information entry for a variant part. A
663 /// variant part normally has a discriminator (though this is not
664 /// required) and a number of variant children.
665 /// \param Scope Scope in which this union is defined.
666 /// \param Name Union name.
667 /// \param File File where this member is defined.
668 /// \param LineNumber Line number.
669 /// \param SizeInBits Member size.
670 /// \param AlignInBits Member alignment.
671 /// \param Flags Flags to encode member attribute, e.g. private
672 /// \param Discriminator Discriminant member
673 /// \param Elements Variant elements.
674 /// \param UniqueIdentifier A unique identifier for the union.
675 LLVM_ABI DICompositeType *
676 createVariantPart(DIScope *Scope, StringRef Name, DIFile *File,
677 unsigned LineNumber, uint64_t SizeInBits,
678 uint32_t AlignInBits, DINode::DIFlags Flags,
679 DIDerivedType *Discriminator, DINodeArray Elements,
680 StringRef UniqueIdentifier = "");
681
682 /// Create debugging information for template
683 /// type parameter.
684 /// \param Scope Scope in which this type is defined.
685 /// \param Name Type parameter name.
686 /// \param Ty Parameter type.
687 /// \param IsDefault Parameter is default or not
688 LLVM_ABI DITemplateTypeParameter *
689 createTemplateTypeParameter(DIScope *Scope, StringRef Name, DIType *Ty,
690 bool IsDefault);
691
692 /// Create debugging information for template
693 /// value parameter.
694 /// \param Scope Scope in which this type is defined.
695 /// \param Name Value parameter name.
696 /// \param Ty Parameter type.
697 /// \param IsDefault Parameter is default or not
698 /// \param Val Constant parameter value.
699 LLVM_ABI DITemplateValueParameter *
700 createTemplateValueParameter(DIScope *Scope, StringRef Name, DIType *Ty,
701 bool IsDefault, Constant *Val);
702
703 /// Create debugging information for a template template parameter.
704 /// \param Scope Scope in which this type is defined.
705 /// \param Name Value parameter name.
706 /// \param Ty Parameter type.
707 /// \param Val The fully qualified name of the template.
708 /// \param IsDefault Parameter is default or not.
709 LLVM_ABI DITemplateValueParameter *
710 createTemplateTemplateParameter(DIScope *Scope, StringRef Name, DIType *Ty,
711 StringRef Val, bool IsDefault = false);
712
713 /// Create debugging information for a template parameter pack.
714 /// \param Scope Scope in which this type is defined.
715 /// \param Name Value parameter name.
716 /// \param Ty Parameter type.
717 /// \param Val An array of types in the pack.
718 LLVM_ABI DITemplateValueParameter *
719 createTemplateParameterPack(DIScope *Scope, StringRef Name, DIType *Ty,
720 DINodeArray Val);
721
722 /// Create debugging information entry for an array.
723 /// \param Size Array size.
724 /// \param AlignInBits Alignment.
725 /// \param Ty Element type.
726 /// \param Subscripts Subscripts.
727 /// \param DataLocation The location of the raw data of a descriptor-based
728 /// Fortran array, either a DIExpression* or
729 /// a DIVariable*.
730 /// \param Associated The associated attribute of a descriptor-based
731 /// Fortran array, either a DIExpression* or
732 /// a DIVariable*.
733 /// \param Allocated The allocated attribute of a descriptor-based
734 /// Fortran array, either a DIExpression* or
735 /// a DIVariable*.
736 /// \param Rank The rank attribute of a descriptor-based
737 /// Fortran array, either a DIExpression* or
738 /// a DIVariable*.
739 LLVM_ABI DICompositeType *createArrayType(
740 uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts,
741 PointerUnion<DIExpression *, DIVariable *> DataLocation = nullptr,
742 PointerUnion<DIExpression *, DIVariable *> Associated = nullptr,
743 PointerUnion<DIExpression *, DIVariable *> Allocated = nullptr,
744 PointerUnion<DIExpression *, DIVariable *> Rank = nullptr);
745
746 /// Create debugging information entry for an array.
747 /// \param Scope Scope in which this enumeration is defined.
748 /// \param Name Union name.
749 /// \param File File where this member is defined.
750 /// \param LineNumber Line number.
751 /// \param Size Array size.
752 /// \param AlignInBits Alignment.
753 /// \param Ty Element type.
754 /// \param Subscripts Subscripts.
755 /// \param DataLocation The location of the raw data of a descriptor-based
756 /// Fortran array, either a DIExpression* or
757 /// a DIVariable*.
758 /// \param Associated The associated attribute of a descriptor-based
759 /// Fortran array, either a DIExpression* or
760 /// a DIVariable*.
761 /// \param Allocated The allocated attribute of a descriptor-based
762 /// Fortran array, either a DIExpression* or
763 /// a DIVariable*.
764 /// \param Rank The rank attribute of a descriptor-based
765 /// Fortran array, either a DIExpression* or
766 /// a DIVariable*.
767 /// \param BitStride The bit size of an element of the array.
768 LLVM_ABI DICompositeType *createArrayType(
769 DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
770 uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts,
771 PointerUnion<DIExpression *, DIVariable *> DataLocation = nullptr,
772 PointerUnion<DIExpression *, DIVariable *> Associated = nullptr,
773 PointerUnion<DIExpression *, DIVariable *> Allocated = nullptr,
774 PointerUnion<DIExpression *, DIVariable *> Rank = nullptr,
775 Metadata *BitStride = nullptr);
776
777 /// Create debugging information entry for a vector type.
778 /// \param Size Array size.
779 /// \param AlignInBits Alignment.
780 /// \param Ty Element type.
781 /// \param Subscripts Subscripts.
782 LLVM_ABI DICompositeType *createVectorType(uint64_t Size,
783 uint32_t AlignInBits, DIType *Ty,
784 DINodeArray Subscripts,
785 Metadata *BitStride = nullptr);
786
787 /// Create debugging information entry for an
788 /// enumeration.
789 /// \param Scope Scope in which this enumeration is defined.
790 /// \param Name Union name.
791 /// \param File File where this member is defined.
792 /// \param LineNumber Line number.
793 /// \param SizeInBits Member size.
794 /// \param AlignInBits Member alignment.
795 /// \param Elements Enumeration elements.
796 /// \param UnderlyingType Underlying type of a C++11/ObjC fixed enum.
797 /// \param RunTimeLang Optional parameter, Objective-C runtime version.
798 /// \param UniqueIdentifier A unique identifier for the enum.
799 /// \param IsScoped Boolean flag indicate if this is C++11/ObjC 'enum
800 /// class'.
801 LLVM_ABI DICompositeType *createEnumerationType(
802 DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
803 uint64_t SizeInBits, uint32_t AlignInBits, DINodeArray Elements,
804 DIType *UnderlyingType, unsigned RunTimeLang = 0,
805 StringRef UniqueIdentifier = "", bool IsScoped = false,
806 std::optional<uint32_t> EnumKind = std::nullopt);
807 /// Create debugging information entry for a set.
808 /// \param Scope Scope in which this set is defined.
809 /// \param Name Set name.
810 /// \param File File where this set is defined.
811 /// \param LineNo Line number.
812 /// \param SizeInBits Set size.
813 /// \param AlignInBits Set alignment.
814 /// \param Ty Base type of the set.
815 LLVM_ABI DIDerivedType *createSetType(DIScope *Scope, StringRef Name,
816 DIFile *File, unsigned LineNo,
817 uint64_t SizeInBits,
818 uint32_t AlignInBits, DIType *Ty);
819
820 /// Create subroutine type.
821 /// \param ParameterTypes An array of subroutine parameter types. This
822 /// includes return type at 0th index.
823 /// \param Flags E.g.: LValueReference.
824 /// These flags are used to emit dwarf attributes.
825 /// \param CC Calling convention, e.g. dwarf::DW_CC_normal
826 LLVM_ABI DISubroutineType *
827 createSubroutineType(DITypeArray ParameterTypes,
828 DINode::DIFlags Flags = DINode::FlagZero,
829 unsigned CC = 0);
830
831 /// Create a distinct clone of \p SP with FlagArtificial set.
832 LLVM_ABI static DISubprogram *createArtificialSubprogram(DISubprogram *SP);
833
834 /// Create a uniqued clone of \p Ty with FlagArtificial set.
835 LLVM_ABI static DIType *createArtificialType(DIType *Ty);
836
837 /// Create a uniqued clone of \p Ty with FlagObjectPointer set.
838 /// If \p Implicit is true, also set FlagArtificial.
839 LLVM_ABI static DIType *createObjectPointerType(DIType *Ty, bool Implicit);
840
841 /// Create a type describing a subrange of another type.
842 /// \param Scope Scope in which this set is defined.
843 /// \param Name Set name.
844 /// \param File File where this set is defined.
845 /// \param LineNo Line number.
846 /// \param SizeInBits Size.
847 /// \param AlignInBits Alignment.
848 /// \param Flags Flags to encode attributes.
849 /// \param Ty Base type.
850 /// \param LowerBound Lower bound.
851 /// \param UpperBound Upper bound.
852 /// \param Stride Stride, if any.
853 /// \param Bias Bias, if any.
854 LLVM_ABI DISubrangeType *
855 createSubrangeType(StringRef Name, DIFile *File, unsigned LineNo,
856 DIScope *Scope, uint64_t SizeInBits,
857 uint32_t AlignInBits, DINode::DIFlags Flags, DIType *Ty,
858 Metadata *LowerBound, Metadata *UpperBound,
859 Metadata *Stride, Metadata *Bias);
860
861 /// Create a permanent forward-declared type.
862 LLVM_ABI DICompositeType *
863 createForwardDecl(unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F,
864 unsigned Line, unsigned RuntimeLang = 0,
865 uint64_t SizeInBits = 0, uint32_t AlignInBits = 0,
866 StringRef UniqueIdentifier = "",
867 std::optional<uint32_t> EnumKind = std::nullopt);
868
869 /// Create a temporary forward-declared type.
871 unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line,
872 unsigned RuntimeLang = 0, uint64_t SizeInBits = 0,
873 uint32_t AlignInBits = 0, DINode::DIFlags Flags = DINode::FlagFwdDecl,
874 StringRef UniqueIdentifier = "", DINodeArray Annotations = nullptr,
875 std::optional<uint32_t> EnumKind = std::nullopt);
876
877 /// Retain DIScope* in a module even if it is not referenced
878 /// through debug info anchors.
879 LLVM_ABI void retainType(DIScope *T);
880
881 /// Create unspecified parameter type
882 /// for a subroutine type.
884
885 /// Get a DINodeArray, create one if required.
886 LLVM_ABI DINodeArray getOrCreateArray(ArrayRef<Metadata *> Elements);
887
888 /// Get a DIMacroNodeArray, create one if required.
889 LLVM_ABI DIMacroNodeArray
891
892 /// Get a DITypeArray, create one if required.
894
895 /// Create a descriptor for a value range. This
896 /// implicitly uniques the values returned.
897 LLVM_ABI DISubrange *getOrCreateSubrange(int64_t Lo, int64_t Count);
898 LLVM_ABI DISubrange *getOrCreateSubrange(int64_t Lo, Metadata *CountNode);
900 Metadata *LowerBound,
901 Metadata *UpperBound,
902 Metadata *Stride);
903
904 LLVM_ABI DIGenericSubrange *
909
910 /// Create a new descriptor for the specified variable.
911 /// \param Context Variable scope.
912 /// \param Name Name of the variable.
913 /// \param LinkageName Mangled name of the variable.
914 /// \param File File where this variable is defined.
915 /// \param LineNo Line number.
916 /// \param Ty Variable Type.
917 /// \param IsLocalToUnit Boolean flag indicate whether this variable is
918 /// externally visible or not.
919 /// \param Expr The location of the global relative to the attached
920 /// GlobalVariable.
921 /// \param Decl Reference to the corresponding declaration.
922 /// \param AlignInBits Variable alignment(or 0 if no alignment attr was
923 /// specified)
924 LLVM_ABI DIGlobalVariableExpression *createGlobalVariableExpression(
925 DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
926 unsigned LineNo, DIType *Ty, bool IsLocalToUnit, bool isDefined = true,
927 DIExpression *Expr = nullptr, MDNode *Decl = nullptr,
928 MDTuple *TemplateParams = nullptr, uint32_t AlignInBits = 0,
929 DINodeArray Annotations = nullptr);
930
931 /// Identical to createGlobalVariable
932 /// except that the resulting DbgNode is temporary and meant to be RAUWed.
934 DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
935 unsigned LineNo, DIType *Ty, bool IsLocalToUnit, MDNode *Decl = nullptr,
936 MDTuple *TemplateParams = nullptr, uint32_t AlignInBits = 0);
937
938 /// Create a new descriptor for an auto variable. This is a local variable
939 /// that is not a subprogram parameter.
940 ///
941 /// \c Scope must be a \a DILocalScope, and thus its scope chain eventually
942 /// leads to a \a DISubprogram.
943 ///
944 /// If \c AlwaysPreserve, this variable will be referenced from its
945 /// containing subprogram, and will survive some optimizations.
946 LLVM_ABI DILocalVariable *
947 createAutoVariable(DIScope *Scope, StringRef Name, DIFile *File,
948 unsigned LineNo, DIType *Ty, bool AlwaysPreserve = false,
949 DINode::DIFlags Flags = DINode::FlagZero,
950 uint32_t AlignInBits = 0);
951
952 /// Create a new descriptor for an label.
953 ///
954 /// \c Scope must be a \a DILocalScope, and thus its scope chain eventually
955 /// leads to a \a DISubprogram.
956 LLVM_ABI DILabel *createLabel(DIScope *Scope, StringRef Name, DIFile *File,
957 unsigned LineNo, unsigned Column,
958 bool IsArtificial,
959 std::optional<unsigned> CoroSuspendIdx,
960 bool AlwaysPreserve = false);
961
962 /// Create a new descriptor for a parameter variable.
963 ///
964 /// \c Scope must be a \a DILocalScope, and thus its scope chain eventually
965 /// leads to a \a DISubprogram.
966 ///
967 /// \c ArgNo is the index (starting from \c 1) of this variable in the
968 /// subprogram parameters. \c ArgNo should not conflict with other
969 /// parameters of the same subprogram.
970 ///
971 /// If \c AlwaysPreserve, this variable will be referenced from its
972 /// containing subprogram, and will survive some optimizations.
973 LLVM_ABI DILocalVariable *
974 createParameterVariable(DIScope *Scope, StringRef Name, unsigned ArgNo,
975 DIFile *File, unsigned LineNo, DIType *Ty,
976 bool AlwaysPreserve = false,
977 DINode::DIFlags Flags = DINode::FlagZero,
978 DINodeArray Annotations = nullptr);
979
980 /// Create a new descriptor for the specified
981 /// variable which has a complex address expression for its address.
982 /// \param Addr An array of complex address operations.
983 LLVM_ABI DIExpression *createExpression(ArrayRef<uint64_t> Addr = {});
984
985 /// Create an expression for a variable that does not have an address, but
986 /// does have a constant value.
988 return DIExpression::get(
989 VMContext, {dwarf::DW_OP_constu, Val, dwarf::DW_OP_stack_value});
990 }
991
992 /// Create a new descriptor for the specified subprogram.
993 /// See comments in DISubprogram* for descriptions of these fields.
994 /// \param Scope Function scope.
995 /// \param Name Function name.
996 /// \param LinkageName Mangled function name.
997 /// \param File File where this variable is defined.
998 /// \param LineNo Line number.
999 /// \param Ty Function type.
1000 /// \param ScopeLine Set to the beginning of the scope this starts
1001 /// \param Flags e.g. is this function prototyped or not.
1002 /// These flags are used to emit dwarf attributes.
1003 /// \param SPFlags Additional flags specific to subprograms.
1004 /// \param TParams Function template parameters.
1005 /// \param ThrownTypes Exception types this function may throw.
1006 /// \param Annotations Attribute Annotations.
1007 /// \param TargetFuncName The name of the target function if this is
1008 /// a trampoline.
1009 /// \param UseKeyInstructions Instruct DWARF emission to interpret Key
1010 /// Instructions metadata on instructions to determine is_stmt placement.
1012 DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File,
1013 unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine,
1014 DINode::DIFlags Flags = DINode::FlagZero,
1015 DISubprogram::DISPFlags SPFlags = DISubprogram::SPFlagZero,
1016 DITemplateParameterArray TParams = nullptr,
1017 DISubprogram *Decl = nullptr, DITypeArray ThrownTypes = nullptr,
1018 DINodeArray Annotations = nullptr, StringRef TargetFuncName = "",
1019 bool UseKeyInstructions = false);
1020
1021 /// Identical to createFunction,
1022 /// except that the resulting DbgNode is meant to be RAUWed.
1024 DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File,
1025 unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine,
1026 DINode::DIFlags Flags = DINode::FlagZero,
1027 DISubprogram::DISPFlags SPFlags = DISubprogram::SPFlagZero,
1028 DITemplateParameterArray TParams = nullptr,
1029 DISubprogram *Decl = nullptr, DITypeArray ThrownTypes = nullptr);
1030
1031 /// Create a new descriptor for the specified C++ method.
1032 /// See comments in \a DISubprogram* for descriptions of these fields.
1033 /// \param Scope Function scope.
1034 /// \param Name Function name.
1035 /// \param LinkageName Mangled function name.
1036 /// \param File File where this variable is defined.
1037 /// \param LineNo Line number.
1038 /// \param Ty Function type.
1039 /// \param VTableIndex Index no of this method in virtual table, or -1u if
1040 /// unrepresentable.
1041 /// \param ThisAdjustment
1042 /// MS ABI-specific adjustment of 'this' that occurs
1043 /// in the prologue.
1044 /// \param VTableHolder Type that holds vtable.
1045 /// \param Flags e.g. is this function prototyped or not.
1046 /// This flags are used to emit dwarf attributes.
1047 /// \param SPFlags Additional flags specific to subprograms.
1048 /// \param TParams Function template parameters.
1049 /// \param ThrownTypes Exception types this function may throw.
1050 /// \param UseKeyInstructions Enable Key Instructions debug info.
1052 DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File,
1053 unsigned LineNo, DISubroutineType *Ty, unsigned VTableIndex = 0,
1054 int ThisAdjustment = 0, DIType *VTableHolder = nullptr,
1055 DINode::DIFlags Flags = DINode::FlagZero,
1056 DISubprogram::DISPFlags SPFlags = DISubprogram::SPFlagZero,
1057 DITemplateParameterArray TParams = nullptr,
1058 DITypeArray ThrownTypes = nullptr, bool UseKeyInstructions = false);
1059
1060 /// Create common block entry for a Fortran common block.
1061 /// \param Scope Scope of this common block.
1062 /// \param decl Global variable declaration.
1063 /// \param Name The name of this common block.
1064 /// \param File The file this common block is defined.
1065 /// \param LineNo Line number.
1067 DIGlobalVariable *decl,
1068 StringRef Name, DIFile *File,
1069 unsigned LineNo);
1070
1071 /// This creates new descriptor for a namespace with the specified
1072 /// parent scope.
1073 /// \param Scope Namespace scope
1074 /// \param Name Name of this namespace
1075 /// \param ExportSymbols True for C++ inline namespaces.
1077 bool ExportSymbols);
1078
1079 /// This creates new descriptor for a module with the specified
1080 /// parent scope.
1081 /// \param Scope Parent scope
1082 /// \param Name Name of this module
1083 /// \param ConfigurationMacros
1084 /// A space-separated shell-quoted list of -D macro
1085 /// definitions as they would appear on a command line.
1086 /// \param IncludePath The path to the module map file.
1087 /// \param APINotesFile The path to an API notes file for this module.
1088 /// \param File Source file of the module.
1089 /// Used for Fortran modules.
1090 /// \param LineNo Source line number of the module.
1091 /// Used for Fortran modules.
1092 /// \param IsDecl This is a module declaration; default to false;
1093 /// when set to true, only Scope and Name are required
1094 /// as this entry is just a hint for the debugger to find
1095 /// the corresponding definition in the global scope.
1097 StringRef ConfigurationMacros,
1098 StringRef IncludePath,
1099 StringRef APINotesFile = {},
1100 DIFile *File = nullptr, unsigned LineNo = 0,
1101 bool IsDecl = false);
1102
1103 /// This creates a descriptor for a lexical block with a new file
1104 /// attached. This merely extends the existing
1105 /// lexical block as it crosses a file.
1106 /// \param Scope Lexical block.
1107 /// \param File Source file.
1108 /// \param Discriminator DWARF path discriminator value.
1109 LLVM_ABI DILexicalBlockFile *
1110 createLexicalBlockFile(DIScope *Scope, DIFile *File,
1111 unsigned Discriminator = 0);
1112
1113 /// This creates a descriptor for a lexical block with the
1114 /// specified parent context.
1115 /// \param Scope Parent lexical scope.
1116 /// \param File Source file.
1117 /// \param Line Line number.
1118 /// \param Col Column number.
1119 LLVM_ABI DILexicalBlock *createLexicalBlock(DIScope *Scope, DIFile *File,
1120 unsigned Line, unsigned Col);
1121
1122 /// Create a descriptor for an imported module.
1123 /// \param Context The scope this module is imported into
1124 /// \param NS The namespace being imported here.
1125 /// \param File File where the declaration is located.
1126 /// \param Line Line number of the declaration.
1127 /// \param Elements Renamed elements.
1128 LLVM_ABI DIImportedEntity *
1129 createImportedModule(DIScope *Context, DINamespace *NS, DIFile *File,
1130 unsigned Line, DINodeArray Elements = nullptr);
1131
1132 /// Create a descriptor for an imported module.
1133 /// \param Context The scope this module is imported into.
1134 /// \param NS An aliased namespace.
1135 /// \param File File where the declaration is located.
1136 /// \param Line Line number of the declaration.
1137 /// \param Elements Renamed elements.
1138 LLVM_ABI DIImportedEntity *
1139 createImportedModule(DIScope *Context, DIImportedEntity *NS, DIFile *File,
1140 unsigned Line, DINodeArray Elements = nullptr);
1141
1142 /// Create a descriptor for an imported module.
1143 /// \param Context The scope this module is imported into.
1144 /// \param M The module being imported here
1145 /// \param File File where the declaration is located.
1146 /// \param Line Line number of the declaration.
1147 /// \param Elements Renamed elements.
1148 LLVM_ABI DIImportedEntity *
1149 createImportedModule(DIScope *Context, DIModule *M, DIFile *File,
1150 unsigned Line, DINodeArray Elements = nullptr);
1151
1152 /// Create a descriptor for an imported function.
1153 /// \param Context The scope this module is imported into.
1154 /// \param Decl The declaration (or definition) of a function, type, or
1155 /// variable.
1156 /// \param File File where the declaration is located.
1157 /// \param Line Line number of the declaration.
1158 /// \param Elements Renamed elements.
1159 LLVM_ABI DIImportedEntity *
1160 createImportedDeclaration(DIScope *Context, DINode *Decl, DIFile *File,
1161 unsigned Line, StringRef Name = "",
1162 DINodeArray Elements = nullptr);
1163
1164 /// Insert a new #dbg_declare record.
1165 /// \param Storage llvm::Value of the variable
1166 /// \param VarInfo Variable's debug info descriptor.
1167 /// \param Expr A complex location expression.
1168 /// \param DL Debug info location.
1169 /// \param InsertAtEnd Location for the new record.
1170 LLVM_ABI DbgRecord *insertDeclare(Value *Storage, DILocalVariable *VarInfo,
1171 DIExpression *Expr, const DILocation *DL,
1172 BasicBlock *InsertAtEnd);
1173
1174 /// Insert a new #dbg_assign record.
1175 /// \param LinkedInstr Instruction with a DIAssignID to link with the new
1176 /// record. The record will be inserted after this
1177 /// instruction.
1178 /// \param Val The value component of this #dbg_assign.
1179 /// \param SrcVar Variable's debug info descriptor.
1180 /// \param ValExpr A complex location expression to modify \p Val.
1181 /// \param Addr The address component (store destination).
1182 /// \param AddrExpr A complex location expression to modify \p Addr.
1183 /// NOTE: \p ValExpr carries the FragInfo for the
1184 /// variable.
1185 /// \param DL Debug info location, usually: (line: 0,
1186 /// column: 0, scope: var-decl-scope). See
1187 /// getDebugValueLoc.
1188 LLVM_ABI DbgRecord *insertDbgAssign(Instruction *LinkedInstr, Value *Val,
1189 DILocalVariable *SrcVar,
1190 DIExpression *ValExpr, Value *Addr,
1191 DIExpression *AddrExpr,
1192 const DILocation *DL);
1193
1194 /// Insert a new #dbg_declare record.
1195 /// \param Storage llvm::Value of the variable
1196 /// \param VarInfo Variable's debug info descriptor.
1197 /// \param Expr A complex location expression.
1198 /// \param DL Debug info location.
1199 /// \param InsertPt Location for the new record.
1200 LLVM_ABI DbgRecord *insertDeclare(llvm::Value *Storage,
1201 DILocalVariable *VarInfo,
1202 DIExpression *Expr, const DILocation *DL,
1203 InsertPosition InsertPt);
1204
1205 /// Insert a new #dbg_declare_value record.
1206 /// \param Storage llvm::Value of the variable
1207 /// \param VarInfo Variable's debug info descriptor.
1208 /// \param Expr A complex location expression.
1209 /// \param DL Debug info location.
1210 /// \param InsertPt Location for the new record.
1211 LLVM_ABI DbgRecord *insertDeclareValue(Value *Storage,
1212 DILocalVariable *VarInfo,
1213 DIExpression *Expr,
1214 const DILocation *DL,
1215 InsertPosition InsertPt);
1216
1217 /// Insert a new #dbg_label record.
1218 /// \param LabelInfo Label's debug info descriptor.
1219 /// \param DL Debug info location.
1220 /// \param InsertPt Location for the new record.
1221 LLVM_ABI DbgRecord *insertLabel(DILabel *LabelInfo, const DILocation *DL,
1222 InsertPosition InsertPt);
1223
1224 /// Insert a new #dbg_value record.
1225 /// \param Val llvm::Value of the variable
1226 /// \param VarInfo Variable's debug info descriptor.
1227 /// \param Expr A complex location expression.
1228 /// \param DL Debug info location.
1229 /// \param InsertPt Location for the new record.
1230 LLVM_ABI DbgRecord *insertDbgValue(llvm::Value *Val,
1231 DILocalVariable *VarInfo,
1232 DIExpression *Expr, const DILocation *DL,
1233 InsertPosition InsertPt);
1234
1235 /// Replace the vtable holder in the given type.
1236 ///
1237 /// If this creates a self reference, it may orphan some unresolved cycles
1238 /// in the operands of \c T, so \a DIBuilder needs to track that.
1239 LLVM_ABI void replaceVTableHolder(DICompositeType *&T,
1240 DIType *VTableHolder);
1241
1242 /// Replace arrays on a composite type.
1243 ///
1244 /// If \c T is resolved, but the arrays aren't -- which can happen if \c T
1245 /// has a self-reference -- \a DIBuilder needs to track the array to
1246 /// resolve cycles.
1247 LLVM_ABI void replaceArrays(DICompositeType *&T, DINodeArray Elements,
1248 DINodeArray TParams = DINodeArray());
1249
1250 /// Replace a temporary node.
1251 ///
1252 /// Call \a MDNode::replaceAllUsesWith() on \c N, replacing it with \c
1253 /// Replacement.
1254 ///
1255 /// If \c Replacement is the same as \c N.get(), instead call \a
1256 /// MDNode::replaceWithUniqued(). In this case, the uniqued node could
1257 /// have a different address, so we return the final address.
1258 template <class NodeTy>
1259 NodeTy *replaceTemporary(TempMDNode &&N, NodeTy *Replacement) {
1260 if (N.get() == Replacement)
1261 return cast<NodeTy>(MDNode::replaceWithUniqued(std::move(N)));
1262
1263 N->replaceAllUsesWith(Replacement);
1264 return Replacement;
1265 }
1266 };
1267
1268 // Create wrappers for C Binding types (see CBindingWrapping.h).
1270
1271} // end namespace llvm
1272
1273#endif // LLVM_IR_DIBUILDER_H
unsigned uint64_t
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:1259
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 DIProperty * createProperty(StringRef Name, DIFile *File, unsigned LineNumber, DIType *Ty, DIDerivedType *BackingStorage)
Create debugging information entry for a property, i.e.
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:987
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