LLVM  10.0.0
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. More...
 
 DIBuilder (const DIBuilder &)=delete
 
DIBuilder & operator= (const DIBuilder &)=delete
 
void finalize ()
 Construct any deferred debug info descriptors. More...
 
void finalizeSubprogram (DISubprogram *SP)
 Finalize a specific subprogram - no new variables may be added to this subprogram afterwards. More...
 
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)
 A CompileUnit provides an anchor for all debugging information generated during this instance of compilation. More...
 
DIFile * createFile (StringRef Filename, StringRef Directory, Optional< DIFile::ChecksumInfo< StringRef >> Checksum=None, Optional< StringRef > Source=None)
 Create a file descriptor to hold debugging information for a file. More...
 
DIMacro * createMacro (DIMacroFile *Parent, unsigned Line, unsigned MacroType, StringRef Name, StringRef Value=StringRef())
 Create debugging information entry for a macro. More...
 
DIMacroFile * createTempMacroFile (DIMacroFile *Parent, unsigned Line, DIFile *File)
 Create debugging information temporary entry for a macro file. More...
 
DIEnumerator * createEnumerator (StringRef Name, int64_t Val, bool IsUnsigned=false)
 Create a single enumerator value. More...
 
DIBasicType * createUnspecifiedType (StringRef Name)
 Create a DWARF unspecified type. More...
 
DIBasicType * createNullPtrType ()
 Create C++11 nullptr type. More...
 
DIBasicType * createBasicType (StringRef Name, uint64_t SizeInBits, unsigned Encoding, DINode::DIFlags Flags=DINode::FlagZero)
 Create debugging information entry for a basic type. More...
 
DIDerivedType * createQualifiedType (unsigned Tag, DIType *FromTy)
 Create debugging information entry for a qualified type, e.g. More...
 
DIDerivedType * createPointerType (DIType *PointeeTy, uint64_t SizeInBits, uint32_t AlignInBits=0, Optional< unsigned > DWARFAddressSpace=None, StringRef Name="")
 Create debugging information entry for a pointer. More...
 
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. More...
 
DIDerivedType * createReferenceType (unsigned Tag, DIType *RTy, uint64_t SizeInBits=0, uint32_t AlignInBits=0, Optional< unsigned > DWARFAddressSpace=None)
 Create debugging information entry for a c++ style reference or rvalue reference type. More...
 
DIDerivedType * createTypedef (DIType *Ty, StringRef Name, DIFile *File, unsigned LineNo, DIScope *Context, uint32_t AlignInBits=0)
 Create debugging information entry for a typedef. More...
 
DIDerivedType * createFriend (DIType *Ty, DIType *FriendTy)
 Create debugging information entry for a 'friend'. More...
 
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. More...
 
DIDerivedType * createMemberType (DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *Ty)
 Create debugging information entry for a member. More...
 
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. More...
 
DIDerivedType * createBitFieldMemberType (DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint64_t OffsetInBits, uint64_t StorageOffsetInBits, DINode::DIFlags Flags, DIType *Ty)
 Create debugging information entry for a bit field member. More...
 
DIDerivedType * createStaticMemberType (DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, DIType *Ty, DINode::DIFlags Flags, Constant *Val, uint32_t AlignInBits=0)
 Create debugging information entry for a C++ static data member. More...
 
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. More...
 
DIObjCProperty * createObjCProperty (StringRef Name, DIFile *File, unsigned LineNumber, StringRef GetterName, StringRef SetterName, unsigned PropertyAttributes, DIType *Ty)
 Create debugging information entry for Objective-C property. More...
 
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, DIType *VTableHolder=nullptr, MDNode *TemplateParms=nullptr, StringRef UniqueIdentifier="")
 Create debugging information entry for a class. More...
 
DICompositeType * 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. More...
 
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. More...
 
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. More...
 
DITemplateTypeParameter * createTemplateTypeParameter (DIScope *Scope, StringRef Name, DIType *Ty)
 Create debugging information for template type parameter. More...
 
DITemplateValueParameter * createTemplateValueParameter (DIScope *Scope, StringRef Name, DIType *Ty, Constant *Val)
 Create debugging information for template value parameter. More...
 
DITemplateValueParameter * createTemplateTemplateParameter (DIScope *Scope, StringRef Name, DIType *Ty, StringRef Val)
 Create debugging information for a template template parameter. More...
 
DITemplateValueParameter * createTemplateParameterPack (DIScope *Scope, StringRef Name, DIType *Ty, DINodeArray Val)
 Create debugging information for a template parameter pack. More...
 
DICompositeType * createArrayType (uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts)
 Create debugging information entry for an array. More...
 
DICompositeType * createVectorType (uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts)
 Create debugging information entry for a vector type. More...
 
DICompositeType * createEnumerationType (DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, DINodeArray Elements, DIType *UnderlyingType, StringRef UniqueIdentifier="", bool IsScoped=false)
 Create debugging information entry for an enumeration. More...
 
DISubroutineType * createSubroutineType (DITypeRefArray ParameterTypes, DINode::DIFlags Flags=DINode::FlagZero, unsigned CC=0)
 Create subroutine type. More...
 
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="")
 Create a permanent forward-declared type. More...
 
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="")
 Create a temporary forward-declared type. More...
 
void retainType (DIScope *T)
 Retain DIScope* in a module even if it is not referenced through debug info anchors. More...
 
DIBasicType * createUnspecifiedParameter ()
 Create unspecified parameter type for a subroutine type. More...
 
DINodeArray getOrCreateArray (ArrayRef< Metadata *> Elements)
 Get a DINodeArray, create one if required. More...
 
DIMacroNodeArray getOrCreateMacroArray (ArrayRef< Metadata *> Elements)
 Get a DIMacroNodeArray, create one if required. More...
 
DITypeRefArray getOrCreateTypeArray (ArrayRef< Metadata *> Elements)
 Get a DITypeRefArray, create one if required. More...
 
DISubrange * getOrCreateSubrange (int64_t Lo, int64_t Count)
 Create a descriptor for a value range. More...
 
DISubrange * getOrCreateSubrange (int64_t Lo, Metadata *CountNode)
 
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)
 Create a new descriptor for the specified variable. More...
 
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 RAUWed. More...
 
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. More...
 
DILabel * createLabel (DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, bool AlwaysPreserve=false)
 Create a new descriptor for an label. More...
 
DILocalVariable * createParameterVariable (DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File, unsigned LineNo, DIType *Ty, bool AlwaysPreserve=false, DINode::DIFlags Flags=DINode::FlagZero)
 Create a new descriptor for a parameter variable. More...
 
DIExpression * createExpression (ArrayRef< uint64_t > Addr=None)
 Create a new descriptor for the specified variable which has a complex address expression for its address. More...
 
DIExpression * createExpression (ArrayRef< int64_t > Addr)
 
DIExpression * createConstantValueExpression (uint64_t Val)
 Create an expression for a variable that does not have an address, but does have a constant value. More...
 
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)
 Create a new descriptor for the specified subprogram. More...
 
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. More...
 
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)
 Create a new descriptor for the specified C++ method. More...
 
DICommonBlock * createCommonBlock (DIScope *Scope, DIGlobalVariable *decl, StringRef Name, DIFile *File, unsigned LineNo)
 Create common block entry for a Fortran common block. More...
 
DINamespace * createNameSpace (DIScope *Scope, StringRef Name, bool ExportSymbols)
 This creates new descriptor for a namespace with the specified parent scope. More...
 
DIModule * createModule (DIScope *Scope, StringRef Name, StringRef ConfigurationMacros, StringRef IncludePath, StringRef SysRoot)
 This creates new descriptor for a module with the specified parent scope. More...
 
DILexicalBlockFile * createLexicalBlockFile (DIScope *Scope, DIFile *File, unsigned Discriminator=0)
 This creates a descriptor for a lexical block with a new file attached. More...
 
DILexicalBlock * createLexicalBlock (DIScope *Scope, DIFile *File, unsigned Line, unsigned Col)
 This creates a descriptor for a lexical block with the specified parent context. More...
 
DIImportedEntity * createImportedModule (DIScope *Context, DINamespace *NS, DIFile *File, unsigned Line)
 Create a descriptor for an imported module. More...
 
DIImportedEntity * createImportedModule (DIScope *Context, DIImportedEntity *NS, DIFile *File, unsigned Line)
 Create a descriptor for an imported module. More...
 
DIImportedEntity * createImportedModule (DIScope *Context, DIModule *M, DIFile *File, unsigned Line)
 Create a descriptor for an imported module. More...
 
DIImportedEntity * createImportedDeclaration (DIScope *Context, DINode *Decl, DIFile *File, unsigned Line, StringRef Name="")
 Create a descriptor for an imported function. More...
 
Instruction * insertDeclare (llvm::Value *Storage, DILocalVariable *VarInfo, DIExpression *Expr, const DILocation *DL, BasicBlock *InsertAtEnd)
 Insert a new llvm.dbg.declare intrinsic call. More...
 
Instruction * insertDeclare (llvm::Value *Storage, DILocalVariable *VarInfo, DIExpression *Expr, const DILocation *DL, Instruction *InsertBefore)
 Insert a new llvm.dbg.declare intrinsic call. More...
 
Instruction * insertLabel (DILabel *LabelInfo, const DILocation *DL, Instruction *InsertBefore)
 Insert a new llvm.dbg.label intrinsic call. More...
 
Instruction * insertLabel (DILabel *LabelInfo, const DILocation *DL, BasicBlock *InsertAtEnd)
 Insert a new llvm.dbg.label intrinsic call. More...
 
Instruction * insertDbgValueIntrinsic (llvm::Value *Val, DILocalVariable *VarInfo, DIExpression *Expr, const DILocation *DL, BasicBlock *InsertAtEnd)
 Insert a new llvm.dbg.value intrinsic call. More...
 
Instruction * insertDbgValueIntrinsic (llvm::Value *Val, DILocalVariable *VarInfo, DIExpression *Expr, const DILocation *DL, Instruction *InsertBefore)
 Insert a new llvm.dbg.value intrinsic call. More...
 
void replaceVTableHolder (DICompositeType *&T, DIType *VTableHolder)
 Replace the vtable holder in the given type. More...
 
void replaceArrays (DICompositeType *&T, DINodeArray Elements, DINodeArray TParams=DINodeArray())
 Replace arrays on a composite type. More...
 
template<class NodeTy >
NodeTy * replaceTemporary (TempMDNode &&N, NodeTy *Replacement)
 Replace a temporary node. More...
 

Static Public Member Functions

static DISubprogram * createArtificialSubprogram (DISubprogram *SP)
 Create a distinct clone of SP with FlagArtificial set. More...
 
static DIType * createArtificialType (DIType *Ty)
 Create a uniqued clone of Ty with FlagArtificial set. More...
 
static DIType * createObjectPointerType (DIType *Ty)
 Create a uniqued clone of Ty with FlagObjectPointer and FlagArtificial set. More...
 

Detailed Description

Definition at line 41 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 34 of file DIBuilder.cpp.

References assert(), llvm::MDNode::isResolved(), and N.

◆ 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 
)

Create debugging information entry for an array.

Parameters
SizeArray size.
AlignInBitsAlignment.
TyElement type.
SubscriptsSubscripts.

Definition at line 519 of file DIBuilder.cpp.

References llvm::MDNode::get().

◆ createArtificialSubprogram()

DISubprogram * DIBuilder::createArtificialSubprogram ( DISubprogram *  SP)
static

Create a distinct clone of SP with FlagArtificial set.

Definition at line 539 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 550 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 698 of file DIBuilder.cpp.

References createLocalVariable().

◆ 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 260 of file DIBuilder.cpp.

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

◆ 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 
)

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.

Definition at line 362 of file DIBuilder.cpp.

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

◆ 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,
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.
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 445 of file DIBuilder.cpp.

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

◆ 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 811 of file DIBuilder.cpp.

References llvm::MDNode::get().

Referenced by createConstantValueExpression().

◆ 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 
)

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.

Definition at line 138 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

◆ createEnumerationType()

DICompositeType * DIBuilder::createEnumerationType ( DIScope *  Scope,
StringRef  Name,
DIFile *  File,
unsigned  LineNumber,
uint64_t  SizeInBits,
uint32_t  AlignInBits,
DINodeArray  Elements,
DIType *  UnderlyingType,
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.
UniqueIdentifierA unique identifier for the enum.
IsScopedBoolean flag indicate if this is C++11/ObjC 'enum class'.

Definition at line 505 of file DIBuilder.cpp.

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

◆ createEnumerator()

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

Create a single enumerator value.

Definition at line 245 of file DIBuilder.cpp.

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

◆ createExpression() [1/2]

DIExpression * DIBuilder::createExpression ( ArrayRef< uint64_t >  Addr = None)

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 737 of file DIBuilder.cpp.

References llvm::MDNode::get().

Referenced by createExpression(), and createGlobalVariableExpression().

◆ createExpression() [2/2]

DIExpression * DIBuilder::createExpression ( ArrayRef< int64_t >  Addr)

◆ createFile()

DIFile * DIBuilder::createFile ( StringRef  Filename,
StringRef  Directory,
Optional< DIFile::ChecksumInfo< StringRef >>  Checksum = None,
Optional< StringRef >  Source = None 
)

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 214 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 576 of file DIBuilder.cpp.

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

◆ createFriend()

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

Create debugging information entry for a 'friend'.

Definition at line 316 of file DIBuilder.cpp.

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

◆ 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 
)

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.

Definition at line 754 of file DIBuilder.cpp.

Referenced by createConstantValueExpression(), and INITIALIZE_PASS().

◆ 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 
)

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 641 of file DIBuilder.cpp.

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

◆ createImportedDeclaration()

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

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.

Definition at line 202 of file DIBuilder.cpp.

References createImportedModule().

Referenced by createConstantValueExpression().

◆ createImportedModule() [1/3]

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

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.

Definition at line 179 of file DIBuilder.cpp.

References createImportedModule().

Referenced by createConstantValueExpression().

◆ createImportedModule() [2/3]

DIImportedEntity * DIBuilder::createImportedModule ( DIScope *  Context,
DIImportedEntity *  NS,
DIFile *  File,
unsigned  Line 
)

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.

Definition at line 187 of file DIBuilder.cpp.

References createImportedModule().

◆ createImportedModule() [3/3]

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

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.

Definition at line 195 of file DIBuilder.cpp.

References createImportedModule().

◆ 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 323 of file DIBuilder.cpp.

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

◆ 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 717 of file DIBuilder.cpp.

References Context, and getNonCompileUnitScope().

◆ 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 844 of file DIBuilder.cpp.

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

Referenced by createConstantValueExpression().

◆ 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 838 of file DIBuilder.cpp.

References llvm::MDNode::get().

Referenced by createConstantValueExpression().

◆ 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 220 of file DIBuilder.cpp.

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

◆ 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 286 of file DIBuilder.cpp.

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

◆ 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 
)

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.

Definition at line 335 of file DIBuilder.cpp.

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

◆ 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 788 of file DIBuilder.cpp.

References assert(), getNonCompileUnitScope(), and getSubprogram().

Referenced by createConstantValueExpression().

◆ createModule()

DIModule * DIBuilder::createModule ( DIScope *  Scope,
StringRef  Name,
StringRef  ConfigurationMacros,
StringRef  IncludePath,
StringRef  SysRoot 
)

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.
SysRootThe clang system root (value of -isysroot).

Definition at line 830 of file DIBuilder.cpp.

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

Referenced by createConstantValueExpression().

◆ 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 818 of file DIBuilder.cpp.

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

Referenced by createConstantValueExpression().

◆ createNullPtrType()

DIBasicType * DIBuilder::createNullPtrType ( )

Create C++11 nullptr type.

Definition at line 256 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 388 of file DIBuilder.cpp.

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

◆ 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 399 of file DIBuilder.cpp.

References llvm::MDNode::get().

◆ createObjectPointerType()

DIType * DIBuilder::createObjectPointerType ( DIType *  Ty)
static

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

Definition at line 557 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 
)

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 708 of file DIBuilder.cpp.

References assert(), and createLocalVariable().

◆ createPointerType()

DIDerivedType * DIBuilder::createPointerType ( DIType *  PointeeTy,
uint64_t  SizeInBits,
uint32_t  AlignInBits = 0,
Optional< unsigned >  DWARFAddressSpace = None,
StringRef  Name = "" 
)

Create debugging information entry for a pointer.

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

Definition at line 273 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 268 of file DIBuilder.cpp.

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

◆ createReferenceType()

DIDerivedType * DIBuilder::createReferenceType ( unsigned  Tag,
DIType *  RTy,
uint64_t  SizeInBits = 0,
uint32_t  AlignInBits = 0,
Optional< unsigned >  DWARFAddressSpace = None 
)

Create debugging information entry for a c++ style reference or rvalue reference type.

Definition at line 296 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 = "" 
)

Create a temporary forward-declared type.

Definition at line 590 of file DIBuilder.cpp.

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

◆ createStaticMemberType()

DIDerivedType * DIBuilder::createStaticMemberType ( DIScope *  Scope,
StringRef  Name,
DIFile *  File,
unsigned  LineNo,
DIType *  Ty,
DINode::DIFlags  Flags,
llvm::Constant *  Val,
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.
AlignInBitsMember alignment.

Definition at line 376 of file DIBuilder.cpp.

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

◆ 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 462 of file DIBuilder.cpp.

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

◆ 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 499 of file DIBuilder.cpp.

References llvm::MDNode::get().

Referenced by INITIALIZE_PASS().

◆ 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 773 of file DIBuilder.cpp.

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

Referenced by createConstantValueExpression().

◆ 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 659 of file DIBuilder.cpp.

References checkGlobalVariableScope(), and llvm::MDNode::getTemporary().

◆ 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 438 of file DIBuilder.cpp.

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

◆ createTemplateTemplateParameter()

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

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.

Definition at line 430 of file DIBuilder.cpp.

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

◆ createTemplateTypeParameter()

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

Create debugging information for template type parameter.

Parameters
ScopeScope in which this type is defined.
NameType parameter name.
TyParameter type.

Definition at line 407 of file DIBuilder.cpp.

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

◆ createTemplateValueParameter()

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

Create debugging information for template value parameter.

Parameters
ScopeScope in which this type is defined.
NameValue parameter name.
TyParameter type.
ValConstant parameter value.

Definition at line 422 of file DIBuilder.cpp.

References createTemplateValueParameterHelper(), and getConstantOrNull().

◆ 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 232 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 
)

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)

Definition at line 307 of file DIBuilder.cpp.

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

◆ 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 475 of file DIBuilder.cpp.

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

◆ createUnspecifiedParameter()

DIBasicType * DIBuilder::createUnspecifiedParameter ( )

Create unspecified parameter type for a subroutine type.

Definition at line 573 of file DIBuilder.cpp.

◆ createUnspecifiedType()

DIBasicType * DIBuilder::createUnspecifiedType ( StringRef  Name)

Create a DWARF unspecified type.

Definition at line 251 of file DIBuilder.cpp.

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

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 352 of file DIBuilder.cpp.

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

◆ 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 487 of file DIBuilder.cpp.

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

◆ 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 529 of file DIBuilder.cpp.

References llvm::MDNode::get().

◆ 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 49 of file DIBuilder.cpp.

References llvm::SmallVectorImpl< T >::append(), llvm::MDNode::get(), llvm::MDNode::isTemporary(), and llvm::AArch64CC::PL.

Referenced by finalize(), and INITIALIZE_PASS().

◆ getOrCreateArray()

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

Get a DINodeArray, create one if required.

Definition at line 604 of file DIBuilder.cpp.

References llvm::MDTuple::get().

◆ getOrCreateMacroArray()

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

Get a DIMacroNodeArray, create one if required.

Definition at line 609 of file DIBuilder.cpp.

References llvm::MDTuple::get().

Referenced by finalize().

◆ getOrCreateSubrange() [1/2]

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 624 of file DIBuilder.cpp.

References llvm::MDNode::get().

◆ getOrCreateSubrange() [2/2]

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

Definition at line 628 of file DIBuilder.cpp.

References llvm::MDNode::get().

◆ getOrCreateTypeArray()

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

◆ insertDbgValueIntrinsic() [1/2]

Instruction * 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 890 of file DIBuilder.cpp.

◆ insertDbgValueIntrinsic() [2/2]

Instruction * 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 880 of file DIBuilder.cpp.

References llvm::Instruction::getParent().

◆ insertDeclare() [1/2]

Instruction * 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 859 of file DIBuilder.cpp.

References llvm::BasicBlock::getTerminator().

◆ insertDeclare() [2/2]

Instruction * 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 852 of file DIBuilder.cpp.

References llvm::Instruction::getParent().

◆ insertLabel() [1/2]

Instruction * 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 868 of file DIBuilder.cpp.

References llvm::Instruction::getParent().

◆ insertLabel() [2/2]

Instruction * 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 875 of file DIBuilder.cpp.

◆ 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 1003 of file DIBuilder.cpp.

References llvm::TypedTrackingMDRef< T >::get(), llvm::MDNode::isResolved(), N, llvm::DICompositeType::replaceElements(), and llvm::DICompositeType::replaceTemplateParams().

Referenced by createConstantValueExpression().

◆ 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 878 of file DIBuilder.h.

References DEFINE_ISA_CONVERSION_FUNCTIONS, llvm::MDNode::get(), llvm::MDNode::replaceAllUsesWith(), 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 983 of file DIBuilder.cpp.

References llvm::TypedTrackingMDRef< T >::get(), llvm::MDNode::isResolved(), N, llvm::RISCVFenceField::O, llvm::MDNode::operands(), and llvm::DICompositeType::replaceVTableHolder().

Referenced by createConstantValueExpression().

◆ retainType()

void DIBuilder::retainType ( DIScope *  T)

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

Definition at line 565 of file DIBuilder.cpp.

References assert().


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