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