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