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,
312 0,
None, DINode::FlagZero);
316 assert(Ty &&
"Invalid type!");
317 assert(FriendTy &&
"Invalid friend type!");
319 FriendTy, 0, 0, 0,
None, DINode::FlagZero);
326 assert(Ty &&
"Unable to create inheritance");
330 0, Ty, BaseTy, 0, 0, BaseOffset,
None,
338 uint64_t OffsetInBits,
342 SizeInBits, AlignInBits, OffsetInBits,
None, Flags);
353 uint64_t SizeInBits,
uint32_t AlignInBits, uint64_t OffsetInBits,
357 SizeInBits, AlignInBits, OffsetInBits,
None, Flags,
363 uint64_t SizeInBits, uint64_t OffsetInBits, uint64_t StorageOffsetInBits,
365 Flags |= DINode::FlagBitField;
367 VMContext, dwarf::DW_TAG_member, Name, File, LineNumber,
369 OffsetInBits,
None, Flags,
371 StorageOffsetInBits)));
376 unsigned LineNumber,
DIType *Ty,
379 Flags |= DINode::FlagStaticMember;
382 AlignInBits, 0,
None, Flags,
388 uint64_t SizeInBits,
uint32_t AlignInBits,
393 SizeInBits, AlignInBits, OffsetInBits,
None, Flags,
400 unsigned PropertyAttributes,
DIType *Ty) {
402 SetterName, PropertyAttributes, Ty);
408 assert((!Context || isa<DICompileUnit>(Context)) &&
"Expected compile unit");
416 assert((!Context || isa<DICompileUnit>(Context)) &&
"Expected compile unit");
424 VMContext, dwarf::DW_TAG_template_value_parameter, Context, Name, Ty,
432 VMContext, dwarf::DW_TAG_GNU_template_template_param, Context, Name, Ty,
438 DIType *Ty, DINodeArray Val) {
440 VMContext, dwarf::DW_TAG_GNU_template_parameter_pack, Context, Name, Ty,
446 uint64_t SizeInBits,
uint32_t AlignInBits, uint64_t OffsetInBits,
449 assert((!Context || isa<DIScope>(Context)) &&
450 "createClassType should be called with a valid Context");
453 VMContext, dwarf::DW_TAG_structure_type, Name, File, LineNumber,
455 OffsetInBits, Flags, Elements, 0, VTableHolder,
456 cast_or_null<MDTuple>(TemplateParams), UniqueIdentifier);
457 trackIfUnresolved(R);
464 DIType *DerivedFrom, DINodeArray Elements,
unsigned RunTimeLang,
467 VMContext, dwarf::DW_TAG_structure_type, Name, File, LineNumber,
469 Flags, Elements, RunTimeLang, VTableHolder,
nullptr, UniqueIdentifier);
470 trackIfUnresolved(R);
477 DINodeArray Elements,
unsigned RunTimeLang,
StringRef UniqueIdentifier) {
479 VMContext, dwarf::DW_TAG_union_type, Name, File, LineNumber,
481 Elements, RunTimeLang,
nullptr,
nullptr, UniqueIdentifier);
482 trackIfUnresolved(R);
491 VMContext, dwarf::DW_TAG_variant_part, Name, File, LineNumber,
493 Elements, 0,
nullptr,
nullptr, UniqueIdentifier, Discriminator);
494 trackIfUnresolved(R);
506 uint64_t SizeInBits,
uint32_t AlignInBits, DINodeArray Elements,
509 VMContext, dwarf::DW_TAG_enumeration_type, Name, File, LineNumber,
511 IsScoped ? DINode::FlagEnumClass : DINode::FlagZero, Elements, 0,
nullptr,
512 nullptr, UniqueIdentifier);
513 AllEnumTypes.push_back(CTy);
514 trackIfUnresolved(CTy);
520 DINodeArray Subscripts) {
522 nullptr, 0,
nullptr, Ty, Size, AlignInBits, 0,
523 DINode::FlagZero, Subscripts, 0,
nullptr);
524 trackIfUnresolved(R);
530 DINodeArray Subscripts) {
532 nullptr, 0,
nullptr, Ty, Size, AlignInBits, 0,
533 DINode::FlagVector, Subscripts, 0,
nullptr);
534 trackIfUnresolved(R);
539 auto NewSP = SP->cloneWithFlags(SP->getFlags() | DINode::FlagArtificial);
560 DINode::DIFlags Flags = DINode::FlagObjectPointer | DINode::FlagArtificial;
565 assert(T &&
"Expected non-null type");
566 assert((isa<DIType>(T) || (isa<DISubprogram>(T) &&
567 cast<DISubprogram>(T)->isDefinition() ==
false)) &&
568 "Expected type or subprogram declaration");
569 AllRetainTypes.emplace_back(T);
576 DIFile *
F,
unsigned Line,
unsigned RuntimeLang,
577 uint64_t SizeInBits,
uint32_t AlignInBits,
583 SizeInBits, AlignInBits, 0, DINode::FlagFwdDecl,
nullptr, RuntimeLang,
584 nullptr,
nullptr, UniqueIdentifier);
585 trackIfUnresolved(RetTy);
591 unsigned RuntimeLang, uint64_t SizeInBits,
uint32_t AlignInBits,
596 SizeInBits, AlignInBits, 0, Flags,
nullptr, RuntimeLang,
nullptr,
597 nullptr, UniqueIdentifier)
599 trackIfUnresolved(RetTy);
614 for (
unsigned i = 0, e = Elements.
size(); i != e; ++i) {
615 if (Elements[i] && isa<MDNode>(Elements[i]))
616 Elts.
push_back(cast<DIType>(Elements[i]));
635 assert(CT->getIdentifier().empty() &&
636 "Context of a global variable should not be a type with identifier");
647 VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
648 LineNumber, Ty, isLocalToUnit,
true, cast_or_null<DIDerivedType>(Decl),
649 templateParams, AlignInBits);
659 unsigned LineNumber,
DIType *Ty,
bool isLocalToUnit,
MDNode *Decl,
664 VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
665 LineNumber, Ty, isLocalToUnit,
false,
666 cast_or_null<DIDerivedType>(Decl), templateParams, AlignInBits)
684 File, LineNo, Ty, ArgNo, Flags, AlignInBits);
685 if (AlwaysPreserve) {
690 assert(Fn &&
"Missing subprogram for local variable");
691 PreservedVariables[Fn].emplace_back(Node);
698 DIType *Ty,
bool AlwaysPreserve,
702 0, File, LineNo, Ty, AlwaysPreserve,
709 assert(ArgNo &&
"Expected non-zero argument number for parameter");
711 File, LineNo, Ty, AlwaysPreserve, Flags,
717 unsigned LineNo,
bool AlwaysPreserve) {
721 DILabel::get(VMContext, cast_or_null<DILocalScope>(Context), Name,
724 if (AlwaysPreserve) {
729 assert(Fn &&
"Missing subprogram for label");
730 PreservedLabels[Fn].emplace_back(Node);
745 template <
class... Ts>
757 DITypeArray ThrownTypes) {
758 bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
761 Name, LinkageName, File, LineNo, Ty, ScopeLine,
nullptr, 0, 0, Flags,
762 SPFlags, IsDefinition ? CUNode :
nullptr, TParams, Decl,
766 AllSubprograms.push_back(Node);
767 trackIfUnresolved(Node);
776 DITypeArray ThrownTypes) {
777 bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
779 Name, LinkageName, File, LineNo, Ty,
780 ScopeLine,
nullptr, 0, 0, Flags, SPFlags,
781 IsDefinition ? CUNode :
nullptr, TParams,
782 Decl,
nullptr, ThrownTypes)
791 DITypeArray ThrownTypes) {
793 "Methods should have both a Context and a context that isn't " 794 "the compile unit.");
796 bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
798 IsDefinition, VMContext, cast<DIScope>(Context), Name,
799 LinkageName, F, LineNo, Ty, LineNo, VTableHolder, VIndex, ThisAdjustment,
800 Flags, SPFlags, IsDefinition ? CUNode :
nullptr, TParams,
nullptr,
801 nullptr, ThrownTypes);
804 AllSubprograms.push_back(
SP);
805 trackIfUnresolved(
SP);
810 bool ExportSymbols) {
826 ConfigurationMacros, IncludePath, ISysRoot);
831 unsigned Discriminator) {
836 unsigned Line,
unsigned Col) {
846 return insertDeclare(Storage, VarInfo, Expr, DL, InsertBefore->
getParent(),
856 return insertDeclare(Storage, VarInfo, Expr, DL, InsertAtEnd, InsertBefore);
862 LabelInfo, DL, InsertBefore ? InsertBefore->
getParent() :
nullptr,
868 return insertLabel(LabelInfo, DL, InsertAtEnd,
nullptr);
876 return insertDbgValueIntrinsic(
877 V, VarInfo, Expr, DL, InsertBefore ? InsertBefore->
getParent() :
nullptr,
886 return insertDbgValueIntrinsic(V, VarInfo, Expr, DL, InsertAtEnd,
nullptr);
896 B.SetInsertPoint(InsertBefore);
898 B.SetInsertPoint(InsertBB);
899 B.SetCurrentDebugLocation(DL);
904 assert(V &&
"no value passed to dbg intrinsic");
916 assert(VarInfo &&
"empty or invalid DILocalVariable* passed to dbg.declare");
917 assert(DL &&
"Expected debug loc");
918 assert(DL->getScope()->getSubprogram() ==
920 "Expected matching subprograms");
924 trackIfUnresolved(VarInfo);
925 trackIfUnresolved(Expr);
937 assert(V &&
"no value passed to dbg.value");
938 assert(VarInfo &&
"empty or invalid DILocalVariable* passed to dbg.value");
939 assert(DL &&
"Expected debug loc");
940 assert(DL->getScope()->getSubprogram() ==
942 "Expected matching subprograms");
946 trackIfUnresolved(VarInfo);
947 trackIfUnresolved(Expr);
959 assert(LabelInfo &&
"empty or invalid DILabel* passed to dbg.label");
960 assert(DL &&
"Expected debug loc");
961 assert(DL->getScope()->getSubprogram() ==
963 "Expected matching subprograms");
967 trackIfUnresolved(LabelInfo);
983 if (T != VTableHolder)
990 if (
auto *N = dyn_cast_or_null<MDNode>(
O))
991 trackIfUnresolved(N);
995 DINodeArray TParams) {
1013 trackIfUnresolved(Elements.get());
1015 trackIfUnresolved(TParams.get());
void finalize()
Construct any deferred debug info descriptors.
bool isObjectPointer() const
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.
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.
DIGlobalVariableExpression * createGlobalVariableExpression(DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DIType *Ty, bool isLocalToUnit, DIExpression *Expr=nullptr, MDNode *Decl=nullptr, MDTuple *templateParams=nullptr, uint32_t AlignInBits=0)
Create a new descriptor for the specified variable.
static DIImportedEntity * createImportedModule(LLVMContext &C, dwarf::Tag Tag, DIScope *Context, Metadata *NS, DIFile *File, unsigned Line, StringRef Name, SmallVectorImpl< TrackingMDNodeRef > &AllImportedModules)
amdgpu Simplify well known AMD library false Value Value const Twine & Name
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.
DIDerivedType * createTypedef(DIType *Ty, StringRef Name, DIFile *File, unsigned LineNo, DIScope *Context)
Create debugging information entry for a typedef.
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.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
static TempMDTuple getTemporary(LLVMContext &Context, ArrayRef< Metadata *> MDs)
DISubprogram * getDISubprogram(const MDNode *Scope)
Find subprogram that is enclosing this scope.
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
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
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.
DITypeRefArray getOrCreateTypeArray(ArrayRef< Metadata *> Elements)
Get a DITypeRefArray, create one if required.
void replaceVTableHolder(DITypeRef VTableHolder)
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.
TypedDINodeRef< DINode > DINodeRef
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)
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)
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.
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.
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.
void emplace_back(ArgTypes &&... Args)
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.
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)
DIModule * createModule(DIScope *Scope, StringRef Name, StringRef ConfigurationMacros, StringRef IncludePath, StringRef ISysRoot)
This creates new descriptor for a module with the specified parent scope.
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.
void replaceImportedEntities(DIImportedEntityArray N)
const BasicBlock * getParent() const
Basic type, like 'int' or 'float'.
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...