25 using namespace llvm::dwarf;
28 : M(m), VMContext(M.getContext()), CUNode(nullptr),
29 DeclareFn(nullptr), ValueFn(nullptr),
30 AllowUnresolvedNodes(AllowUnresolvedNodes) {}
32 void DIBuilder::trackIfUnresolved(
MDNode *
N) {
38 assert(AllowUnresolvedNodes &&
"Cannot handle unresolved nodes");
39 UnresolvedNodes.emplace_back(N);
44 assert(!AllowUnresolvedNodes &&
45 "creating type nodes without a CU is not supported");
57 for (
unsigned I = 0,
E = AllRetainTypes.size();
I <
E;
I++)
58 if (RetainSet.
insert(AllRetainTypes[
I]).second)
59 RetainValues.
push_back(AllRetainTypes[I]);
61 if (!RetainValues.
empty())
64 DISubprogramArray SPs =
MDTuple::get(VMContext, AllSubprograms);
66 MDTuple *Temp = SP->getVariables().get();
72 auto PV = PreservedVariables.find(SP);
73 if (PV != PreservedVariables.end())
74 Variables.
append(PV->second.begin(), PV->second.end());
77 TempMDTuple(Temp)->replaceAllUsesWith(AV.get());
81 for (
auto *N : RetainValues)
82 if (
auto *SP = dyn_cast<DISubprogram>(N))
88 if (!AllImportedModules.empty())
91 AllImportedModules.end())));
93 for (
const auto &I : AllMacrosPerParent) {
100 auto *TMF = cast<DIMacroFile>(I.first);
102 TMF->getLine(), TMF->getFile(),
109 for (
const auto &N : UnresolvedNodes)
112 UnresolvedNodes.clear();
115 AllowUnresolvedNodes =
false;
120 if (!N || isa<DICompileUnit>(N))
122 return cast<DIScope>(
N);
129 bool SplitDebugInlining) {
131 assert(((Lang <= dwarf::DW_LANG_Fortran08 && Lang >= dwarf::DW_LANG_C89) ||
133 "Invalid Language tag");
135 assert(!CUNode &&
"Can only make one compile unit per DIBuilder instance");
137 VMContext, Lang, File, Producer, isOptimized, Flags, RunTimeVer,
138 SplitName, Kind,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr, DWOId,
144 trackIfUnresolved(CUNode);
152 unsigned EntitiesCount = C.
pImpl->DIImportedEntitys.size();
154 if (EntitiesCount < C.pImpl->DIImportedEntitys.size())
165 Context, NS, Line,
StringRef(), AllImportedModules);
172 Context, NS, Line,
StringRef(), AllImportedModules);
178 Context, M, Line,
StringRef(), AllImportedModules);
188 Context, Decl, Line, Name, AllImportedModules);
193 return DIFile::get(VMContext, Filename, Directory, CSKind, Checksum);
199 assert(!Name.
empty() &&
"Unable to create macro without name");
202 "Unexpected macro type");
203 auto *M =
DIMacro::get(VMContext, MacroType, LineNumber, Name, Value);
204 AllMacrosPerParent[Parent].insert(M);
211 LineNumber, File, DIMacroNodeArray())
213 AllMacrosPerParent[Parent].insert(MF);
217 AllMacrosPerParent.insert({MF, {}});
222 assert(!Name.
empty() &&
"Unable to create enumerator without name");
227 assert(!Name.
empty() &&
"Unable to create type without name");
237 assert(!Name.
empty() &&
"Unable to create type without name");
238 return DIBasicType::get(VMContext, dwarf::DW_TAG_base_type, Name, SizeInBits,
244 0, 0, DINode::FlagZero);
253 nullptr, 0,
nullptr, PointeeTy, SizeInBits,
254 AlignInBits, 0, DINode::FlagZero);
263 nullptr, 0,
nullptr, PointeeTy, SizeInBits,
264 AlignInBits, 0, Flags, Base);
270 assert(RTy &&
"Unable to create reference type");
272 SizeInBits, AlignInBits, 0, DINode::FlagZero);
280 0, DINode::FlagZero);
284 assert(Ty &&
"Invalid type!");
285 assert(FriendTy &&
"Invalid friend type!");
287 FriendTy, 0, 0, 0, DINode::FlagZero);
293 assert(Ty &&
"Unable to create inheritance");
295 0, Ty, BaseTy, 0, 0, BaseOffset, Flags);
302 uint64_t OffsetInBits,
306 SizeInBits, AlignInBits, OffsetInBits, Flags);
317 uint64_t SizeInBits, uint64_t OffsetInBits, uint64_t StorageOffsetInBits,
319 Flags |= DINode::FlagBitField;
321 VMContext, dwarf::DW_TAG_member, Name, File, LineNumber,
325 StorageOffsetInBits)));
330 unsigned LineNumber,
DIType *Ty,
333 Flags |= DINode::FlagStaticMember;
341 uint64_t SizeInBits,
uint32_t AlignInBits,
346 SizeInBits, AlignInBits, OffsetInBits, Flags,
353 unsigned PropertyAttributes,
DIType *Ty) {
355 SetterName, PropertyAttributes, Ty);
361 assert((!Context || isa<DICompileUnit>(Context)) &&
"Expected compile unit");
369 assert((!Context || isa<DICompileUnit>(Context)) &&
"Expected compile unit");
377 VMContext, dwarf::DW_TAG_template_value_parameter, Context, Name, Ty,
385 VMContext, dwarf::DW_TAG_GNU_template_template_param, Context, Name, Ty,
391 DIType *Ty, DINodeArray Val) {
393 VMContext, dwarf::DW_TAG_GNU_template_parameter_pack, Context, Name, Ty,
399 uint64_t SizeInBits,
uint32_t AlignInBits, uint64_t OffsetInBits,
402 assert((!Context || isa<DIScope>(Context)) &&
403 "createClassType should be called with a valid Context");
406 VMContext, dwarf::DW_TAG_structure_type, Name, File, LineNumber,
408 OffsetInBits, Flags, Elements, 0, VTableHolder,
409 cast_or_null<MDTuple>(TemplateParams), UniqueIdentifier);
410 trackIfUnresolved(R);
417 DIType *DerivedFrom, DINodeArray Elements,
unsigned RunTimeLang,
420 VMContext, dwarf::DW_TAG_structure_type, Name, File, LineNumber,
422 Flags, Elements, RunTimeLang, VTableHolder,
nullptr, UniqueIdentifier);
423 trackIfUnresolved(R);
430 DINodeArray Elements,
unsigned RunTimeLang,
StringRef UniqueIdentifier) {
432 VMContext, dwarf::DW_TAG_union_type, Name, File, LineNumber,
434 Elements, RunTimeLang,
nullptr,
nullptr, UniqueIdentifier);
435 trackIfUnresolved(R);
447 assert(!UniqueIdentifier.
empty() &&
"external type ref without uid");
449 0, 0, 0, DINode::FlagExternalTypeRef,
nullptr, 0,
450 nullptr,
nullptr, UniqueIdentifier);
455 uint64_t SizeInBits,
uint32_t AlignInBits, DINodeArray Elements,
458 VMContext, dwarf::DW_TAG_enumeration_type, Name, File, LineNumber,
460 DINode::FlagZero, Elements, 0,
nullptr,
nullptr, UniqueIdentifier);
461 AllEnumTypes.push_back(CTy);
462 trackIfUnresolved(CTy);
468 DINodeArray Subscripts) {
470 nullptr, 0,
nullptr, Ty, Size, AlignInBits, 0,
471 DINode::FlagZero, Subscripts, 0,
nullptr);
472 trackIfUnresolved(R);
478 DINodeArray Subscripts) {
480 nullptr, 0,
nullptr, Ty, Size, AlignInBits, 0,
481 DINode::FlagVector, Subscripts, 0,
nullptr);
482 trackIfUnresolved(R);
488 auto NewTy = Ty->
clone();
489 NewTy->setFlags(NewTy->getFlags() | FlagsToSet);
509 assert(T &&
"Expected non-null type");
510 assert((isa<DIType>(T) || (isa<DISubprogram>(T) &&
511 cast<DISubprogram>(T)->isDefinition() ==
false)) &&
512 "Expected type or subprogram declaration");
513 AllRetainTypes.emplace_back(T);
520 DIFile *
F,
unsigned Line,
unsigned RuntimeLang,
521 uint64_t SizeInBits,
uint32_t AlignInBits,
527 SizeInBits, AlignInBits, 0, DINode::FlagFwdDecl,
nullptr, RuntimeLang,
528 nullptr,
nullptr, UniqueIdentifier);
529 trackIfUnresolved(RetTy);
535 unsigned RuntimeLang, uint64_t SizeInBits,
uint32_t AlignInBits,
540 SizeInBits, AlignInBits, 0, Flags,
nullptr, RuntimeLang,
nullptr,
541 nullptr, UniqueIdentifier)
543 trackIfUnresolved(RetTy);
558 for (
unsigned i = 0, e = Elements.
size();
i != e; ++
i) {
559 if (Elements[
i] && isa<MDNode>(Elements[
i]))
560 Elts.
push_back(cast<DIType>(Elements[i]));
575 assert(CT->getIdentifier().empty() &&
576 "Context of a global variable should not be a type with identifier");
587 VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
588 LineNumber, Ty, isLocalToUnit,
true, cast_or_null<DIDerivedType>(Decl),
597 unsigned LineNumber,
DIType *Ty,
bool isLocalToUnit,
MDNode *Decl,
602 VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
603 LineNumber, Ty, isLocalToUnit,
false,
604 cast_or_null<DIDerivedType>(Decl), AlignInBits)
622 File, LineNo, Ty, ArgNo, Flags, AlignInBits);
623 if (AlwaysPreserve) {
628 assert(Fn &&
"Missing subprogram for local variable");
629 PreservedVariables[Fn].emplace_back(Node);
636 DIType *Ty,
bool AlwaysPreserve,
640 0, File, LineNo, Ty, AlwaysPreserve,
647 assert(ArgNo &&
"Expected non-zero argument number for parameter");
649 File, LineNo, Ty, AlwaysPreserve, Flags,
664 unsigned SizeInBytes) {
669 template <
class... Ts>
680 bool isOptimized, DITemplateParameterArray TParams,
DISubprogram *Decl) {
682 isDefinition, VMContext,
684 isLocalToUnit, isDefinition, ScopeLine,
nullptr, 0, 0, 0, Flags,
685 isOptimized, isDefinition ? CUNode :
nullptr, TParams, Decl,
689 AllSubprograms.push_back(Node);
690 trackIfUnresolved(Node);
698 bool isOptimized, DITemplateParameterArray TParams,
DISubprogram *Decl) {
701 File, LineNo, Ty, isLocalToUnit, isDefinition, ScopeLine,
nullptr,
702 0, 0, 0, Flags, isOptimized, isDefinition ? CUNode :
nullptr,
703 TParams, Decl,
nullptr)
710 bool isLocalToUnit,
bool isDefinition,
711 unsigned VK,
unsigned VIndex,
712 int ThisAdjustment,
DIType *VTableHolder,
714 DITemplateParameterArray TParams) {
716 "Methods should have both a Context and a context that isn't "
717 "the compile unit.");
720 isDefinition, VMContext, cast<DIScope>(Context), Name,
721 LinkageName, F, LineNo, Ty, isLocalToUnit, isDefinition, LineNo,
722 VTableHolder, VK, VIndex, ThisAdjustment, Flags, isOptimized,
723 isDefinition ? CUNode :
nullptr, TParams,
nullptr,
nullptr);
726 AllSubprograms.push_back(SP);
727 trackIfUnresolved(SP);
733 bool ExportSymbols) {
735 LineNo, ExportSymbols);
743 ConfigurationMacros, IncludePath, ISysRoot);
748 unsigned Discriminator) {
753 unsigned Line,
unsigned Col) {
761 assert(V &&
"no value passed to dbg intrinsic");
773 assert(VarInfo &&
"empty or invalid DILocalVariable* passed to dbg.declare");
774 assert(DL &&
"Expected debug loc");
775 assert(DL->getScope()->getSubprogram() ==
777 "Expected matching subprograms");
781 trackIfUnresolved(VarInfo);
782 trackIfUnresolved(Expr);
792 assert(VarInfo &&
"empty or invalid DILocalVariable* passed to dbg.declare");
793 assert(DL &&
"Expected debug loc");
794 assert(DL->getScope()->getSubprogram() ==
796 "Expected matching subprograms");
800 trackIfUnresolved(VarInfo);
801 trackIfUnresolved(Expr);
818 assert(V &&
"no value passed to dbg.value");
819 assert(VarInfo &&
"empty or invalid DILocalVariable* passed to dbg.value");
820 assert(DL &&
"Expected debug loc");
821 assert(DL->getScope()->getSubprogram() ==
823 "Expected matching subprograms");
827 trackIfUnresolved(VarInfo);
828 trackIfUnresolved(Expr);
841 assert(V &&
"no value passed to dbg.value");
842 assert(VarInfo &&
"empty or invalid DILocalVariable* passed to dbg.value");
843 assert(DL &&
"Expected debug loc");
844 assert(DL->getScope()->getSubprogram() ==
846 "Expected matching subprograms");
850 trackIfUnresolved(VarInfo);
851 trackIfUnresolved(Expr);
869 if (T != VTableHolder)
876 if (
auto *N = dyn_cast_or_null<MDNode>(O))
877 trackIfUnresolved(N);
881 DINodeArray TParams) {
899 trackIfUnresolved(Elements.get());
901 trackIfUnresolved(TParams.get());
void finalize()
Construct any deferred debug info descriptors.
void push_back(const T &Elt)
Tracking metadata reference owned by Metadata.
static Value * getDbgIntrinsicValueImpl(LLVMContext &VMContext, Value *V)
DIDerivedType * createReferenceType(unsigned Tag, DIType *RTy, uint64_t SizeInBits=0, uint32_t AlignInBits=0)
Create debugging information entry for a c++ style reference or rvalue reference type.
bool isArtificial() const
DIGlobalVariableExpression * createGlobalVariableExpression(DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DIType *Ty, bool isLocalToUnit, DIExpression *Expr=nullptr, MDNode *Decl=nullptr, uint32_t AlignInBits=0)
Create a new descriptor for the specified variable.
A Module instance is used to store all the information related to an LLVM module. ...
static MDTuple * getDistinct(LLVMContext &Context, ArrayRef< Metadata * > MDs)
void replaceTemplateParams(DITemplateParameterArray TemplateParams)
static MDString * get(LLVMContext &Context, StringRef Str)
DIMacroNodeArray getOrCreateMacroArray(ArrayRef< Metadata * > Elements)
Get a DIMacroNodeArray, create one if required.
DILocalScope * getScope() const
Get the local scope for this variable.
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.
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.
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.
DIGlobalVariable * createTempGlobalVariableFwdDecl(DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DIType *Ty, bool isLocalToUnit, MDNode *Decl=nullptr, uint32_t AlignInBits=0)
Identical to createGlobalVariable except that the resulting DbgNode is temporary and meant to be RAUW...
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.
static IntegerType * getInt64Ty(LLVMContext &C)
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.
Instruction * insertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset, DILocalVariable *VarInfo, DIExpression *Expr, const DILocation *DL, BasicBlock *InsertAtEnd)
Insert a new llvm.dbg.value intrinsic call.
DIType * createObjectPointerType(DIType *Ty)
Create a new DIType* with the "object pointer" flag set.
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.
DITypeRefArray getOrCreateTypeArray(ArrayRef< Metadata * > Elements)
Get a DITypeRefArray, create one if required.
Tagged DWARF-like metadata node.
void replaceRetainedTypes(DITypeArray N)
DILexicalBlockFile * createLexicalBlockFile(DIScope *Scope, DIFile *File, unsigned Discriminator=0)
This creates a descriptor for a lexical block with a new file attached.
DINodeArray getOrCreateArray(ArrayRef< Metadata * > Elements)
Get a DINodeArray, create one if required.
struct fuzzer::@269 Flags
DITemplateTypeParameter * createTemplateTypeParameter(DIScope *Scope, StringRef Name, DIType *Ty)
Create debugging information for template type parameter.
Instruction * insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo, DIExpression *Expr, const DILocation *DL, BasicBlock *InsertAtEnd)
Insert a new llvm.dbg.declare intrinsic call.
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.
TypedDINodeRef< DINode > DINodeRef
Only used in LLVM metadata.
DISubprogram * getDISubprogram(const MDNode *Scope)
Find subprogram that is enclosing this scope.
static DIImportedEntity * createImportedModule(LLVMContext &C, dwarf::Tag Tag, DIScope *Context, Metadata *NS, unsigned Line, StringRef Name, SmallVectorImpl< TrackingMDNodeRef > &AllImportedModules)
void resolveCycles()
Resolve cycles.
LLVM_NODISCARD bool empty() const
DINamespace * createNameSpace(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, bool ExportSymbols)
This creates new descriptor for a namespace with the specified parent scope.
DIEnumerator * createEnumerator(StringRef Name, int64_t Val)
Create a single enumerator value.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Function * getDeclaration(Module *M, ID id, ArrayRef< Type * > Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
static TempMDTuple getTemporary(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Return a temporary node.
size_t size() const
size - Get the array size.
DIBasicType * createNullPtrType()
Create C++11 nullptr type.
DICompositeType * createEnumerationType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, DINodeArray Elements, DIType *UnderlyingType, StringRef UniqueIdentifier="")
Create debugging information entry for an enumeration.
static Instruction * withDebugLoc(Instruction *I, const DILocation *DL)
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
DISubprogram * createMethod(DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit, bool isDefinition, unsigned Virtuality=0, unsigned VTableIndex=0, int ThisAdjustment=0, DIType *VTableHolder=nullptr, DINode::DIFlags Flags=DINode::FlagZero, bool isOptimized=false, DITemplateParameterArray TParams=nullptr)
Create a new descriptor for the specified C++ method.
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.
DIType * createArtificialType(DIType *Ty)
Create a new DIType* with "artificial" flag set.
DIFile * createFile(StringRef Filename, StringRef Directory, DIFile::ChecksumKind CSKind=DIFile::CSK_None, StringRef Checksum=StringRef())
Create a file descriptor to hold debugging information for a file.
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.
DICompositeType * createExternalTypeRef(unsigned Tag, DIFile *File, StringRef UniqueIdentifier)
Create an external type reference.
Subclasses of this class are all able to terminate a basic block.
void setDebugLoc(DebugLoc Loc)
Set the debug location information for this instruction.
DISubprogram * createTempFunctionFwdDecl(DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit, bool isDefinition, unsigned ScopeLine, DINode::DIFlags Flags=DINode::FlagZero, bool isOptimized=false, DITemplateParameterArray TParams=nullptr, DISubprogram *Decl=nullptr)
Identical to createFunction, except that the resulting DbgNode is meant to be RAUWed.
void replaceVTableHolder(DICompositeType *&T, DICompositeType *VTableHolder)
Replace the vtable holder in the given composite type.
LLVM Basic Block Representation.
This is an important class for using LLVM in a threaded context.
DISubprogram * createFunction(DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit, bool isDefinition, unsigned ScopeLine, DINode::DIFlags Flags=DINode::FlagZero, bool isOptimized=false, DITemplateParameterArray TParams=nullptr, DISubprogram *Decl=nullptr)
Create a new descriptor for the specified subprogram.
static void checkGlobalVariableScope(DIScope *Context)
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
This is an important base class in LLVM.
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.
A pair of DIGlobalVariable and DIExpression.
DIImportedEntity * createImportedDeclaration(DIScope *Context, DINode *Decl, unsigned Line, StringRef Name="")
Create a descriptor for an imported function.
void replaceEnumTypes(DICompositeTypeArray N)
Replace arrays.
DIBasicType * createUnspecifiedParameter()
Create unspecified parameter type for a subroutine type.
DIBuilder(Module &M, bool AllowUnresolved=true)
Construct a builder for a module.
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)
DIExpression * createFragmentExpression(unsigned OffsetInBits, unsigned SizeInBits)
Create a descriptor to describe one part of aggregate variable that is fragmented across multiple Val...
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
bool isObjectPointer() const
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...
DITemplateValueParameter * createTemplateParameterPack(DIScope *Scope, StringRef Name, DIType *Ty, DINodeArray Val)
Create debugging information for a template parameter pack.
static CallInst * Create(Value *Func, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > Bundles=None, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
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...
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.
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
DIImportedEntity * createImportedModule(DIScope *Context, DINamespace *NS, unsigned Line)
Create a descriptor for an imported module.
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)
A CompileUnit provides an anchor for all debugging information generated during this instance of comp...
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.
static TempMDTuple getTemporary(LLVMContext &Context, ArrayRef< Metadata * > MDs)
DIBasicType * createBasicType(StringRef Name, uint64_t SizeInBits, unsigned Encoding)
Create debugging information entry for a basic type.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
DITemplateValueParameter * createTemplateTemplateParameter(DIScope *Scope, StringRef Name, DIType *Ty, StringRef Val)
Create debugging information for a template template parameter.
DIDerivedType * createPointerType(DIType *PointeeTy, uint64_t SizeInBits, uint32_t AlignInBits=0, StringRef Name="")
Create debugging information entry for a pointer.
Type array for a subprogram.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
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.
void emplace_back(ArgTypes &&...Args)
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.
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.
TerminatorInst * getTerminator()
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
static DITemplateValueParameter * createTemplateValueParameterHelper(LLVMContext &VMContext, unsigned Tag, DIScope *Context, StringRef Name, DIType *Ty, Metadata *MD)
op_range operands() const
DIDerivedType * createInheritance(DIType *Ty, DIType *BaseTy, uint64_t BaseOffset, DINode::DIFlags Flags)
Create debugging information entry to establish inheritance relationship between two types...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
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.
static DISubprogram * getSubprogram(bool IsDistinct, Ts &&...Args)
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.
bool isResolved() const
Check if node is fully resolved.
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.
DISubprogram * getSubprogram() const
Get the subprogram for this scope.
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.
static DIType * createTypeWithFlags(LLVMContext &Context, DIType *Ty, DINode::DIFlags FlagsToSet)
DIDerivedType * createFriend(DIType *Ty, DIType *FriendTy)
Create debugging information entry for a 'friend'.
void replaceImportedEntities(DIImportedEntityArray N)
Basic type, like 'int' or 'float'.