28 : M(m), VMContext(M.getContext()), CUNode(
CU),
29 AllowUnresolvedNodes(AllowUnresolvedNodes) {
32 AllEnumTypes.assign(ETs.begin(), ETs.end());
34 AllRetainTypes.assign(RTs.begin(), RTs.end());
36 AllGVs.assign(GVs.begin(), GVs.end());
38 ImportedModules.assign(IMs.begin(), IMs.end());
39 if (
const auto &MNs = CUNode->
getMacros())
44void DIBuilder::trackIfUnresolved(
MDNode *
N) {
50 assert(AllowUnresolvedNodes &&
"Cannot handle unresolved nodes");
51 UnresolvedNodes.emplace_back(
N);
55 auto PN = SubprogramTrackedNodes.find(SP);
56 if (PN != SubprogramTrackedNodes.end())
57 SP->replaceRetainedNodes(
64 assert(!AllowUnresolvedNodes &&
65 "creating type nodes without a CU is not supported");
69 if (!AllEnumTypes.empty())
72 AllEnumTypes.end())));
84 if (!RetainValues.
empty())
87 for (
auto *SP : AllSubprograms)
89 for (
auto *
N : RetainValues)
90 if (
auto *SP = dyn_cast<DISubprogram>(
N))
96 if (!ImportedModules.empty())
99 ImportedModules.end())));
101 for (
const auto &
I : AllMacrosPerParent) {
108 auto *TMF = cast<DIMacroFile>(
I.first);
110 TMF->getLine(), TMF->getFile(),
117 for (
const auto &
N : UnresolvedNodes)
118 if (
N && !
N->isResolved())
120 UnresolvedNodes.clear();
123 AllowUnresolvedNodes =
false;
128 if (!
N || isa<DICompileUnit>(
N))
130 return cast<DIScope>(
N);
137 bool SplitDebugInlining,
bool DebugInfoForProfiling,
141 assert(((Lang <= dwarf::DW_LANG_Metal && Lang >= dwarf::DW_LANG_C89) ||
143 "Invalid Language tag");
145 assert(!CUNode &&
"Can only make one compile unit per DIBuilder instance");
147 VMContext, Lang, File, Producer, isOptimized, Flags, RunTimeVer,
148 SplitName, Kind,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr, DWOId,
149 SplitDebugInlining, DebugInfoForProfiling, NameTableKind,
150 RangesBaseAddress, SysRoot, SDK);
155 trackIfUnresolved(CUNode);
162 DINodeArray Elements,
165 assert(File &&
"Source location has line number but no file");
166 unsigned EntitiesCount =
C.pImpl->DIImportedEntitys.size();
168 File, Line,
Name, Elements);
169 if (EntitiesCount < C.pImpl->DIImportedEntitys.size())
179 DINodeArray Elements) {
180 return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_module,
182 getImportTrackingVector(
Context));
187 DIFile *File,
unsigned Line,
188 DINodeArray Elements) {
189 return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_module,
191 getImportTrackingVector(
Context));
195 DIFile *File,
unsigned Line,
196 DINodeArray Elements) {
197 return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_module,
199 getImportTrackingVector(
Context));
204 DIFile *File,
unsigned Line,
208 return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_declaration,
210 getImportTrackingVector(
Context));
215 std::optional<StringRef> Source) {
216 return DIFile::get(VMContext, Filename, Directory, CS, Source);
222 assert(!
Name.empty() &&
"Unable to create macro without name");
225 "Unexpected macro type");
227 AllMacrosPerParent[Parent].insert(M);
232 unsigned LineNumber,
DIFile *File) {
234 LineNumber, File, DIMacroNodeArray())
236 AllMacrosPerParent[Parent].insert(MF);
240 AllMacrosPerParent.insert({MF, {}});
246 assert(!
Name.empty() &&
"Unable to create enumerator without name");
252 assert(!
Name.empty() &&
"Unable to create enumerator without name");
257 assert(!
Name.empty() &&
"Unable to create type without name");
269 assert(!
Name.empty() &&
"Unable to create type without name");
271 0, Encoding, NumExtraInhabitants, Flags);
276 uint32_t AlignInBits,
unsigned Encoding,
279 SizeInBits, AlignInBits, Encoding, Flags,
286 uint32_t AlignInBits,
unsigned Encoding,
289 SizeInBits, AlignInBits, Encoding, Flags,
296 uint32_t AlignInBits,
unsigned Encoding,
300 SizeInBits, AlignInBits, Encoding, Flags,
302 Numerator, Denominator);
306 assert(!
Name.empty() &&
"Unable to create type without name");
314 assert(!
Name.empty() &&
"Unable to create type without name");
316 StringLength,
nullptr, StrLocationExp, 0, 0, 0);
322 assert(!
Name.empty() &&
"Unable to create type without name");
324 StringLengthExp, StrLocationExp, 0, 0, 0);
330 std::nullopt, DINode::FlagZero);
334 DIType *FromTy,
unsigned Key,
bool IsAddressDiscriminated,
335 unsigned ExtraDiscriminator,
bool IsaPointer,
336 bool AuthenticatesNullValues) {
338 VMContext, dwarf::DW_TAG_LLVM_ptrauth_type,
"",
nullptr, 0,
nullptr,
340 std::optional<DIDerivedType::PtrAuthData>(
341 std::in_place, Key, IsAddressDiscriminated, ExtraDiscriminator,
342 IsaPointer, AuthenticatesNullValues),
349 std::optional<unsigned> DWARFAddressSpace,
353 nullptr, 0,
nullptr, PointeeTy, SizeInBits,
354 AlignInBits, 0, DWARFAddressSpace, std::nullopt,
364 nullptr, 0,
nullptr, PointeeTy, SizeInBits,
365 AlignInBits, 0, std::nullopt, std::nullopt, Flags,
372 std::optional<unsigned> DWARFAddressSpace) {
373 assert(RTy &&
"Unable to create reference type");
375 SizeInBits, AlignInBits, 0, DWARFAddressSpace, {},
380 DIFile *File,
unsigned LineNo,
392 unsigned LineNo,
DIScope *Context,
393 DINodeArray TParams,
uint32_t AlignInBits,
402 assert(Ty &&
"Invalid type!");
403 assert(FriendTy &&
"Invalid friend type!");
406 std::nullopt, DINode::FlagZero);
413 assert(Ty &&
"Unable to create inheritance");
417 0, Ty,
BaseTy, 0, 0, BaseOffset, std::nullopt,
418 std::nullopt, Flags, ExtraData);
427 SizeInBits, AlignInBits, OffsetInBits, std::nullopt,
437 SizeInBits, AlignInBits, OffsetInBits, std::nullopt,
453 assert((Flags & DINode::FlagBitField) == 0);
455 VMContext, dwarf::DW_TAG_member,
Name, File, LineNumber,
461 DINodeArray Elements,
467 Elements, 0, {},
nullptr);
469 trackIfUnresolved(V);
471 DINode::FlagZero, V);
478 Flags |= DINode::FlagBitField;
480 VMContext, dwarf::DW_TAG_member,
Name, File, LineNumber,
482 OffsetInBits, std::nullopt, std::nullopt, Flags,
484 StorageOffsetInBits)),
492 Flags |= DINode::FlagBitField;
494 VMContext, dwarf::DW_TAG_member,
Name, File, LineNumber,
496 OffsetInBits, std::nullopt, std::nullopt, Flags,
498 StorageOffsetInBits)),
504 unsigned LineNumber,
DIType *Ty,
507 Flags |= DINode::FlagStaticMember;
510 AlignInBits, (
uint64_t)0, std::nullopt,
521 SizeInBits, AlignInBits, OffsetInBits, std::nullopt,
522 std::nullopt, Flags, PropertyNode);
528 unsigned PropertyAttributes,
DIType *Ty) {
530 SetterName, PropertyAttributes, Ty);
535 DIType *Ty,
bool isDefault) {
550 DIType *Ty,
bool isDefault,
553 VMContext, dwarf::DW_TAG_template_value_parameter,
Context,
Name, Ty,
562 VMContext, dwarf::DW_TAG_GNU_template_template_param,
Context,
Name, Ty,
568 DIType *Ty, DINodeArray Val) {
570 VMContext, dwarf::DW_TAG_GNU_template_parameter_pack,
Context,
Name, Ty,
578 unsigned RunTimeLang,
DIType *VTableHolder,
MDNode *TemplateParams,
581 "createClassType should be called with a valid Context");
584 VMContext, dwarf::DW_TAG_class_type,
Name, File, LineNumber,
586 OffsetInBits, Flags, Elements, RunTimeLang, std::nullopt,
587 VTableHolder, cast_or_null<MDTuple>(TemplateParams), UniqueIdentifier);
588 trackIfUnresolved(R);
595 DIType *DerivedFrom, DINodeArray Elements,
unsigned RunTimeLang,
599 VMContext, dwarf::DW_TAG_structure_type,
Name, File, LineNumber,
601 Flags, Elements, RunTimeLang, std::nullopt, VTableHolder,
602 nullptr, UniqueIdentifier,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
603 nullptr, Specification, NumExtraInhabitants);
604 trackIfUnresolved(R);
611 DIType *DerivedFrom, DINodeArray Elements,
unsigned RunTimeLang,
615 VMContext, dwarf::DW_TAG_structure_type,
Name, File, LineNumber,
617 Flags, Elements, RunTimeLang, std::nullopt, VTableHolder,
618 nullptr, UniqueIdentifier,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
619 nullptr, Specification, NumExtraInhabitants);
620 trackIfUnresolved(R);
627 DINodeArray Elements,
unsigned RunTimeLang,
StringRef UniqueIdentifier) {
629 VMContext, dwarf::DW_TAG_union_type,
Name, File, LineNumber,
631 Elements, RunTimeLang, std::nullopt,
nullptr,
nullptr,
633 trackIfUnresolved(R);
639 unsigned LineNumber,
uint64_t SizeInBits,
644 VMContext, dwarf::DW_TAG_variant_part,
Name, File, LineNumber,
646 Elements, 0, std::nullopt,
nullptr,
nullptr,
647 UniqueIdentifier, Discriminator);
648 trackIfUnresolved(R);
661 DIType *UnderlyingType,
unsigned RunTimeLang,
StringRef UniqueIdentifier,
662 bool IsScoped, std::optional<uint32_t> EnumKind) {
664 VMContext, dwarf::DW_TAG_enumeration_type,
Name, File, LineNumber,
666 IsScoped ? DINode::FlagEnumClass : DINode::FlagZero, Elements,
667 RunTimeLang, EnumKind,
nullptr,
nullptr, UniqueIdentifier);
668 AllEnumTypes.emplace_back(CTy);
669 trackIfUnresolved(CTy);
674 DIFile *File,
unsigned LineNo,
679 SizeInBits, AlignInBits, 0, std::nullopt,
680 std::nullopt, DINode::FlagZero);
681 trackIfUnresolved(R);
687 DINodeArray Subscripts,
693 Ty, Subscripts,
DL, AS, AL, RK);
704 VMContext, dwarf::DW_TAG_array_type,
Name, File, LineNumber,
706 Subscripts, 0, std::nullopt,
nullptr,
nullptr,
"",
nullptr,
707 isa<DIExpression *>(
DL) ? (
Metadata *)cast<DIExpression *>(
DL)
709 isa<DIExpression *>(AS) ? (
Metadata *)cast<DIExpression *>(AS)
710 : (
Metadata *)cast<DIVariable *>(AS),
711 isa<DIExpression *>(AL) ? (
Metadata *)cast<DIExpression *>(AL)
712 : (
Metadata *)cast<DIVariable *>(AL),
713 isa<DIExpression *>(RK) ? (
Metadata *)cast<DIExpression *>(RK)
714 : (
Metadata *)cast<DIVariable *>(RK),
715 nullptr,
nullptr, 0, BitStride);
716 trackIfUnresolved(R);
722 DINodeArray Subscripts) {
724 nullptr, 0,
nullptr, Ty,
Size, AlignInBits, 0,
725 DINode::FlagVector, Subscripts, 0,
726 std::nullopt,
nullptr);
727 trackIfUnresolved(R);
732 auto NewSP = SP->cloneWithFlags(SP->getFlags() | DINode::FlagArtificial);
756 Flags |= DINode::FlagArtificial;
762 assert(
T &&
"Expected non-null type");
763 assert((isa<DIType>(
T) || (isa<DISubprogram>(
T) &&
764 cast<DISubprogram>(
T)->isDefinition() ==
false)) &&
765 "Expected type or subprogram declaration");
766 AllRetainTypes.emplace_back(
T);
774 StringRef UniqueIdentifier, std::optional<uint32_t> EnumKind) {
779 SizeInBits, AlignInBits, 0, DINode::FlagFwdDecl,
nullptr, RuntimeLang,
780 EnumKind,
nullptr,
nullptr, UniqueIdentifier);
781 trackIfUnresolved(
RetTy);
789 std::optional<uint32_t> EnumKind) {
793 SizeInBits, AlignInBits, 0, Flags,
nullptr, RuntimeLang, EnumKind,
794 nullptr,
nullptr, UniqueIdentifier,
nullptr,
nullptr,
nullptr,
797 trackIfUnresolved(
RetTy);
813 if (isa_and_nonnull<MDNode>(E))
844 return isa<DIExpression *>(Bound) ? (
Metadata *)cast<DIExpression *>(Bound)
845 : (
Metadata *)cast<DIVariable *>(Bound);
848 ConvToMetadata(LB), ConvToMetadata(UB),
849 ConvToMetadata(Stride));
858 AlignInBits, Flags, Ty, LowerBound, UpperBound,
866 assert(CT->getIdentifier().empty() &&
867 "Context of a global variable should not be a type with identifier");
873 unsigned LineNumber,
DIType *Ty,
bool IsLocalToUnit,
bool isDefined,
880 LineNumber, Ty, IsLocalToUnit, isDefined,
881 cast_or_null<DIDerivedType>(Decl), TemplateParams, AlignInBits,
892 unsigned LineNumber,
DIType *Ty,
bool IsLocalToUnit,
MDNode *Decl,
898 LineNumber, Ty, IsLocalToUnit,
false,
899 cast_or_null<DIDerivedType>(Decl), TemplateParams, AlignInBits,
912 auto *Scope = cast<DILocalScope>(
Context);
915 if (AlwaysPreserve) {
925 DIFile *File,
unsigned LineNo,
926 DIType *Ty,
bool AlwaysPreserve,
929 assert(Scope && isa<DILocalScope>(Scope) &&
930 "Unexpected scope for a local variable.");
932 VMContext, getSubprogramNodesTrackingVector(Scope), Scope,
Name,
933 0, File, LineNo, Ty, AlwaysPreserve, Flags, AlignInBits);
940 assert(ArgNo &&
"Expected non-zero argument number for parameter");
941 assert(Scope && isa<DILocalScope>(Scope) &&
942 "Unexpected scope for a local variable.");
944 VMContext, getSubprogramNodesTrackingVector(Scope), Scope,
Name, ArgNo,
945 File, LineNo, Ty, AlwaysPreserve, Flags, 0,
Annotations);
949 unsigned LineNo,
unsigned Column,
951 std::optional<unsigned> CoroSuspendIdx,
952 bool AlwaysPreserve) {
953 auto *Scope = cast<DILocalScope>(
Context);
955 IsArtificial, CoroSuspendIdx);
957 if (AlwaysPreserve) {
961 getSubprogramNodesTrackingVector(Scope).emplace_back(Node);
970template <
class... Ts>
983 bool UseKeyInstructions) {
984 bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
987 Name,
LinkageName, File, LineNo, Ty, ScopeLine,
nullptr, 0, 0, Flags,
988 SPFlags, IsDefinition ? CUNode :
nullptr, TParams, Decl,
nullptr,
989 ThrownTypes,
Annotations, TargetFuncName, UseKeyInstructions);
991 AllSubprograms.push_back(Node);
992 trackIfUnresolved(Node);
1001 DITypeArray ThrownTypes) {
1002 bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
1005 ScopeLine,
nullptr, 0, 0, Flags, SPFlags,
1006 IsDefinition ? CUNode :
nullptr, TParams,
1007 Decl,
nullptr, ThrownTypes)
1013 unsigned LineNo,
DISubroutineType *Ty,
unsigned VIndex,
int ThisAdjustment,
1016 DITypeArray ThrownTypes,
bool UseKeyInstructions) {
1018 "Methods should have both a Context and a context that isn't "
1019 "the compile unit.");
1021 bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
1023 IsDefinition, VMContext, cast<DIScope>(
Context),
Name,
1024 LinkageName,
F, LineNo, Ty, LineNo, VTableHolder, VIndex, ThisAdjustment,
1025 Flags, SPFlags, IsDefinition ? CUNode :
nullptr, TParams,
nullptr,
1026 nullptr, ThrownTypes,
nullptr,
"", IsDefinition && UseKeyInstructions);
1028 AllSubprograms.push_back(SP);
1029 trackIfUnresolved(SP);
1041 bool ExportSymbols) {
1055 DIFile *File,
unsigned LineNo,
bool IsDecl) {
1057 ConfigurationMacros, IncludePath, APINotesFile, LineNo,
1063 unsigned Discriminator) {
1068 unsigned Line,
unsigned Col) {
1083 : InsertAtEnd->
end());
1091 auto *Link = cast_or_null<DIAssignID>(
1092 LinkedInstr->
getMetadata(LLVMContext::MD_DIAssignID));
1093 assert(Link &&
"Linked instruction must have DIAssign metadata attached");
1096 Val, SrcVar, ValExpr, Link,
Addr, AddrExpr,
DL);
1099 NextIt.setHeadBit(
true);
1100 insertDbgVariableRecord(DVR, NextIt);
1113 assert(V &&
"no value passed to dbg intrinsic");
1124 insertDbgVariableRecord(DVR, InsertPt);
1131 assert(VarInfo &&
"empty or invalid DILocalVariable* passed to dbg.declare");
1132 assert(
DL &&
"Expected debug loc");
1133 assert(
DL->getScope()->getSubprogram() ==
1135 "Expected matching subprograms");
1139 insertDbgVariableRecord(DVR, InsertPt);
1160 assert(IntrinsicFn &&
"must pass a non-null intrinsic function");
1161 assert(V &&
"must pass a value to a dbg intrinsic");
1163 "empty or invalid DILocalVariable* passed to debug intrinsic");
1164 assert(
DL &&
"Expected debug loc");
1165 assert(
DL->getScope()->getSubprogram() ==
1167 "Expected matching subprograms");
1169 trackIfUnresolved(VarInfo);
1170 trackIfUnresolved(Expr);
1177 return B.CreateCall(IntrinsicFn, Args);
1182 assert(LabelInfo &&
"empty or invalid DILabel* passed to dbg.label");
1183 assert(
DL &&
"Expected debug loc");
1184 assert(
DL->getScope()->getSubprogram() ==
1186 "Expected matching subprograms");
1188 trackIfUnresolved(LabelInfo);
1200 N->replaceVTableHolder(VTableHolder);
1205 if (
T != VTableHolder)
1210 if (
T->isResolved())
1212 if (
auto *
N = dyn_cast_or_null<MDNode>(O))
1213 trackIfUnresolved(
N);
1217 DINodeArray TParams) {
1221 N->replaceElements(Elements);
1223 N->replaceTemplateParams(DITemplateParameterArray(TParams));
1228 if (!
T->isResolved())
1235 trackIfUnresolved(Elements.get());
1237 trackIfUnresolved(TParams.get());
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file implements a class to represent arbitrary precision integral constant values and operations...
This file implements the APSInt class, which is a simple class that represents an arbitrary sized int...
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static DILocalVariable * createLocalVariable(LLVMContext &VMContext, SmallVectorImpl< TrackingMDNodeRef > &PreservedNodes, DIScope *Context, StringRef Name, unsigned ArgNo, DIFile *File, unsigned LineNo, DIType *Ty, bool AlwaysPreserve, DINode::DIFlags Flags, uint32_t AlignInBits, DINodeArray Annotations=nullptr)
static DIType * createTypeWithFlags(const DIType *Ty, DINode::DIFlags FlagsToSet)
static DIScope * getNonCompileUnitScope(DIScope *N)
If N is compile unit return NULL otherwise return N.
static void checkGlobalVariableScope(DIScope *Context)
static DISubprogram * getSubprogram(bool IsDistinct, Ts &&...Args)
static ConstantAsMetadata * getConstantOrNull(Constant *C)
static DITemplateValueParameter * createTemplateValueParameterHelper(LLVMContext &VMContext, unsigned Tag, DIScope *Context, StringRef Name, DIType *Ty, bool IsDefault, Metadata *MD)
static void initIRBuilder(IRBuilder<> &Builder, const DILocation *DL, InsertPosition InsertPt)
Initialize IRBuilder for inserting dbg.declare and dbg.value intrinsics.
static Value * getDbgIntrinsicValueImpl(LLVMContext &VMContext, Value *V)
static DIImportedEntity * createImportedModule(LLVMContext &C, dwarf::Tag Tag, DIScope *Context, Metadata *NS, DIFile *File, unsigned Line, StringRef Name, DINodeArray Elements, SmallVectorImpl< TrackingMDNodeRef > &ImportedModules)
This file contains constants used for implementing Dwarf debug support.
Module.h This file contains the declarations for the Module class.
Class for arbitrary precision integers.
An arbitrary precision integer that knows its signedness.
Annotations lets you mark points and ranges inside source code, for tests:
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
LLVM Basic Block Representation.
LLVM_ABI void insertDbgRecordBefore(DbgRecord *DR, InstListType::iterator Here)
Insert a DbgRecord into a block at the position given by Here.
InstListType::iterator iterator
Instruction iterators...
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
static ConstantInt * getSigned(IntegerType *Ty, int64_t V)
Return a ConstantInt with the specified value for the specified type.
This is an important base class in LLVM.
Basic type, like 'int' or 'float'.
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.
LLVM_ABI DIDerivedType * createTypedef(DIType *Ty, StringRef Name, DIFile *File, unsigned LineNo, DIScope *Context, uint32_t AlignInBits=0, DINode::DIFlags Flags=DINode::FlagZero, DINodeArray Annotations=nullptr)
Create debugging information entry for a typedef.
LLVM_ABI void finalize()
Construct any deferred debug info descriptors.
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 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.
LLVM_ABI DIDerivedType * createQualifiedType(unsigned Tag, DIType *FromTy)
Create debugging information entry for a qualified type, e.g.
LLVM_ABI DICompileUnit * createCompileUnit(unsigned 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 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 DICompositeType * createVectorType(uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts)
Create debugging information entry for a vector type.
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.
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.
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)
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 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.
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.
DICompositeTypeArray getEnumTypes() const
void replaceEnumTypes(DICompositeTypeArray N)
Replace arrays.
DIMacroNodeArray getMacros() const
void replaceRetainedTypes(DITypeArray N)
void replaceGlobalVariables(DIGlobalVariableExpressionArray N)
void replaceMacros(DIMacroNodeArray N)
DIImportedEntityArray getImportedEntities() const
DIScopeArray getRetainedTypes() const
void replaceImportedEntities(DIImportedEntityArray N)
DIGlobalVariableExpressionArray getGlobalVariables() const
@ FixedPointBinary
Scale factor 2^Factor.
@ FixedPointDecimal
Scale factor 10^Factor.
@ FixedPointRational
Arbitrary rational scale factor.
A pair of DIGlobalVariable and DIExpression.
An imported module (C++ using directive or similar).
DILocalScope * getScope() const
Get the local scope for this label.
LLVM_ABI DISubprogram * getSubprogram() const
Get the subprogram for this scope.
DILocalScope * getScope() const
Get the local scope for this variable.
Represents a module in the programming language, for example, a Clang module, or a Fortran module.
Tagged DWARF-like metadata node.
Base class for scope-like contexts.
String type, Fortran CHARACTER(n)
Subprogram description. Uses SubclassData1.
DISPFlags
Debug info subprogram flags.
Type array for a subprogram.
TempDIType cloneWithFlags(DIFlags NewFlags) const
Returns a new temporary DIType with updated Flags.
bool isObjectPointer() const
bool isArtificial() const
Base class for variables.
Records a position in IR for a source label (DILabel).
Record of a variable value-assignment, aka a non instruction representation of the dbg....
static LLVM_ABI DbgVariableRecord * createDbgVariableRecord(Value *Location, DILocalVariable *DV, DIExpression *Expr, const DILocation *DI)
static LLVM_ABI DbgVariableRecord * createDVRDeclare(Value *Address, DILocalVariable *DV, DIExpression *Expr, const DILocation *DI)
DIExpression * getExpression() const
DILocalVariable * getVariable() const
static LLVM_ABI DbgVariableRecord * createDVRAssign(Value *Val, DILocalVariable *Variable, DIExpression *Expression, DIAssignID *AssignID, Value *Address, DIExpression *AddressExpression, const DILocation *DI)
DIExpression * getAddressExpression() const
void SetCurrentDebugLocation(DebugLoc L)
Set location information used by debugging information.
void SetInsertPoint(BasicBlock *TheBB)
This specifies that created instructions should be appended to the end of the specified block.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
BasicBlock * getBasicBlock()
MDNode * getMetadata(unsigned KindID) const
Get the metadata of given kind attached to this Instruction.
static LLVM_ABI IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
This is an important class for using LLVM in a threaded context.
static MDTuple * getDistinct(LLVMContext &Context, ArrayRef< Metadata * > MDs)
static TempMDTuple getTemporary(LLVMContext &Context, ArrayRef< Metadata * > MDs)
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
static std::enable_if_t< std::is_base_of< MDNode, T >::value, T * > replaceWithDistinct(std::unique_ptr< T, TempMDNodeDeleter > N)
Replace a temporary node with a distinct one.
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.
Tracking metadata reference owned by Metadata.
static LLVM_ABI MDString * get(LLVMContext &Context, StringRef Str)
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
A Module instance is used to store all the information related to an LLVM module.
NamedMDNode * getOrInsertNamedMetadata(StringRef Name)
Return the named MDNode in the module with the specified name.
LLVM_ABI void addOperand(MDNode *M)
A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
reference emplace_back(ArgTypes &&... Args)
void push_back(const T &Elt)
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.
static LLVM_ABI IntegerType * getInt64Ty(LLVMContext &C)
LLVM Value Representation.
self_iterator getIterator()
@ C
The default llvm calling convention, compatible with C.
Calculates the starting offsets for various sections within the .debug_names section.
This is an optimization pass for GlobalISel generic memory operations.
constexpr from_range_t from_range
A single checksum, represented by a Kind and a Value (a string).