LLVM 20.0.0git
Public Member Functions | Static Public Member Functions | List of all members
llvm::DIBuilder Class Reference

#include "llvm/IR/DIBuilder.h"

Public Member Functions

 DIBuilder (Module &M, bool AllowUnresolved=true, DICompileUnit *CU=nullptr)
 Construct a builder for a module.
 
 DIBuilder (const DIBuilder &)=delete
 
DIBuilderoperator= (const DIBuilder &)=delete
 
void finalize ()
 Construct any deferred debug info descriptors.
 
void finalizeSubprogram (DISubprogram *SP)
 Finalize a specific subprogram - no new variables may be added to this subprogram afterwards.
 
DICompileUnitcreateCompileUnit (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 compilation.
 
DIFilecreateFile (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.
 
DIMacrocreateMacro (DIMacroFile *Parent, unsigned Line, unsigned MacroType, StringRef Name, StringRef Value=StringRef())
 Create debugging information entry for a macro.
 
DIMacroFilecreateTempMacroFile (DIMacroFile *Parent, unsigned Line, DIFile *File)
 Create debugging information temporary entry for a macro file.
 
DIEnumeratorcreateEnumerator (StringRef Name, const APSInt &Value)
 Create a single enumerator value.
 
DIEnumeratorcreateEnumerator (StringRef Name, uint64_t Val, bool IsUnsigned=false)
 
DIBasicTypecreateUnspecifiedType (StringRef Name)
 Create a DWARF unspecified type.
 
DIBasicTypecreateNullPtrType ()
 Create C++11 nullptr type.
 
DIBasicTypecreateBasicType (StringRef Name, uint64_t SizeInBits, unsigned Encoding, DINode::DIFlags Flags=DINode::FlagZero)
 Create debugging information entry for a basic type.
 
DIStringTypecreateStringType (StringRef Name, uint64_t SizeInBits)
 Create debugging information entry for a string type.
 
DIStringTypecreateStringType (StringRef Name, DIVariable *StringLength, DIExpression *StrLocationExp=nullptr)
 Create debugging information entry for Fortran assumed length string type.
 
DIStringTypecreateStringType (StringRef Name, DIExpression *StringLengthExp, DIExpression *StrLocationExp=nullptr)
 Create debugging information entry for Fortran assumed length string type.
 
DIDerivedTypecreateQualifiedType (unsigned Tag, DIType *FromTy)
 Create debugging information entry for a qualified type, e.g.
 
DIDerivedTypecreatePointerType (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.
 
DIDerivedTypecreatePtrAuthQualifiedType (DIType *FromTy, unsigned Key, bool IsAddressDiscriminated, unsigned ExtraDiscriminator, bool IsaPointer, bool authenticatesNullValues)
 Create a __ptrauth qualifier.
 
DIDerivedTypecreateMemberPointerType (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.
 
DIDerivedTypecreateReferenceType (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.
 
DIDerivedTypecreateTypedef (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.
 
DIDerivedTypecreateTemplateAlias (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.
 
DIDerivedTypecreateFriend (DIType *Ty, DIType *FriendTy)
 Create debugging information entry for a 'friend'.
 
DIDerivedTypecreateInheritance (DIType *Ty, DIType *BaseTy, uint64_t BaseOffset, uint32_t VBPtrOffset, DINode::DIFlags Flags)
 Create debugging information entry to establish inheritance relationship between two types.
 
DIDerivedTypecreateMemberType (DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *Ty, DINodeArray Annotations=nullptr)
 Create debugging information entry for a member.
 
DIDerivedTypecreateVariantMemberType (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.
 
DIDerivedTypecreateBitFieldMemberType (DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint64_t OffsetInBits, uint64_t StorageOffsetInBits, DINode::DIFlags Flags, DIType *Ty, DINodeArray Annotations=nullptr)
 Create debugging information entry for a bit field member.
 
DIDerivedTypecreateStaticMemberType (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.
 
DIDerivedTypecreateObjCIVar (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.
 
DIObjCPropertycreateObjCProperty (StringRef Name, DIFile *File, unsigned LineNumber, StringRef GetterName, StringRef SetterName, unsigned PropertyAttributes, DIType *Ty)
 Create debugging information entry for Objective-C property.
 
DICompositeTypecreateClassType (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.
 
DICompositeTypecreateStructType (DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang=0, DIType *VTableHolder=nullptr, StringRef UniqueIdentifier="")
 Create debugging information entry for a struct.
 
DICompositeTypecreateUnionType (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.
 
DICompositeTypecreateVariantPart (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.
 
DITemplateTypeParametercreateTemplateTypeParameter (DIScope *Scope, StringRef Name, DIType *Ty, bool IsDefault)
 Create debugging information for template type parameter.
 
DITemplateValueParametercreateTemplateValueParameter (DIScope *Scope, StringRef Name, DIType *Ty, bool IsDefault, Constant *Val)
 Create debugging information for template value parameter.
 
DITemplateValueParametercreateTemplateTemplateParameter (DIScope *Scope, StringRef Name, DIType *Ty, StringRef Val, bool IsDefault=false)
 Create debugging information for a template template parameter.
 
DITemplateValueParametercreateTemplateParameterPack (DIScope *Scope, StringRef Name, DIType *Ty, DINodeArray Val)
 Create debugging information for a template parameter pack.
 
DICompositeTypecreateArrayType (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.
 
DICompositeTypecreateVectorType (uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts)
 Create debugging information entry for a vector type.
 
DICompositeTypecreateEnumerationType (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)
 Create debugging information entry for an enumeration.
 
DIDerivedTypecreateSetType (DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint32_t AlignInBits, DIType *Ty)
 Create debugging information entry for a set.
 
DISubroutineTypecreateSubroutineType (DITypeRefArray ParameterTypes, DINode::DIFlags Flags=DINode::FlagZero, unsigned CC=0)
 Create subroutine type.
 
DICompositeTypecreateForwardDecl (unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line, unsigned RuntimeLang=0, uint64_t SizeInBits=0, uint32_t AlignInBits=0, StringRef UniqueIdentifier="")
 Create a permanent forward-declared type.
 
DICompositeTypecreateReplaceableCompositeType (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)
 Create a temporary forward-declared type.
 
void retainType (DIScope *T)
 Retain DIScope* in a module even if it is not referenced through debug info anchors.
 
DIBasicTypecreateUnspecifiedParameter ()
 Create unspecified parameter type for a subroutine type.
 
DINodeArray getOrCreateArray (ArrayRef< Metadata * > Elements)
 Get a DINodeArray, create one if required.
 
DIMacroNodeArray getOrCreateMacroArray (ArrayRef< Metadata * > Elements)
 Get a DIMacroNodeArray, create one if required.
 
DITypeRefArray getOrCreateTypeArray (ArrayRef< Metadata * > Elements)
 Get a DITypeRefArray, create one if required.
 
DISubrangegetOrCreateSubrange (int64_t Lo, int64_t Count)
 Create a descriptor for a value range.
 
DISubrangegetOrCreateSubrange (int64_t Lo, Metadata *CountNode)
 
DISubrangegetOrCreateSubrange (Metadata *Count, Metadata *LowerBound, Metadata *UpperBound, Metadata *Stride)
 
DIGenericSubrangegetOrCreateGenericSubrange (DIGenericSubrange::BoundType Count, DIGenericSubrange::BoundType LowerBound, DIGenericSubrange::BoundType UpperBound, DIGenericSubrange::BoundType Stride)
 
DIGlobalVariableExpressioncreateGlobalVariableExpression (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.
 
DIGlobalVariablecreateTempGlobalVariableFwdDecl (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 RAUWed.
 
DILocalVariablecreateAutoVariable (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.
 
DILabelcreateLabel (DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, bool AlwaysPreserve=false)
 Create a new descriptor for an label.
 
DILocalVariablecreateParameterVariable (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.
 
DIExpressioncreateExpression (ArrayRef< uint64_t > Addr=std::nullopt)
 Create a new descriptor for the specified variable which has a complex address expression for its address.
 
DIExpressioncreateConstantValueExpression (uint64_t Val)
 Create an expression for a variable that does not have an address, but does have a constant value.
 
DISubprogramcreateFunction (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="")
 Create a new descriptor for the specified subprogram.
 
DISubprogramcreateTempFunctionFwdDecl (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.
 
DISubprogramcreateMethod (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)
 Create a new descriptor for the specified C++ method.
 
DICommonBlockcreateCommonBlock (DIScope *Scope, DIGlobalVariable *decl, StringRef Name, DIFile *File, unsigned LineNo)
 Create common block entry for a Fortran common block.
 
DINamespacecreateNameSpace (DIScope *Scope, StringRef Name, bool ExportSymbols)
 This creates new descriptor for a namespace with the specified parent scope.
 
DIModulecreateModule (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.
 
DILexicalBlockFilecreateLexicalBlockFile (DIScope *Scope, DIFile *File, unsigned Discriminator=0)
 This creates a descriptor for a lexical block with a new file attached.
 
DILexicalBlockcreateLexicalBlock (DIScope *Scope, DIFile *File, unsigned Line, unsigned Col)
 This creates a descriptor for a lexical block with the specified parent context.
 
DIImportedEntitycreateImportedModule (DIScope *Context, DINamespace *NS, DIFile *File, unsigned Line, DINodeArray Elements=nullptr)
 Create a descriptor for an imported module.
 
DIImportedEntitycreateImportedModule (DIScope *Context, DIImportedEntity *NS, DIFile *File, unsigned Line, DINodeArray Elements=nullptr)
 Create a descriptor for an imported module.
 
DIImportedEntitycreateImportedModule (DIScope *Context, DIModule *M, DIFile *File, unsigned Line, DINodeArray Elements=nullptr)
 Create a descriptor for an imported module.
 
DIImportedEntitycreateImportedDeclaration (DIScope *Context, DINode *Decl, DIFile *File, unsigned Line, StringRef Name="", DINodeArray Elements=nullptr)
 Create a descriptor for an imported function.
 
DbgInstPtr insertDeclare (llvm::Value *Storage, DILocalVariable *VarInfo, DIExpression *Expr, const DILocation *DL, BasicBlock *InsertAtEnd)
 Insert a new llvm.dbg.declare intrinsic call.
 
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.
 
DbgInstPtr insertDeclare (llvm::Value *Storage, DILocalVariable *VarInfo, DIExpression *Expr, const DILocation *DL, Instruction *InsertBefore)
 Insert a new llvm.dbg.declare intrinsic call.
 
DbgInstPtr insertLabel (DILabel *LabelInfo, const DILocation *DL, Instruction *InsertBefore)
 Insert a new llvm.dbg.label intrinsic call.
 
DbgInstPtr insertLabel (DILabel *LabelInfo, const DILocation *DL, BasicBlock *InsertAtEnd)
 Insert a new llvm.dbg.label intrinsic call.
 
DbgInstPtr insertDbgValueIntrinsic (llvm::Value *Val, DILocalVariable *VarInfo, DIExpression *Expr, const DILocation *DL, BasicBlock *InsertAtEnd)
 Insert a new llvm.dbg.value intrinsic call.
 
DbgInstPtr insertDbgValueIntrinsic (llvm::Value *Val, DILocalVariable *VarInfo, DIExpression *Expr, const DILocation *DL, Instruction *InsertBefore)
 Insert a new llvm.dbg.value intrinsic call.
 
void replaceVTableHolder (DICompositeType *&T, DIType *VTableHolder)
 Replace the vtable holder in the given type.
 
void replaceArrays (DICompositeType *&T, DINodeArray Elements, DINodeArray TParams=DINodeArray())
 Replace arrays on a composite type.
 
template<class NodeTy >
NodeTy * replaceTemporary (TempMDNode &&N, NodeTy *Replacement)
 Replace a temporary node.
 

Static Public Member Functions

static DISubprogramcreateArtificialSubprogram (DISubprogram *SP)
 Create a distinct clone of SP with FlagArtificial set.
 
static DITypecreateArtificialType (DIType *Ty)
 Create a uniqued clone of Ty with FlagArtificial set.
 
static DITypecreateObjectPointerType (DIType *Ty)
 Create a uniqued clone of Ty with FlagObjectPointer and FlagArtificial set.
 

Detailed Description

Definition at line 45 of file DIBuilder.h.

Constructor & Destructor Documentation

◆ DIBuilder() [1/2]

DIBuilder::DIBuilder ( Module M,
bool  AllowUnresolved = true,
DICompileUnit CU = nullptr 
)
explicit

Construct a builder for a module.

If AllowUnresolved, collect unresolved nodes attached to the module in order to resolve cycles during finalize().

If CU is given a value other than nullptr, then set CUNode to CU.

Definition at line 28 of file DIBuilder.cpp.

References llvm::DICompileUnit::getEnumTypes(), llvm::DICompileUnit::getGlobalVariables(), llvm::DICompileUnit::getImportedEntities(), llvm::DICompileUnit::getMacros(), and llvm::DICompileUnit::getRetainedTypes().

◆ DIBuilder() [2/2]

llvm::DIBuilder::DIBuilder ( const DIBuilder )
delete

Member Function Documentation

◆ createArrayType()

DICompositeType * DIBuilder::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.

Parameters
SizeArray size.
AlignInBitsAlignment.
TyElement type.
SubscriptsSubscripts.
DataLocationThe location of the raw data of a descriptor-based Fortran array, either a DIExpression* or a DIVariable*.
AssociatedThe associated attribute of a descriptor-based Fortran array, either a DIExpression* or a DIVariable*.
AllocatedThe allocated attribute of a descriptor-based Fortran array, either a DIExpression* or a DIVariable*.
RankThe rank attribute of a descriptor-based Fortran array, either a DIExpression* or a DIVariable*.

Definition at line 594 of file DIBuilder.cpp.

References DL, llvm::MDNode::get(), and Size.

Referenced by solveDIType().

◆ createArtificialSubprogram()

DISubprogram * DIBuilder::createArtificialSubprogram ( DISubprogram SP)
static

Create a distinct clone of SP with FlagArtificial set.

Definition at line 626 of file DIBuilder.cpp.

References llvm::MDNode::replaceWithDistinct().

◆ createArtificialType()

DIType * DIBuilder::createArtificialType ( DIType Ty)
static

Create a uniqued clone of Ty with FlagArtificial set.

Definition at line 637 of file DIBuilder.cpp.

References createTypeWithFlags(), and llvm::DIType::isArtificial().

◆ createAutoVariable()

DILocalVariable * DIBuilder::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.

This is a local variable that is not a subprogram parameter.

Scope must be a DILocalScope, and thus its scope chain eventually leads to a DISubprogram.

If AlwaysPreserve, this variable will be referenced from its containing subprogram, and will survive some optimizations.

Definition at line 806 of file DIBuilder.cpp.

References assert(), createLocalVariable(), and Name.

Referenced by buildFrameDebugInfo(), and fixupDebugInfoPostExtraction().

◆ createBasicType()

DIBasicType * DIBuilder::createBasicType ( StringRef  Name,
uint64_t  SizeInBits,
unsigned  Encoding,
DINode::DIFlags  Flags = DINode::FlagZero 
)

Create debugging information entry for a basic type.

Parameters
NameType name.
SizeInBitsSize of the type.
EncodingDWARF encoding code, e.g., dwarf::DW_ATE_float.
FlagsOptional DWARF attributes, e.g., DW_AT_endianity.

Definition at line 267 of file DIBuilder.cpp.

References assert(), llvm::MDNode::get(), and Name.

Referenced by buildFrameDebugInfo(), and solveDIType().

◆ createBitFieldMemberType()

DIDerivedType * DIBuilder::createBitFieldMemberType ( DIScope Scope,
StringRef  Name,
DIFile File,
unsigned  LineNo,
uint64_t  SizeInBits,
uint64_t  OffsetInBits,
uint64_t  StorageOffsetInBits,
DINode::DIFlags  Flags,
DIType Ty,
DINodeArray  Annotations = nullptr 
)

Create debugging information entry for a bit field member.

Parameters
ScopeMember scope.
NameMember name.
FileFile where this member is defined.
LineNoLine number.
SizeInBitsMember size.
OffsetInBitsMember offset.
StorageOffsetInBitsMember storage offset.
FlagsFlags to encode member attribute.
TyParent type.
AnnotationsMember annotations.

Definition at line 416 of file DIBuilder.cpp.

References llvm::ConstantAsMetadata::get(), llvm::IntegerType::get(), llvm::MDNode::get(), getNonCompileUnitScope(), and Name.

◆ createClassType()

DICompositeType * DIBuilder::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.

Parameters
ScopeScope in which this class is defined.
Nameclass name.
FileFile where this member is defined.
LineNumberLine number.
SizeInBitsMember size.
AlignInBitsMember alignment.
OffsetInBitsMember offset.
FlagsFlags to encode member attribute, e.g. private
Elementsclass members.
RunTimeLangOptional parameter, Objective-C runtime version.
VTableHolderDebug info of the base class that contains vtable for this type. This is used in DW_AT_containing_type. See DWARF documentation for more info.
TemplateParmsTemplate type parameters.
UniqueIdentifierA unique identifier for the class.

Definition at line 502 of file DIBuilder.cpp.

References assert(), llvm::MDNode::get(), getNonCompileUnitScope(), and Name.

◆ createCommonBlock()

DICommonBlock * DIBuilder::createCommonBlock ( DIScope Scope,
DIGlobalVariable decl,
StringRef  Name,
DIFile File,
unsigned  LineNo 
)

Create common block entry for a Fortran common block.

Parameters
ScopeScope of this common block.
declGlobal variable declaration.
NameThe name of this common block.
FileThe file this common block is defined.
LineNoLine number.

Definition at line 913 of file DIBuilder.cpp.

References llvm::MDNode::get(), and Name.

◆ createCompileUnit()

DICompileUnit * DIBuilder::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 compilation.

Parameters
LangSource programming language, eg. dwarf::DW_LANG_C99
FileFile info.
ProducerIdentify the producer of debugging information and code. Usually this is a compiler version string.
isOptimizedA boolean flag which indicates whether optimization is enabled or not.
FlagsThis string lists command line options. This string is directly embedded in debug info output which may be used by a tool analyzing generated debugging information.
RVThis indicates runtime version for languages like Objective-C.
SplitNameThe name of the file that we'll split debug info out into.
KindThe kind of debug information to generate.
DWOIdThe DWOId if this is a split skeleton compile unit.
SplitDebugInliningWhether to emit inline debug info.
DebugInfoForProfilingWhether to emit extra debug info for profile collection.
NameTableKindWhether to emit .debug_gnu_pubnames, .debug_pubnames, or no pubnames at all.
SysRootThe clang system root (value of -isysroot).
SDKThe SDK name. On Darwin, this is the last component of the sysroot.

Definition at line 135 of file DIBuilder.cpp.

References llvm::NamedMDNode::addOperand(), assert(), llvm::dwarf::DW_LANG_lo_user, llvm::MDNode::getDistinct(), and llvm::Module::getOrInsertNamedMetadata().

◆ createConstantValueExpression()

DIExpression * llvm::DIBuilder::createConstantValueExpression ( uint64_t  Val)
inline

Create an expression for a variable that does not have an address, but does have a constant value.

Definition at line 779 of file DIBuilder.h.

References llvm::MDNode::get().

Referenced by llvm::getExpressionForConstant().

◆ createEnumerationType()

DICompositeType * DIBuilder::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 
)

Create debugging information entry for an enumeration.

Parameters
ScopeScope in which this enumeration is defined.
NameUnion name.
FileFile where this member is defined.
LineNumberLine number.
SizeInBitsMember size.
AlignInBitsMember alignment.
ElementsEnumeration elements.
UnderlyingTypeUnderlying type of a C++11/ObjC fixed enum.
RunTimeLangOptional parameter, Objective-C runtime version.
UniqueIdentifierA unique identifier for the enum.
IsScopedBoolean flag indicate if this is C++11/ObjC 'enum class'.

Definition at line 566 of file DIBuilder.cpp.

References llvm::MDNode::get(), getNonCompileUnitScope(), and Name.

◆ createEnumerator() [1/2]

DIEnumerator * DIBuilder::createEnumerator ( StringRef  Name,
const APSInt Value 
)

Create a single enumerator value.

Definition at line 253 of file DIBuilder.cpp.

References assert(), llvm::MDNode::get(), and Name.

◆ createEnumerator() [2/2]

DIEnumerator * DIBuilder::createEnumerator ( StringRef  Name,
uint64_t  Val,
bool  IsUnsigned = false 
)

Definition at line 246 of file DIBuilder.cpp.

References assert(), llvm::MDNode::get(), and Name.

◆ createExpression()

DIExpression * DIBuilder::createExpression ( ArrayRef< uint64_t Addr = std::nullopt)

Create a new descriptor for the specified variable which has a complex address expression for its address.

Parameters
AddrAn array of complex address operations.

Definition at line 844 of file DIBuilder.cpp.

References Addr, and llvm::MDNode::get().

Referenced by buildFrameDebugInfo(), and createGlobalVariableExpression().

◆ createFile()

DIFile * DIBuilder::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.

Parameters
FilenameFile name.
DirectoryDirectory.
ChecksumOptional checksum kind (e.g. CSK_MD5, CSK_SHA1, etc.) and value.
SourceOptional source text.

Definition at line 215 of file DIBuilder.cpp.

References llvm::MDNode::get().

◆ createForwardDecl()

DICompositeType * DIBuilder::createForwardDecl ( unsigned  Tag,
StringRef  Name,
DIScope Scope,
DIFile F,
unsigned  Line,
unsigned  RuntimeLang = 0,
uint64_t  SizeInBits = 0,
uint32_t  AlignInBits = 0,
StringRef  UniqueIdentifier = "" 
)

Create a permanent forward-declared type.

Definition at line 663 of file DIBuilder.cpp.

References F, llvm::MDNode::get(), getNonCompileUnitScope(), Name, and RetTy.

◆ createFriend()

DIDerivedType * DIBuilder::createFriend ( DIType Ty,
DIType FriendTy 
)

Create debugging information entry for a 'friend'.

Definition at line 370 of file DIBuilder.cpp.

References assert(), and llvm::MDNode::get().

◆ createFunction()

DISubprogram * DIBuilder::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 = "" 
)

Create a new descriptor for the specified subprogram.

See comments in DISubprogram* for descriptions of these fields.

Parameters
ScopeFunction scope.
NameFunction name.
LinkageNameMangled function name.
FileFile where this variable is defined.
LineNoLine number.
TyFunction type.
ScopeLineSet to the beginning of the scope this starts
Flagse.g. is this function prototyped or not. These flags are used to emit dwarf attributes.
SPFlagsAdditional flags specific to subprograms.
TParamsFunction template parameters.
ThrownTypesException types this function may throw.
AnnotationsAttribute Annotations.
TargetFuncNameThe name of the target function if this is a trampoline.

Definition at line 855 of file DIBuilder.cpp.

References getNonCompileUnitScope(), getSubprogram(), llvm::LinkageName, and Name.

Referenced by fixupDebugInfoPostExtraction().

◆ createGlobalVariableExpression()

DIGlobalVariableExpression * DIBuilder::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.

Parameters
ContextVariable scope.
NameName of the variable.
LinkageNameMangled name of the variable.
FileFile where this variable is defined.
LineNoLine number.
TyVariable Type.
IsLocalToUnitBoolean flag indicate whether this variable is externally visible or not.
ExprThe location of the global relative to the attached GlobalVariable.
DeclReference to the corresponding declaration.
AlignInBitsVariable alignment(or 0 if no alignment attr was specified)

Definition at line 753 of file DIBuilder.cpp.

References checkGlobalVariableScope(), createExpression(), F, llvm::MDNode::get(), llvm::MDNode::getDistinct(), llvm::LinkageName, N, and Name.

◆ createImportedDeclaration()

DIImportedEntity * DIBuilder::createImportedDeclaration ( DIScope Context,
DINode Decl,
DIFile File,
unsigned  Line,
StringRef  Name = "",
DINodeArray  Elements = nullptr 
)

Create a descriptor for an imported function.

Parameters
ContextThe scope this module is imported into.
DeclThe declaration (or definition) of a function, type, or variable.
FileFile where the declaration is located.
LineLine number of the declaration.
ElementsRenamed elements.

Definition at line 205 of file DIBuilder.cpp.

References Name.

◆ createImportedModule() [1/3]

DIImportedEntity * DIBuilder::createImportedModule ( DIScope Context,
DIImportedEntity NS,
DIFile File,
unsigned  Line,
DINodeArray  Elements = nullptr 
)

Create a descriptor for an imported module.

Parameters
ContextThe scope this module is imported into.
NSAn aliased namespace.
FileFile where the declaration is located.
LineLine number of the declaration.
ElementsRenamed elements.

Definition at line 187 of file DIBuilder.cpp.

◆ createImportedModule() [2/3]

DIImportedEntity * DIBuilder::createImportedModule ( DIScope Context,
DIModule M,
DIFile File,
unsigned  Line,
DINodeArray  Elements = nullptr 
)

Create a descriptor for an imported module.

Parameters
ContextThe scope this module is imported into.
MThe module being imported here
FileFile where the declaration is located.
LineLine number of the declaration.
ElementsRenamed elements.

Definition at line 196 of file DIBuilder.cpp.

◆ createImportedModule() [3/3]

DIImportedEntity * DIBuilder::createImportedModule ( DIScope Context,
DINamespace NS,
DIFile File,
unsigned  Line,
DINodeArray  Elements = nullptr 
)

Create a descriptor for an imported module.

Parameters
ContextThe scope this module is imported into
NSThe namespace being imported here.
FileFile where the declaration is located.
LineLine number of the declaration.
ElementsRenamed elements.

Definition at line 178 of file DIBuilder.cpp.

◆ createInheritance()

DIDerivedType * DIBuilder::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.

Parameters
TyOriginal type.
BaseTyBase type. Ty is inherits from base.
BaseOffsetBase offset.
VBPtrOffsetVirtual base pointer offset.
FlagsFlags to describe inheritance attribute, e.g. private

Definition at line 378 of file DIBuilder.cpp.

References assert(), llvm::ConstantAsMetadata::get(), llvm::IntegerType::get(), and llvm::MDNode::get().

◆ createLabel()

DILabel * DIBuilder::createLabel ( DIScope Scope,
StringRef  Name,
DIFile File,
unsigned  LineNo,
bool  AlwaysPreserve = false 
)

Create a new descriptor for an label.

Scope must be a DILocalScope, and thus its scope chain eventually leads to a DISubprogram.

The optimizer may remove labels. If there is an interest to preserve label info in such situation then append it to the list of retained nodes of the DISubprogram.

Definition at line 830 of file DIBuilder.cpp.

References llvm::MDNode::get(), and Name.

◆ createLexicalBlock()

DILexicalBlock * DIBuilder::createLexicalBlock ( DIScope Scope,
DIFile File,
unsigned  Line,
unsigned  Col 
)

This creates a descriptor for a lexical block with the specified parent context.

Parameters
ScopeParent lexical scope.
FileSource file.
LineLine number.
ColColumn number.

Definition at line 947 of file DIBuilder.cpp.

References llvm::MDNode::getDistinct(), and getNonCompileUnitScope().

◆ createLexicalBlockFile()

DILexicalBlockFile * DIBuilder::createLexicalBlockFile ( DIScope Scope,
DIFile File,
unsigned  Discriminator = 0 
)

This creates a descriptor for a lexical block with a new file attached.

This merely extends the existing lexical block as it crosses a file.

Parameters
ScopeLexical block.
FileSource file.
DiscriminatorDWARF path discriminator value.

Definition at line 941 of file DIBuilder.cpp.

References llvm::MDNode::get().

◆ createMacro()

DIMacro * DIBuilder::createMacro ( DIMacroFile Parent,
unsigned  Line,
unsigned  MacroType,
StringRef  Name,
StringRef  Value = StringRef() 
)

Create debugging information entry for a macro.

Parameters
ParentMacro parent (could be nullptr).
LineSource line number where the macro is defined.
MacroTypeDW_MACINFO_define or DW_MACINFO_undef.
NameMacro name.
ValueMacro value.

Definition at line 221 of file DIBuilder.cpp.

References assert(), llvm::dwarf::DW_MACINFO_define, llvm::dwarf::DW_MACINFO_undef, llvm::MDNode::get(), and Name.

◆ createMemberPointerType()

DIDerivedType * DIBuilder::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.

Parameters
PointeeTyType pointed to by this pointer.
SizeInBitsSize.
AlignInBitsAlignment. (optional)
ClassType for which this pointer points to members of.

Definition at line 327 of file DIBuilder.cpp.

References llvm::sampleprof::Base, and llvm::MDNode::get().

◆ createMemberType()

DIDerivedType * DIBuilder::createMemberType ( DIScope Scope,
StringRef  Name,
DIFile File,
unsigned  LineNo,
uint64_t  SizeInBits,
uint32_t  AlignInBits,
uint64_t  OffsetInBits,
DINode::DIFlags  Flags,
DIType Ty,
DINodeArray  Annotations = nullptr 
)

Create debugging information entry for a member.

Parameters
ScopeMember scope.
NameMember name.
FileFile where this member is defined.
LineNoLine number.
SizeInBitsMember size.
AlignInBitsMember alignment.
OffsetInBitsMember offset.
FlagsFlags to encode member attribute, e.g. private
TyParent type.
AnnotationsMember annotations.

Definition at line 390 of file DIBuilder.cpp.

References llvm::MDNode::get(), getNonCompileUnitScope(), and Name.

Referenced by buildFrameDebugInfo(), and solveDIType().

◆ createMethod()

DISubprogram * DIBuilder::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 
)

Create a new descriptor for the specified C++ method.

See comments in DISubprogram* for descriptions of these fields.

Parameters
ScopeFunction scope.
NameFunction name.
LinkageNameMangled function name.
FileFile where this variable is defined.
LineNoLine number.
TyFunction type.
VTableIndexIndex no of this method in virtual table, or -1u if unrepresentable.
ThisAdjustmentMS ABI-specific adjustment of 'this' that occurs in the prologue.
VTableHolderType that holds vtable.
Flagse.g. is this function prototyped or not. This flags are used to emit dwarf attributes.
SPFlagsAdditional flags specific to subprograms.
TParamsFunction template parameters.
ThrownTypesException types this function may throw.

Definition at line 890 of file DIBuilder.cpp.

References assert(), F, getNonCompileUnitScope(), getSubprogram(), llvm::LinkageName, and Name.

◆ createModule()

DIModule * DIBuilder::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.

Parameters
ScopeParent scope
NameName of this module
ConfigurationMacrosA space-separated shell-quoted list of -D macro definitions as they would appear on a command line.
IncludePathThe path to the module map file.
APINotesFileThe path to an API notes file for this module.
FileSource file of the module. Used for Fortran modules.
LineNoSource line number of the module. Used for Fortran modules.
IsDeclThis is a module declaration; default to false; when set to true, only Scope and Name are required as this entry is just a hint for the debugger to find the corresponding definition in the global scope.

Definition at line 932 of file DIBuilder.cpp.

References llvm::MDNode::get(), getNonCompileUnitScope(), and Name.

◆ createNameSpace()

DINamespace * DIBuilder::createNameSpace ( DIScope Scope,
StringRef  Name,
bool  ExportSymbols 
)

This creates new descriptor for a namespace with the specified parent scope.

Parameters
ScopeNamespace scope
NameName of this namespace
ExportSymbolsTrue for C++ inline namespaces.

Definition at line 920 of file DIBuilder.cpp.

References llvm::MDNode::get(), getNonCompileUnitScope(), and Name.

◆ createNullPtrType()

DIBasicType * DIBuilder::createNullPtrType ( )

Create C++11 nullptr type.

Definition at line 263 of file DIBuilder.cpp.

References createUnspecifiedType().

◆ createObjCIVar()

DIDerivedType * DIBuilder::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.

Parameters
NameMember name.
FileFile where this member is defined.
LineNoLine number.
SizeInBitsMember size.
AlignInBitsMember alignment.
OffsetInBitsMember offset.
FlagsFlags to encode member attribute, e.g. private
TyParent type.
PropertyNodeProperty associated with this ivar.

Definition at line 443 of file DIBuilder.cpp.

References llvm::MDNode::get(), getNonCompileUnitScope(), and Name.

◆ createObjCProperty()

DIObjCProperty * DIBuilder::createObjCProperty ( StringRef  Name,
DIFile File,
unsigned  LineNumber,
StringRef  GetterName,
StringRef  SetterName,
unsigned  PropertyAttributes,
DIType Ty 
)

Create debugging information entry for Objective-C property.

Parameters
NameProperty name.
FileFile where this property is defined.
LineNumberLine number.
GetterNameName of the Objective C property getter selector.
SetterNameName of the Objective C property setter selector.
PropertyAttributesObjective C property attributes.
TyType.

Definition at line 454 of file DIBuilder.cpp.

References llvm::MDNode::get(), and Name.

◆ createObjectPointerType()

DIType * DIBuilder::createObjectPointerType ( DIType Ty)
static

Create a uniqued clone of Ty with FlagObjectPointer and FlagArtificial set.

Definition at line 644 of file DIBuilder.cpp.

References createTypeWithFlags(), and llvm::DIType::isObjectPointer().

◆ createParameterVariable()

DILocalVariable * DIBuilder::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.

Scope must be a DILocalScope, and thus its scope chain eventually leads to a DISubprogram.

ArgNo is the index (starting from 1) of this variable in the subprogram parameters. ArgNo should not conflict with other parameters of the same subprogram.

If AlwaysPreserve, this variable will be referenced from its containing subprogram, and will survive some optimizations.

Definition at line 818 of file DIBuilder.cpp.

References assert(), createLocalVariable(), and Name.

◆ createPointerType()

DIDerivedType * DIBuilder::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.

Parameters
PointeeTyType pointed by this pointer.
SizeInBitsSize.
AlignInBitsAlignment. (optional)
DWARFAddressSpaceDWARF address space. (optional)
NamePointer type name. (optional)
AnnotationsMember annotations.

Definition at line 316 of file DIBuilder.cpp.

References llvm::MDNode::get(), and Name.

Referenced by buildFrameDebugInfo(), and solveDIType().

◆ createPtrAuthQualifiedType()

DIDerivedType * DIBuilder::createPtrAuthQualifiedType ( DIType FromTy,
unsigned  Key,
bool  IsAddressDiscriminated,
unsigned  ExtraDiscriminator,
bool  IsaPointer,
bool  authenticatesNullValues 
)

Create a __ptrauth qualifier.

Definition at line 302 of file DIBuilder.cpp.

References llvm::MDNode::get().

◆ createQualifiedType()

DIDerivedType * DIBuilder::createQualifiedType ( unsigned  Tag,
DIType FromTy 
)

Create debugging information entry for a qualified type, e.g.

'const int'.

Parameters
TagTag identifing type, e.g. dwarf::TAG_volatile_type
FromTyBase Type.

Definition at line 297 of file DIBuilder.cpp.

References llvm::MDNode::get().

◆ createReferenceType()

DIDerivedType * DIBuilder::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.

Definition at line 339 of file DIBuilder.cpp.

References assert(), and llvm::MDNode::get().

◆ createReplaceableCompositeType()

DICompositeType * DIBuilder::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 
)

Create a temporary forward-declared type.

Definition at line 677 of file DIBuilder.cpp.

References F, getNonCompileUnitScope(), llvm::MDNode::getTemporary(), Name, and RetTy.

◆ createSetType()

DIDerivedType * DIBuilder::createSetType ( DIScope Scope,
StringRef  Name,
DIFile File,
unsigned  LineNo,
uint64_t  SizeInBits,
uint32_t  AlignInBits,
DIType Ty 
)

Create debugging information entry for a set.

Parameters
ScopeScope in which this set is defined.
NameSet name.
FileFile where this set is defined.
LineNoLine number.
SizeInBitsSet size.
AlignInBitsSet alignment.
TyBase type of the set.

Definition at line 581 of file DIBuilder.cpp.

References llvm::MDNode::get(), getNonCompileUnitScope(), and Name.

◆ createStaticMemberType()

DIDerivedType * DIBuilder::createStaticMemberType ( DIScope Scope,
StringRef  Name,
DIFile File,
unsigned  LineNo,
DIType Ty,
DINode::DIFlags  Flags,
llvm::Constant Val,
unsigned  Tag,
uint32_t  AlignInBits = 0 
)

Create debugging information entry for a C++ static data member.

Parameters
ScopeMember scope.
NameMember name.
FileFile where this member is declared.
LineNoLine number.
TyType of the static member.
FlagsFlags to encode member attribute, e.g. private.
ValConst initializer of the member.
TagDWARF tag of the static member.
AlignInBitsMember alignment.

Definition at line 431 of file DIBuilder.cpp.

References llvm::MDNode::get(), getConstantOrNull(), getNonCompileUnitScope(), and Name.

◆ createStringType() [1/3]

DIStringType * DIBuilder::createStringType ( StringRef  Name,
DIExpression StringLengthExp,
DIExpression StrLocationExp = nullptr 
)

Create debugging information entry for Fortran assumed length string type.

Parameters
NameType name.
StringLengthExpString length expressed in DIExpression form.
StrLocationExpOptional memory location of the string.

Definition at line 289 of file DIBuilder.cpp.

References assert(), llvm::MDNode::get(), and Name.

◆ createStringType() [2/3]

DIStringType * DIBuilder::createStringType ( StringRef  Name,
DIVariable StringLength,
DIExpression StrLocationExp = nullptr 
)

Create debugging information entry for Fortran assumed length string type.

Parameters
NameType name.
StringLengthString length expressed as DIVariable *.
StrLocationExpOptional memory location of the string.

Definition at line 281 of file DIBuilder.cpp.

References assert(), llvm::MDNode::get(), and Name.

◆ createStringType() [3/3]

DIStringType * DIBuilder::createStringType ( StringRef  Name,
uint64_t  SizeInBits 
)

Create debugging information entry for a string type.

Parameters
NameType name.
SizeInBitsSize of the type.

Definition at line 275 of file DIBuilder.cpp.

References assert(), llvm::MDNode::get(), and Name.

◆ createStructType()

DICompositeType * DIBuilder::createStructType ( DIScope Scope,
StringRef  Name,
DIFile File,
unsigned  LineNumber,
uint64_t  SizeInBits,
uint32_t  AlignInBits,
DINode::DIFlags  Flags,
DIType DerivedFrom,
DINodeArray  Elements,
unsigned  RunTimeLang = 0,
DIType VTableHolder = nullptr,
StringRef  UniqueIdentifier = "" 
)

Create debugging information entry for a struct.

Parameters
ScopeScope in which this struct is defined.
NameStruct name.
FileFile where this member is defined.
LineNumberLine number.
SizeInBitsMember size.
AlignInBitsMember alignment.
FlagsFlags to encode member attribute, e.g. private
ElementsStruct elements.
RunTimeLangOptional parameter, Objective-C runtime version.
UniqueIdentifierA unique identifier for the struct.

Definition at line 520 of file DIBuilder.cpp.

References llvm::MDNode::get(), getNonCompileUnitScope(), and Name.

Referenced by buildFrameDebugInfo(), and solveDIType().

◆ createSubroutineType()

DISubroutineType * DIBuilder::createSubroutineType ( DITypeRefArray  ParameterTypes,
DINode::DIFlags  Flags = DINode::FlagZero,
unsigned  CC = 0 
)

Create subroutine type.

Parameters
ParameterTypesAn array of subroutine parameter types. This includes return type at 0th index.
FlagsE.g.: LValueReference. These flags are used to emit dwarf attributes.
CCCalling convention, e.g. dwarf::DW_CC_normal

Definition at line 559 of file DIBuilder.cpp.

References CC, and llvm::MDNode::get().

Referenced by fixupDebugInfoPostExtraction().

◆ createTempFunctionFwdDecl()

DISubprogram * DIBuilder::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.

Definition at line 875 of file DIBuilder.cpp.

References getNonCompileUnitScope(), llvm::MDNode::getTemporary(), llvm::LinkageName, and Name.

◆ createTempGlobalVariableFwdDecl()

DIGlobalVariable * DIBuilder::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 RAUWed.

Definition at line 772 of file DIBuilder.cpp.

References checkGlobalVariableScope(), F, llvm::MDNode::getTemporary(), llvm::LinkageName, and Name.

◆ createTemplateAlias()

DIDerivedType * DIBuilder::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.

Parameters
TyOriginal type.
NameAlias name.
FileFile where this type is defined.
LineNoLine number.
ContextThe surrounding context for the alias.
TParamsThe template arguments.
AlignInBitsAlignment. (optional)
FlagsFlags to describe inheritance attribute (optional), e.g. private.
AnnotationsAnnotations. (optional)

Definition at line 360 of file DIBuilder.cpp.

References llvm::MDNode::get(), getNonCompileUnitScope(), and Name.

◆ createTemplateParameterPack()

DITemplateValueParameter * DIBuilder::createTemplateParameterPack ( DIScope Scope,
StringRef  Name,
DIType Ty,
DINodeArray  Val 
)

Create debugging information for a template parameter pack.

Parameters
ScopeScope in which this type is defined.
NameValue parameter name.
TyParameter type.
ValAn array of types in the pack.

Definition at line 495 of file DIBuilder.cpp.

References createTemplateValueParameterHelper(), llvm::MDNode::get(), and Name.

◆ createTemplateTemplateParameter()

DITemplateValueParameter * DIBuilder::createTemplateTemplateParameter ( DIScope Scope,
StringRef  Name,
DIType Ty,
StringRef  Val,
bool  IsDefault = false 
)

Create debugging information for a template template parameter.

Parameters
ScopeScope in which this type is defined.
NameValue parameter name.
TyParameter type.
ValThe fully qualified name of the template.
IsDefaultParameter is default or not.

Definition at line 486 of file DIBuilder.cpp.

References createTemplateValueParameterHelper(), llvm::MDString::get(), and Name.

◆ createTemplateTypeParameter()

DITemplateTypeParameter * DIBuilder::createTemplateTypeParameter ( DIScope Scope,
StringRef  Name,
DIType Ty,
bool  IsDefault 
)

Create debugging information for template type parameter.

Parameters
ScopeScope in which this type is defined.
NameType parameter name.
TyParameter type.
IsDefaultParameter is default or not

Definition at line 462 of file DIBuilder.cpp.

References assert(), llvm::MDNode::get(), and Name.

◆ createTemplateValueParameter()

DITemplateValueParameter * DIBuilder::createTemplateValueParameter ( DIScope Scope,
StringRef  Name,
DIType Ty,
bool  IsDefault,
Constant Val 
)

Create debugging information for template value parameter.

Parameters
ScopeScope in which this type is defined.
NameValue parameter name.
TyParameter type.
IsDefaultParameter is default or not
ValConstant parameter value.

Definition at line 477 of file DIBuilder.cpp.

References createTemplateValueParameterHelper(), getConstantOrNull(), and Name.

◆ createTempMacroFile()

DIMacroFile * DIBuilder::createTempMacroFile ( DIMacroFile Parent,
unsigned  Line,
DIFile File 
)

Create debugging information temporary entry for a macro file.

List of macro node direct children will be calculated by DIBuilder, using the Parent relationship.

Parameters
ParentMacro file parent (could be nullptr).
LineSource line number where the macro file is included.
FileFile descriptor containing the name of the macro file.

Definition at line 233 of file DIBuilder.cpp.

References llvm::dwarf::DW_MACINFO_start_file, and llvm::MDNode::getTemporary().

◆ createTypedef()

DIDerivedType * DIBuilder::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.

Parameters
TyOriginal type.
NameTypedef name.
FileFile where this type is defined.
LineNoLine number.
ContextThe surrounding context for the typedef.
AlignInBitsAlignment. (optional)
FlagsFlags to describe inheritance attribute, e.g. private
AnnotationsAnnotations. (optional)

Definition at line 348 of file DIBuilder.cpp.

References llvm::MDNode::get(), getNonCompileUnitScope(), and Name.

◆ createUnionType()

DICompositeType * DIBuilder::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.

Parameters
ScopeScope in which this union is defined.
NameUnion name.
FileFile where this member is defined.
LineNumberLine number.
SizeInBitsMember size.
AlignInBitsMember alignment.
FlagsFlags to encode member attribute, e.g. private
ElementsUnion elements.
RunTimeLangOptional parameter, Objective-C runtime version.
UniqueIdentifierA unique identifier for the union.

Definition at line 533 of file DIBuilder.cpp.

References llvm::MDNode::get(), getNonCompileUnitScope(), and Name.

◆ createUnspecifiedParameter()

DIBasicType * DIBuilder::createUnspecifiedParameter ( )

Create unspecified parameter type for a subroutine type.

Definition at line 660 of file DIBuilder.cpp.

◆ createUnspecifiedType()

DIBasicType * DIBuilder::createUnspecifiedType ( StringRef  Name)

Create a DWARF unspecified type.

Definition at line 258 of file DIBuilder.cpp.

References assert(), llvm::MDNode::get(), and Name.

Referenced by createNullPtrType().

◆ createVariantMemberType()

DIDerivedType * DIBuilder::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.

A variant normally should be a member of a variant part.

Parameters
ScopeMember scope.
NameMember name.
FileFile where this member is defined.
LineNoLine number.
SizeInBitsMember size.
AlignInBitsMember alignment.
OffsetInBitsMember offset.
FlagsFlags to encode member attribute, e.g. private
DiscriminantThe discriminant for this branch; null for the default branch
TyParent type.

Definition at line 406 of file DIBuilder.cpp.

References llvm::MDNode::get(), getConstantOrNull(), getNonCompileUnitScope(), and Name.

◆ createVariantPart()

DICompositeType * DIBuilder::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.

A variant part normally has a discriminator (though this is not required) and a number of variant children.

Parameters
ScopeScope in which this union is defined.
NameUnion name.
FileFile where this member is defined.
LineNumberLine number.
SizeInBitsMember size.
AlignInBitsMember alignment.
FlagsFlags to encode member attribute, e.g. private
DiscriminatorDiscriminant member
ElementsVariant elements.
UniqueIdentifierA unique identifier for the union.

Definition at line 546 of file DIBuilder.cpp.

References llvm::MDNode::get(), getNonCompileUnitScope(), and Name.

◆ createVectorType()

DICompositeType * DIBuilder::createVectorType ( uint64_t  Size,
uint32_t  AlignInBits,
DIType Ty,
DINodeArray  Subscripts 
)

Create debugging information entry for a vector type.

Parameters
SizeArray size.
AlignInBitsAlignment.
TyElement type.
SubscriptsSubscripts.

Definition at line 616 of file DIBuilder.cpp.

References llvm::MDNode::get(), and Size.

◆ finalize()

void DIBuilder::finalize ( )

◆ finalizeSubprogram()

void DIBuilder::finalizeSubprogram ( DISubprogram SP)

Finalize a specific subprogram - no new variables may be added to this subprogram afterwards.

Definition at line 56 of file DIBuilder.cpp.

References llvm::MDTuple::get().

Referenced by finalize(), and fixupDebugInfoPostExtraction().

◆ getOrCreateArray()

DINodeArray DIBuilder::getOrCreateArray ( ArrayRef< Metadata * >  Elements)

Get a DINodeArray, create one if required.

Definition at line 693 of file DIBuilder.cpp.

References llvm::MDTuple::get().

Referenced by buildFrameDebugInfo(), and solveDIType().

◆ getOrCreateGenericSubrange()

DIGenericSubrange * DIBuilder::getOrCreateGenericSubrange ( DIGenericSubrange::BoundType  Count,
DIGenericSubrange::BoundType  LowerBound,
DIGenericSubrange::BoundType  UpperBound,
DIGenericSubrange::BoundType  Stride 
)

Definition at line 732 of file DIBuilder.cpp.

References llvm::MDNode::get().

◆ getOrCreateMacroArray()

DIMacroNodeArray DIBuilder::getOrCreateMacroArray ( ArrayRef< Metadata * >  Elements)

Get a DIMacroNodeArray, create one if required.

Definition at line 698 of file DIBuilder.cpp.

References llvm::MDTuple::get().

Referenced by finalize().

◆ getOrCreateSubrange() [1/3]

DISubrange * DIBuilder::getOrCreateSubrange ( int64_t  Lo,
int64_t  Count 
)

Create a descriptor for a value range.

This implicitly uniques the values returned.

Definition at line 713 of file DIBuilder.cpp.

References llvm::ConstantAsMetadata::get(), llvm::MDNode::get(), llvm::Type::getInt64Ty(), llvm::ConstantInt::getSigned(), and llvm::Lo.

Referenced by solveDIType().

◆ getOrCreateSubrange() [2/3]

DISubrange * DIBuilder::getOrCreateSubrange ( int64_t  Lo,
Metadata CountNode 
)

◆ getOrCreateSubrange() [3/3]

DISubrange * DIBuilder::getOrCreateSubrange ( Metadata Count,
Metadata LowerBound,
Metadata UpperBound,
Metadata Stride 
)

Definition at line 727 of file DIBuilder.cpp.

References llvm::MDNode::get().

◆ getOrCreateTypeArray()

DITypeRefArray DIBuilder::getOrCreateTypeArray ( ArrayRef< Metadata * >  Elements)

Get a DITypeRefArray, create one if required.

Definition at line 702 of file DIBuilder.cpp.

References llvm::MDNode::get(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().

Referenced by fixupDebugInfoPostExtraction().

◆ insertDbgAssign()

DbgInstPtr DIBuilder::insertDbgAssign ( Instruction LinkedInstr,
Value Val,
DILocalVariable SrcVar,
DIExpression ValExpr,
Value Addr,
DIExpression AddrExpr,
const DILocation DL 
)

Insert a new llvm.dbg.assign intrinsic call.

Parameters
LinkedInstrInstruction with a DIAssignID to link with the new intrinsic. The intrinsic will be inserted after this instruction.
ValThe value component of this dbg.assign.
SrcVarVariable's debug info descriptor.
ValExprA complex location expression to modify Val.
AddrThe address component (store destination).
AddrExprA complex location expression to modify Addr. NOTE: ValExpr carries the FragInfo for the variable.
DLDebug info location, usually: (line: 0, column: 0, scope: var-decl-scope). See getDebugValueLoc.

Definition at line 971 of file DIBuilder.cpp.

References Addr, assert(), B, llvm::DbgVariableRecord::createDVRAssign(), DL, llvm::BasicBlock::end(), llvm::MetadataAsValue::get(), llvm::ValueAsMetadata::get(), llvm::Value::getContext(), llvm::Intrinsic::getDeclaration(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::Instruction::getMetadata(), llvm::Instruction::getModule(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), and llvm::Module::IsNewDbgInfoFormat.

Referenced by emitDbgAssign(), insertNewDbgInst(), and migrateDebugInfo().

◆ insertDbgValueIntrinsic() [1/2]

DbgInstPtr DIBuilder::insertDbgValueIntrinsic ( llvm::Value Val,
DILocalVariable VarInfo,
DIExpression Expr,
const DILocation DL,
BasicBlock InsertAtEnd 
)

Insert a new llvm.dbg.value intrinsic call.

Parameters
Valllvm::Value of the variable
VarInfoVariable's debug info descriptor.
ExprA complex location expression.
DLDebug info location.
InsertAtEndLocation for the new intrinsic.

Definition at line 1038 of file DIBuilder.cpp.

References DL.

◆ insertDbgValueIntrinsic() [2/2]

DbgInstPtr DIBuilder::insertDbgValueIntrinsic ( llvm::Value Val,
DILocalVariable VarInfo,
DIExpression Expr,
const DILocation DL,
Instruction InsertBefore 
)

Insert a new llvm.dbg.value intrinsic call.

Parameters
Valllvm::Value of the variable
VarInfoVariable's debug info descriptor.
ExprA complex location expression.
DLDebug info location.
InsertBeforeLocation for the new intrinsic.

Definition at line 1025 of file DIBuilder.cpp.

References DL, llvm::PointerUnion< PTs >::get(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), and llvm::PointerUnion< PTs >::is().

◆ insertDeclare() [1/2]

DbgInstPtr DIBuilder::insertDeclare ( llvm::Value Storage,
DILocalVariable VarInfo,
DIExpression Expr,
const DILocation DL,
BasicBlock InsertAtEnd 
)

Insert a new llvm.dbg.declare intrinsic call.

Parameters
Storagellvm::Value of the variable
VarInfoVariable's debug info descriptor.
ExprA complex location expression.
DLDebug info location.
InsertAtEndLocation for the new intrinsic.

Definition at line 962 of file DIBuilder.cpp.

References DL, and llvm::BasicBlock::getTerminator().

◆ insertDeclare() [2/2]

DbgInstPtr DIBuilder::insertDeclare ( llvm::Value Storage,
DILocalVariable VarInfo,
DIExpression Expr,
const DILocation DL,
Instruction InsertBefore 
)

Insert a new llvm.dbg.declare intrinsic call.

Parameters
Storagellvm::Value of the variable
VarInfoVariable's debug info descriptor.
ExprA complex location expression.
DLDebug info location.
InsertBeforeLocation for the new intrinsic.

Definition at line 955 of file DIBuilder.cpp.

References DL, and llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent().

◆ insertLabel() [1/2]

DbgInstPtr DIBuilder::insertLabel ( DILabel LabelInfo,
const DILocation DL,
BasicBlock InsertAtEnd 
)

Insert a new llvm.dbg.label intrinsic call.

Parameters
LabelInfoLabel's debug info descriptor.
DLDebug info location.
InsertAtEndLocation for the new intrinsic.

Definition at line 1020 of file DIBuilder.cpp.

References DL.

◆ insertLabel() [2/2]

DbgInstPtr DIBuilder::insertLabel ( DILabel LabelInfo,
const DILocation DL,
Instruction InsertBefore 
)

Insert a new llvm.dbg.label intrinsic call.

Parameters
LabelInfoLabel's debug info descriptor.
DLDebug info location.
InsertBeforeLocation for the new intrinsic.

Definition at line 1013 of file DIBuilder.cpp.

References DL, and llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent().

◆ operator=()

DIBuilder & llvm::DIBuilder::operator= ( const DIBuilder )
delete

◆ replaceArrays()

void DIBuilder::replaceArrays ( DICompositeType *&  T,
DINodeArray  Elements,
DINodeArray  TParams = DINodeArray() 
)

Replace arrays on a composite type.

If T is resolved, but the arrays aren't – which can happen if T has a self-reference – DIBuilder needs to track the array to resolve cycles.

Definition at line 1206 of file DIBuilder.cpp.

References N.

Referenced by buildFrameDebugInfo(), and solveDIType().

◆ replaceTemporary()

template<class NodeTy >
NodeTy * llvm::DIBuilder::replaceTemporary ( TempMDNode &&  N,
NodeTy *  Replacement 
)
inline

Replace a temporary node.

Call MDNode::replaceAllUsesWith() on N, replacing it with Replacement.

If Replacement is the same as N.get(), instead call MDNode::replaceWithUniqued(). In this case, the uniqued node could have a different address, so we return the final address.

Definition at line 1051 of file DIBuilder.h.

References N, and llvm::MDNode::replaceWithUniqued().

Referenced by finalize().

◆ replaceVTableHolder()

void DIBuilder::replaceVTableHolder ( DICompositeType *&  T,
DIType VTableHolder 
)

Replace the vtable holder in the given type.

If this creates a self reference, it may orphan some unresolved cycles in the operands of T, so DIBuilder needs to track that.

Definition at line 1187 of file DIBuilder.cpp.

References N.

◆ retainType()

void DIBuilder::retainType ( DIScope T)

Retain DIScope* in a module even if it is not referenced through debug info anchors.

Definition at line 652 of file DIBuilder.cpp.

References assert().


The documentation for this class was generated from the following files: