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