35 : M(m), VMContext(M.getContext()), CUNode(CU),
36 DeclareFn(nullptr), ValueFn(nullptr), LabelFn(nullptr),
37 AllowUnresolvedNodes(AllowUnresolvedNodes) {}
39 void DIBuilder::trackIfUnresolved(
MDNode *
N) {
45 assert(AllowUnresolvedNodes &&
"Cannot handle unresolved nodes");
46 UnresolvedNodes.emplace_back(N);
56 auto PV = PreservedVariables.find(SP);
57 if (PV != PreservedVariables.end())
58 RetainedNodes.
append(PV->second.begin(), PV->second.end());
60 auto PL = PreservedLabels.find(SP);
61 if (
PL != PreservedLabels.end())
62 RetainedNodes.
append(
PL->second.begin(),
PL->second.end());
66 TempMDTuple(Temp)->replaceAllUsesWith(Node.get());
71 assert(!AllowUnresolvedNodes &&
72 "creating type nodes without a CU is not supported");
84 for (
unsigned I = 0,
E = AllRetainTypes.size();
I <
E;
I++)
85 if (RetainSet.
insert(AllRetainTypes[
I]).second)
86 RetainValues.
push_back(AllRetainTypes[I]);
88 if (!RetainValues.
empty())
91 DISubprogramArray SPs =
MDTuple::get(VMContext, AllSubprograms);
94 for (
auto *N : RetainValues)
95 if (
auto *
SP = dyn_cast<DISubprogram>(N))
101 if (!AllImportedModules.empty())
104 AllImportedModules.end())));
106 for (
const auto &I : AllMacrosPerParent) {
113 auto *TMF = cast<DIMacroFile>(I.first);
115 TMF->getLine(), TMF->getFile(),
122 for (
const auto &N : UnresolvedNodes)
125 UnresolvedNodes.clear();
128 AllowUnresolvedNodes =
false;
133 if (!N || isa<DICompileUnit>(N))
135 return cast<DIScope>(
N);
142 bool SplitDebugInlining,
bool DebugInfoForProfiling,
145 assert(((Lang <= dwarf::DW_LANG_Fortran08 && Lang >= dwarf::DW_LANG_C89) ||
147 "Invalid Language tag");
149 assert(!CUNode &&
"Can only make one compile unit per DIBuilder instance");
151 VMContext, Lang, File, Producer, isOptimized, Flags, RunTimeVer,
152 SplitName, Kind,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr, DWOId,
153 SplitDebugInlining, DebugInfoForProfiling, NameTableKind,
159 trackIfUnresolved(CUNode);
168 assert(File &&
"Source location has line number but no file");
169 unsigned EntitiesCount = C.
pImpl->DIImportedEntitys.size();
172 if (EntitiesCount < C.pImpl->DIImportedEntitys.size())
210 Context, Decl, File, Line, Name,
217 return DIFile::get(VMContext, Filename, Directory, CS, Source);
223 assert(!Name.
empty() &&
"Unable to create macro without name");
226 "Unexpected macro type");
227 auto *M =
DIMacro::get(VMContext, MacroType, LineNumber, Name, Value);
228 AllMacrosPerParent[Parent].insert(M);
235 LineNumber, File, DIMacroNodeArray())
237 AllMacrosPerParent[Parent].insert(MF);
241 AllMacrosPerParent.insert({MF, {}});
247 assert(!Name.
empty() &&
"Unable to create enumerator without name");
252 assert(!Name.
empty() &&
"Unable to create type without name");
263 assert(!Name.
empty() &&
"Unable to create type without name");
264 return DIBasicType::get(VMContext, dwarf::DW_TAG_base_type, Name, SizeInBits,
270 0, 0,
None, DINode::FlagZero);
281 nullptr, 0,
nullptr, PointeeTy, SizeInBits,
282 AlignInBits, 0, DWARFAddressSpace,
292 nullptr, 0,
nullptr, PointeeTy, SizeInBits,
293 AlignInBits, 0,
None, Flags, Base);
301 assert(RTy &&
"Unable to create reference type");
303 SizeInBits, AlignInBits, 0, DWARFAddressSpace,
313 AlignInBits, 0,
None, DINode::FlagZero);
317 assert(Ty &&
"Invalid type!");
318 assert(FriendTy &&
"Invalid friend type!");
320 FriendTy, 0, 0, 0,
None, DINode::FlagZero);
327 assert(Ty &&
"Unable to create inheritance");
331 0, Ty, BaseTy, 0, 0, BaseOffset,
None,
339 uint64_t OffsetInBits,
343 SizeInBits, AlignInBits, OffsetInBits,
None, Flags);
354 uint64_t SizeInBits,
uint32_t AlignInBits, uint64_t OffsetInBits,
358 SizeInBits, AlignInBits, OffsetInBits,
None, Flags,
364 uint64_t SizeInBits, uint64_t OffsetInBits, uint64_t StorageOffsetInBits,
366 Flags |= DINode::FlagBitField;
368 VMContext, dwarf::DW_TAG_member, Name, File, LineNumber,
370 OffsetInBits,
None, Flags,
372 StorageOffsetInBits)));
377 unsigned LineNumber,
DIType *Ty,
380 Flags |= DINode::FlagStaticMember;
383 AlignInBits, 0,
None, Flags,
389 uint64_t SizeInBits,
uint32_t AlignInBits,
394 SizeInBits, AlignInBits, OffsetInBits,
None, Flags,
401 unsigned PropertyAttributes,
DIType *Ty) {
403 SetterName, PropertyAttributes, Ty);
409 assert((!Context || isa<DICompileUnit>(Context)) &&
"Expected compile unit");
417 assert((!Context || isa<DICompileUnit>(Context)) &&
"Expected compile unit");
425 VMContext, dwarf::DW_TAG_template_value_parameter, Context, Name, Ty,
433 VMContext, dwarf::DW_TAG_GNU_template_template_param, Context, Name, Ty,
439 DIType *Ty, DINodeArray Val) {
441 VMContext, dwarf::DW_TAG_GNU_template_parameter_pack, Context, Name, Ty,
447 uint64_t SizeInBits,
uint32_t AlignInBits, uint64_t OffsetInBits,
450 assert((!Context || isa<DIScope>(Context)) &&
451 "createClassType should be called with a valid Context");
454 VMContext, dwarf::DW_TAG_structure_type, Name, File, LineNumber,
456 OffsetInBits, Flags, Elements, 0, VTableHolder,
457 cast_or_null<MDTuple>(TemplateParams), UniqueIdentifier);
458 trackIfUnresolved(R);
465 DIType *DerivedFrom, DINodeArray Elements,
unsigned RunTimeLang,
468 VMContext, dwarf::DW_TAG_structure_type, Name, File, LineNumber,
470 Flags, Elements, RunTimeLang, VTableHolder,
nullptr, UniqueIdentifier);
471 trackIfUnresolved(R);
478 DINodeArray Elements,
unsigned RunTimeLang,
StringRef UniqueIdentifier) {
480 VMContext, dwarf::DW_TAG_union_type, Name, File, LineNumber,
482 Elements, RunTimeLang,
nullptr,
nullptr, UniqueIdentifier);
483 trackIfUnresolved(R);
492 VMContext, dwarf::DW_TAG_variant_part, Name, File, LineNumber,
494 Elements, 0,
nullptr,
nullptr, UniqueIdentifier, Discriminator);
495 trackIfUnresolved(R);
507 uint64_t SizeInBits,
uint32_t AlignInBits, DINodeArray Elements,
510 VMContext, dwarf::DW_TAG_enumeration_type, Name, File, LineNumber,
512 IsScoped ? DINode::FlagEnumClass : DINode::FlagZero, Elements, 0,
nullptr,
513 nullptr, UniqueIdentifier);
514 AllEnumTypes.push_back(CTy);
515 trackIfUnresolved(CTy);
521 DINodeArray Subscripts) {
523 nullptr, 0,
nullptr, Ty, Size, AlignInBits, 0,
524 DINode::FlagZero, Subscripts, 0,
nullptr);
525 trackIfUnresolved(R);
531 DINodeArray Subscripts) {
533 nullptr, 0,
nullptr, Ty, Size, AlignInBits, 0,
534 DINode::FlagVector, Subscripts, 0,
nullptr);
535 trackIfUnresolved(R);
540 auto NewSP = SP->cloneWithFlags(SP->getFlags() | DINode::FlagArtificial);
561 DINode::DIFlags Flags = DINode::FlagObjectPointer | DINode::FlagArtificial;
566 assert(T &&
"Expected non-null type");
567 assert((isa<DIType>(T) || (isa<DISubprogram>(T) &&
568 cast<DISubprogram>(T)->isDefinition() ==
false)) &&
569 "Expected type or subprogram declaration");
570 AllRetainTypes.emplace_back(T);
577 DIFile *
F,
unsigned Line,
unsigned RuntimeLang,
578 uint64_t SizeInBits,
uint32_t AlignInBits,
584 SizeInBits, AlignInBits, 0, DINode::FlagFwdDecl,
nullptr, RuntimeLang,
585 nullptr,
nullptr, UniqueIdentifier);
586 trackIfUnresolved(RetTy);
592 unsigned RuntimeLang, uint64_t SizeInBits,
uint32_t AlignInBits,
597 SizeInBits, AlignInBits, 0, Flags,
nullptr, RuntimeLang,
nullptr,
598 nullptr, UniqueIdentifier)
600 trackIfUnresolved(RetTy);
615 for (
unsigned i = 0,
e = Elements.
size(); i !=
e; ++i) {
616 if (Elements[i] && isa<MDNode>(Elements[i]))
617 Elts.
push_back(cast<DIType>(Elements[i]));
636 assert(CT->getIdentifier().empty() &&
637 "Context of a global variable should not be a type with identifier");
643 unsigned LineNumber,
DIType *Ty,
bool IsLocalToUnit,
649 VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
650 LineNumber, Ty, IsLocalToUnit, isDefined, cast_or_null<DIDerivedType>(Decl),
651 TemplateParams, AlignInBits);
661 unsigned LineNumber,
DIType *Ty,
bool IsLocalToUnit,
MDNode *Decl,
666 VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
667 LineNumber, Ty, IsLocalToUnit,
false,
668 cast_or_null<DIDerivedType>(Decl), TemplateParams, AlignInBits)
686 File, LineNo, Ty, ArgNo, Flags, AlignInBits);
687 if (AlwaysPreserve) {
692 assert(Fn &&
"Missing subprogram for local variable");
693 PreservedVariables[Fn].emplace_back(Node);
700 DIType *Ty,
bool AlwaysPreserve,
704 0, File, LineNo, Ty, AlwaysPreserve,
711 assert(ArgNo &&
"Expected non-zero argument number for parameter");
713 File, LineNo, Ty, AlwaysPreserve, Flags,
719 unsigned LineNo,
bool AlwaysPreserve) {
723 DILabel::get(VMContext, cast_or_null<DILocalScope>(Context), Name,
726 if (AlwaysPreserve) {
731 assert(Fn &&
"Missing subprogram for label");
732 PreservedLabels[Fn].emplace_back(Node);
747 template <
class... Ts>
759 DITypeArray ThrownTypes) {
760 bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
763 Name, LinkageName, File, LineNo, Ty, ScopeLine,
nullptr, 0, 0, Flags,
764 SPFlags, IsDefinition ? CUNode :
nullptr, TParams, Decl,
768 AllSubprograms.push_back(Node);
769 trackIfUnresolved(Node);
778 DITypeArray ThrownTypes) {
779 bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
781 Name, LinkageName, File, LineNo, Ty,
782 ScopeLine,
nullptr, 0, 0, Flags, SPFlags,
783 IsDefinition ? CUNode :
nullptr, TParams,
784 Decl,
nullptr, ThrownTypes)
793 DITypeArray ThrownTypes) {
795 "Methods should have both a Context and a context that isn't " 796 "the compile unit.");
798 bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
800 IsDefinition, VMContext, cast<DIScope>(Context), Name,
801 LinkageName, F, LineNo, Ty, LineNo, VTableHolder, VIndex, ThisAdjustment,
802 Flags, SPFlags, IsDefinition ? CUNode :
nullptr, TParams,
nullptr,
803 nullptr, ThrownTypes);
806 AllSubprograms.push_back(
SP);
807 trackIfUnresolved(
SP);
815 VMContext, Scope, Decl, Name, File, LineNo);
819 bool ExportSymbols) {
835 ConfigurationMacros, IncludePath, SysRoot);
840 unsigned Discriminator) {
845 unsigned Line,
unsigned Col) {
855 return insertDeclare(Storage, VarInfo, Expr, DL, InsertBefore->
getParent(),
865 return insertDeclare(Storage, VarInfo, Expr, DL, InsertAtEnd, InsertBefore);
871 LabelInfo, DL, InsertBefore ? InsertBefore->
getParent() :
nullptr,
877 return insertLabel(LabelInfo, DL, InsertAtEnd,
nullptr);
885 return insertDbgValueIntrinsic(
886 V, VarInfo, Expr, DL, InsertBefore ? InsertBefore->
getParent() :
nullptr,
895 return insertDbgValueIntrinsic(V, VarInfo, Expr, DL, InsertAtEnd,
nullptr);
905 B.SetInsertPoint(InsertBefore);
907 B.SetInsertPoint(InsertBB);
908 B.SetCurrentDebugLocation(DL);
913 assert(V &&
"no value passed to dbg intrinsic");
919 : Intrinsic::dbg_declare);
925 assert(VarInfo &&
"empty or invalid DILocalVariable* passed to dbg.declare");
926 assert(DL &&
"Expected debug loc");
927 assert(DL->getScope()->getSubprogram() ==
929 "Expected matching subprograms");
933 trackIfUnresolved(VarInfo);
934 trackIfUnresolved(Expr);
946 assert(V &&
"no value passed to dbg.value");
947 assert(VarInfo &&
"empty or invalid DILocalVariable* passed to dbg.value");
948 assert(DL &&
"Expected debug loc");
949 assert(DL->getScope()->getSubprogram() ==
951 "Expected matching subprograms");
955 trackIfUnresolved(VarInfo);
956 trackIfUnresolved(Expr);
968 assert(LabelInfo &&
"empty or invalid DILabel* passed to dbg.label");
969 assert(DL &&
"Expected debug loc");
970 assert(DL->getScope()->getSubprogram() ==
972 "Expected matching subprograms");
976 trackIfUnresolved(LabelInfo);
992 if (T != VTableHolder)
999 if (
auto *N = dyn_cast_or_null<MDNode>(
O))
1000 trackIfUnresolved(N);
1004 DINodeArray TParams) {
1022 trackIfUnresolved(Elements.get());
1024 trackIfUnresolved(TParams.get());
Scope
Defines the scope in which this symbol should be visible: Default – Visible in the public interface ...
void finalize()
Construct any deferred debug info descriptors.
bool isObjectPointer() const
reference emplace_back(ArgTypes &&... Args)
Tracking metadata reference owned by Metadata.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata *> MDs)
DIDerivedType * createPointerType(DIType *PointeeTy, uint64_t SizeInBits, uint32_t AlignInBits=0, Optional< unsigned > DWARFAddressSpace=None, StringRef Name="")
Create debugging information entry for a pointer.
static Value * getDbgIntrinsicValueImpl(LLVMContext &VMContext, Value *V)
This class represents lattice values for constants.
A Module instance is used to store all the information related to an LLVM module. ...
void replaceTemplateParams(DITemplateParameterArray TemplateParams)
DINamespace * createNameSpace(DIScope *Scope, StringRef Name, bool ExportSymbols)
This creates new descriptor for a namespace with the specified parent scope.
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
static MDString * get(LLVMContext &Context, StringRef Str)
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.
void push_back(const T &Elt)
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.
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...
void addOperand(MDNode *M)
DICompositeType * createArrayType(uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts)
Create debugging information entry for an array.
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.
NamedMDNode * getOrInsertNamedMetadata(StringRef Name)
Return the named MDNode in the module with the specified name.
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.
DISubrange * getOrCreateSubrange(int64_t Lo, int64_t Count)
Create a descriptor for a value range.
DIMacro * createMacro(DIMacroFile *Parent, unsigned Line, unsigned MacroType, StringRef Name, StringRef Value=StringRef())
Create debugging information entry for a macro.
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.
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
void replaceArrays(DICompositeType *&T, DINodeArray Elements, DINodeArray TParams=DINodeArray())
Replace arrays on a composite type.
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.
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.
DILabel * createLabel(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, bool AlwaysPreserve=false)
Create a new descriptor for an label.
static DIType * createObjectPointerType(DIType *Ty)
Create a uniqued clone of Ty with FlagObjectPointer and FlagArtificial set.
DIImportedEntity * createImportedModule(DIScope *Context, DINamespace *NS, DIFile *File, unsigned Line)
Create a descriptor for an imported module.
DIMacroNodeArray getOrCreateMacroArray(ArrayRef< Metadata *> Elements)
Get a DIMacroNodeArray, create one if required.
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.
Tagged DWARF-like metadata node.
void replaceRetainedTypes(DITypeArray N)
static std::enable_if< std::is_base_of< MDNode, T >::value, T * >::type replaceWithDistinct(std::unique_ptr< T, TempMDNodeDeleter > N)
Replace a temporary node with a distinct one.
DILexicalBlockFile * createLexicalBlockFile(DIScope *Scope, DIFile *File, unsigned Discriminator=0)
This creates a descriptor for a lexical block with a new file attached.
static DIImportedEntity * createImportedModule(LLVMContext &C, dwarf::Tag Tag, DIScope *Context, Metadata *NS, DIFile *File, unsigned Line, StringRef Name, SmallVectorImpl< TrackingMDNodeRef > &AllImportedModules)
static Function * getDeclareIntrin(Module &M)
DITemplateTypeParameter * createTemplateTypeParameter(DIScope *Scope, StringRef Name, DIType *Ty)
Create debugging information for template type parameter.
bool isResolved() const
Check if node is fully resolved.
DIBasicType * createUnspecifiedType(StringRef Name)
Create a DWARF unspecified type.
DIMacroFile * createTempMacroFile(DIMacroFile *Parent, unsigned Line, DIFile *File)
Create debugging information temporary entry for a macro file.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
DISubroutineType * createSubroutineType(DITypeRefArray ParameterTypes, DINode::DIFlags Flags=DINode::FlagZero, unsigned CC=0)
Create subroutine type.
static TempMDTuple getTemporary(LLVMContext &Context, ArrayRef< Metadata *> MDs)
DIDerivedType * createTypedef(DIType *Ty, StringRef Name, DIFile *File, unsigned LineNo, DIScope *Context, uint32_t AlignInBits=0)
Create debugging information entry for a typedef.
DISubprogram * getDISubprogram(const MDNode *Scope)
Find subprogram that is enclosing this scope.
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
void resolveCycles()
Resolve cycles.
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.
op_range operands() const
LLVMContext & getContext() const
DIEnumerator * createEnumerator(StringRef Name, int64_t Val, bool IsUnsigned=false)
Create a single enumerator value.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
TempDIType cloneWithFlags(DIFlags NewFlags) const
Returns a new temporary DIType with updated Flags.
static IRBuilder getIRBForDbgInsertion(const DILocation *DL, BasicBlock *InsertBB, Instruction *InsertBefore)
Return an IRBuilder for inserting dbg.declare and dbg.value intrinsics.
Function * getDeclaration(Module *M, ID id, ArrayRef< Type *> Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
DIBasicType * createNullPtrType()
Create C++11 nullptr type.
DICommonBlock * createCommonBlock(DIScope *Scope, DIGlobalVariable *decl, StringRef Name, DIFile *File, unsigned LineNo)
Create common block entry for a Fortran common block.
DITypeRefArray getOrCreateTypeArray(ArrayRef< Metadata *> Elements)
Get a DITypeRefArray, create one if required.
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.
DINodeArray getOrCreateArray(ArrayRef< Metadata *> Elements)
Get a DINodeArray, create one if required.
static TempMDTuple getTemporary(LLVMContext &Context, ArrayRef< Metadata *> MDs)
Return a temporary node.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata *> MDs)
initializer< Ty > init(const Ty &Val)
static DIType * createArtificialType(DIType *Ty)
Create a uniqued clone of Ty with FlagArtificial set.
static std::enable_if< std::is_base_of< MDNode, T >::value, T * >::type replaceWithUniqued(std::unique_ptr< T, TempMDNodeDeleter > N)
Replace a temporary node with a uniqued one.
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.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
A single checksum, represented by a Kind and a Value (a string).
LLVM Basic Block Representation.
This is an important class for using LLVM in a threaded context.
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.
static void checkGlobalVariableScope(DIScope *Context)
Instrumentation for Order File
size_t size() const
size - Get the array size.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This is an important base class in LLVM.
static MDTuple * getDistinct(LLVMContext &Context, ArrayRef< Metadata *> MDs)
This file contains the declarations for the subclasses of Constant, which represent the different fla...
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
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 comp...
A pair of DIGlobalVariable and DIExpression.
void replaceEnumTypes(DICompositeTypeArray N)
Replace arrays.
static DIType * createTypeWithFlags(const DIType *Ty, DINode::DIFlags FlagsToSet)
DIBasicType * createUnspecifiedParameter()
Create unspecified parameter type for a subroutine type.
static DILocalVariable * createLocalVariable(LLVMContext &VMContext, DenseMap< MDNode *, SmallVector< TrackingMDNodeRef, 1 >> &PreservedVariables, DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File, unsigned LineNo, DIType *Ty, bool AlwaysPreserve, DINode::DIFlags Flags, uint32_t AlignInBits)
static cl::opt< bool > UseDbgAddr("use-dbg-addr", llvm::cl::desc("Use llvm.dbg.addr for all local variables"), cl::init(false), cl::Hidden)
static DISubprogram * getSubprogram(bool IsDistinct, Ts &&... Args)
LLVMContextImpl *const pImpl
void retainType(DIScope *T)
Retain DIScope* in a module even if it is not referenced through debug info anchors.
An imported module (C++ using directive or similar).
Base class for scope-like contexts.
DITemplateValueParameter * createTemplateValueParameter(DIScope *Scope, StringRef Name, DIType *Ty, Constant *Val)
Create debugging information for template value parameter.
DIModule * createModule(DIScope *Scope, StringRef Name, StringRef ConfigurationMacros, StringRef IncludePath, StringRef SysRoot)
This creates new descriptor for a module with the specified parent scope.
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
static DIScope * getNonCompileUnitScope(DIScope *N)
If N is compile unit return NULL otherwise return N.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
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.
static DISubprogram * createArtificialSubprogram(DISubprogram *SP)
Create a distinct clone of SP with FlagArtificial set.
DITemplateValueParameter * createTemplateParameterPack(DIScope *Scope, StringRef Name, DIType *Ty, DINodeArray Val)
Create debugging information for a template parameter pack.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Module.h This file contains the declarations for the Module class.
DIExpression * createExpression(ArrayRef< uint64_t > Addr=None)
Create a new descriptor for the specified variable which has a complex address expression for its add...
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.
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
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.
DIBuilder(Module &M, bool AllowUnresolved=true, DICompileUnit *CU=nullptr)
Construct a builder for a module.
DISubprogram * getSubprogram() const
Get the subprogram for this scope.
This file contains constants used for implementing Dwarf debug support.
A (clang) module that has been imported by the compile unit.
DIObjCProperty * createObjCProperty(StringRef Name, DIFile *File, unsigned LineNumber, StringRef GetterName, StringRef SetterName, unsigned PropertyAttributes, DIType *Ty)
Create debugging information entry for Objective-C property.
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
DITemplateValueParameter * createTemplateTemplateParameter(DIScope *Scope, StringRef Name, DIType *Ty, StringRef Val)
Create debugging information for a template template parameter.
Type array for a subprogram.
NodeTy * replaceTemporary(TempMDNode &&N, NodeTy *Replacement)
Replace a temporary node.
DICompositeType * createVectorType(uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts)
Create debugging information entry for a vector type.
bool isArtificial() const
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.
LLVM_NODISCARD bool empty() const
DILexicalBlock * createLexicalBlock(DIScope *Scope, DIFile *File, unsigned Line, unsigned Col)
This creates a descriptor for a lexical block with the specified parent context.
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.
void replaceVTableHolder(DICompositeType *&T, DIType *VTableHolder)
Replace the vtable holder in the given type.
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.
void replaceVTableHolder(DIType *VTableHolder)
static DITemplateValueParameter * createTemplateValueParameterHelper(LLVMContext &VMContext, unsigned Tag, DIScope *Context, StringRef Name, DIType *Ty, Metadata *MD)
CallInst * CreateCall(FunctionType *FTy, Value *Callee, ArrayRef< Value *> Args=None, const Twine &Name="", MDNode *FPMathTag=nullptr)
DISPFlags
Debug info subprogram flags.
void finalizeSubprogram(DISubprogram *SP)
Finalize a specific subprogram - no new variables may be added to this subprogram afterwards...
DIBasicType * createBasicType(StringRef Name, uint64_t SizeInBits, unsigned Encoding, DINode::DIFlags Flags=DINode::FlagZero)
Create debugging information entry for a basic type.
DILocalScope * getScope() const
Get the local scope for this label.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
DIImportedEntity * createImportedDeclaration(DIScope *Context, DINode *Decl, DIFile *File, unsigned Line, StringRef Name="")
Create a descriptor for an imported function.
static ConstantAsMetadata * getConstantOrNull(Constant *C)
LLVM Value Representation.
void replaceGlobalVariables(DIGlobalVariableExpressionArray N)
void replaceMacros(DIMacroNodeArray N)
StringRef - Represent a constant reference to a string, i.e.
DIDerivedType * createQualifiedType(unsigned Tag, DIType *FromTy)
Create debugging information entry for a qualified type, e.g.
DILocalScope * getScope() const
Get the local scope for this variable.
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.
void replaceElements(DINodeArray Elements)
Replace operands.
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.
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.
DIDerivedType * createFriend(DIType *Ty, DIType *FriendTy)
Create debugging information entry for a 'friend'.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
DIGlobalVariable * createTempGlobalVariableFwdDecl(DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DIType *Ty, bool IsLocalToUnit, MDNode *Decl=nullptr, MDTuple *TemplateParams=nullptr, uint32_t AlignInBits=0)
Identical to createGlobalVariable except that the resulting DbgNode is temporary and meant to be RAUW...
void replaceImportedEntities(DIImportedEntityArray N)
const BasicBlock * getParent() const
Basic type, like 'int' or 'float'.