summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/lib/IR/DIBuilder.cpp
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2019-06-23 21:36:31 +0000
committerpatrick <patrick@openbsd.org>2019-06-23 21:36:31 +0000
commit23f101f37937a1bd4a29726cab2f76e0fb038b35 (patch)
treef7da7d6b32c2e07114da399150bfa88d72187012 /gnu/llvm/lib/IR/DIBuilder.cpp
parentsort previous; ok deraadt (diff)
downloadwireguard-openbsd-23f101f37937a1bd4a29726cab2f76e0fb038b35.tar.xz
wireguard-openbsd-23f101f37937a1bd4a29726cab2f76e0fb038b35.zip
Import LLVM 8.0.0 release including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/lib/IR/DIBuilder.cpp')
-rw-r--r--gnu/llvm/lib/IR/DIBuilder.cpp86
1 files changed, 44 insertions, 42 deletions
diff --git a/gnu/llvm/lib/IR/DIBuilder.cpp b/gnu/llvm/lib/IR/DIBuilder.cpp
index 5c5477f4f40..fb81634a286 100644
--- a/gnu/llvm/lib/IR/DIBuilder.cpp
+++ b/gnu/llvm/lib/IR/DIBuilder.cpp
@@ -139,7 +139,8 @@ DICompileUnit *DIBuilder::createCompileUnit(
unsigned Lang, DIFile *File, StringRef Producer, bool isOptimized,
StringRef Flags, unsigned RunTimeVer, StringRef SplitName,
DICompileUnit::DebugEmissionKind Kind, uint64_t DWOId,
- bool SplitDebugInlining, bool DebugInfoForProfiling, bool GnuPubnames) {
+ bool SplitDebugInlining, bool DebugInfoForProfiling,
+ DICompileUnit::DebugNameTableKind NameTableKind, bool RangesBaseAddress) {
assert(((Lang <= dwarf::DW_LANG_Fortran08 && Lang >= dwarf::DW_LANG_C89) ||
(Lang <= dwarf::DW_LANG_hi_user && Lang >= dwarf::DW_LANG_lo_user)) &&
@@ -149,7 +150,8 @@ DICompileUnit *DIBuilder::createCompileUnit(
CUNode = DICompileUnit::getDistinct(
VMContext, Lang, File, Producer, isOptimized, Flags, RunTimeVer,
SplitName, Kind, nullptr, nullptr, nullptr, nullptr, nullptr, DWOId,
- SplitDebugInlining, DebugInfoForProfiling, GnuPubnames);
+ SplitDebugInlining, DebugInfoForProfiling, NameTableKind,
+ RangesBaseAddress);
// Create a named metadata so that it is easier to find cu in a module.
NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.cu");
@@ -256,10 +258,11 @@ DIBasicType *DIBuilder::createNullPtrType() {
}
DIBasicType *DIBuilder::createBasicType(StringRef Name, uint64_t SizeInBits,
- unsigned Encoding) {
+ unsigned Encoding,
+ DINode::DIFlags Flags) {
assert(!Name.empty() && "Unable to create type without name");
return DIBasicType::get(VMContext, dwarf::DW_TAG_base_type, Name, SizeInBits,
- 0, Encoding);
+ 0, Encoding, Flags);
}
DIDerivedType *DIBuilder::createQualifiedType(unsigned Tag, DIType *FromTy) {
@@ -345,13 +348,10 @@ static ConstantAsMetadata *getConstantOrNull(Constant *C) {
return nullptr;
}
-DIDerivedType *DIBuilder::createVariantMemberType(DIScope *Scope, StringRef Name,
- DIFile *File, unsigned LineNumber,
- uint64_t SizeInBits,
- uint32_t AlignInBits,
- uint64_t OffsetInBits,
- Constant *Discriminant,
- DINode::DIFlags Flags, DIType *Ty) {
+DIDerivedType *DIBuilder::createVariantMemberType(
+ DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
+ uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
+ Constant *Discriminant, DINode::DIFlags Flags, DIType *Ty) {
return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
LineNumber, getNonCompileUnitScope(Scope), Ty,
SizeInBits, AlignInBits, OffsetInBits, None, Flags,
@@ -504,11 +504,11 @@ DISubroutineType *DIBuilder::createSubroutineType(DITypeRefArray ParameterTypes,
DICompositeType *DIBuilder::createEnumerationType(
DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
uint64_t SizeInBits, uint32_t AlignInBits, DINodeArray Elements,
- DIType *UnderlyingType, StringRef UniqueIdentifier, bool IsFixed) {
+ DIType *UnderlyingType, StringRef UniqueIdentifier, bool IsScoped) {
auto *CTy = DICompositeType::get(
VMContext, dwarf::DW_TAG_enumeration_type, Name, File, LineNumber,
getNonCompileUnitScope(Scope), UnderlyingType, SizeInBits, AlignInBits, 0,
- IsFixed ? DINode::FlagFixedEnum : DINode::FlagZero, Elements, 0, nullptr,
+ IsScoped ? DINode::FlagEnumClass : DINode::FlagZero, Elements, 0, nullptr,
nullptr, UniqueIdentifier);
AllEnumTypes.push_back(CTy);
trackIfUnresolved(CTy);
@@ -640,13 +640,13 @@ static void checkGlobalVariableScope(DIScope *Context) {
DIGlobalVariableExpression *DIBuilder::createGlobalVariableExpression(
DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F,
unsigned LineNumber, DIType *Ty, bool isLocalToUnit, DIExpression *Expr,
- MDNode *Decl, uint32_t AlignInBits) {
+ MDNode *Decl, MDTuple *templateParams, uint32_t AlignInBits) {
checkGlobalVariableScope(Context);
auto *GV = DIGlobalVariable::getDistinct(
VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
LineNumber, Ty, isLocalToUnit, true, cast_or_null<DIDerivedType>(Decl),
- AlignInBits);
+ templateParams, AlignInBits);
if (!Expr)
Expr = createExpression();
auto *N = DIGlobalVariableExpression::get(VMContext, GV, Expr);
@@ -657,13 +657,13 @@ DIGlobalVariableExpression *DIBuilder::createGlobalVariableExpression(
DIGlobalVariable *DIBuilder::createTempGlobalVariableFwdDecl(
DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F,
unsigned LineNumber, DIType *Ty, bool isLocalToUnit, MDNode *Decl,
- uint32_t AlignInBits) {
+ MDTuple *templateParams, uint32_t AlignInBits) {
checkGlobalVariableScope(Context);
return DIGlobalVariable::getTemporary(
VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
LineNumber, Ty, isLocalToUnit, false,
- cast_or_null<DIDerivedType>(Decl), AlignInBits)
+ cast_or_null<DIDerivedType>(Decl), templateParams, AlignInBits)
.release();
}
@@ -751,18 +751,18 @@ static DISubprogram *getSubprogram(bool IsDistinct, Ts &&... Args) {
DISubprogram *DIBuilder::createFunction(
DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
- unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit,
- bool isDefinition, unsigned ScopeLine, DINode::DIFlags Flags,
- bool isOptimized, DITemplateParameterArray TParams, DISubprogram *Decl,
+ unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine,
+ DINode::DIFlags Flags, DISubprogram::DISPFlags SPFlags,
+ DITemplateParameterArray TParams, DISubprogram *Decl,
DITypeArray ThrownTypes) {
+ bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
auto *Node = getSubprogram(
- /* IsDistinct = */ isDefinition, VMContext,
- getNonCompileUnitScope(Context), Name, LinkageName, File, LineNo, Ty,
- isLocalToUnit, isDefinition, ScopeLine, nullptr, 0, 0, 0, Flags,
- isOptimized, isDefinition ? CUNode : nullptr, TParams, Decl,
+ /*IsDistinct=*/IsDefinition, VMContext, getNonCompileUnitScope(Context),
+ Name, LinkageName, File, LineNo, Ty, ScopeLine, nullptr, 0, 0, Flags,
+ SPFlags, IsDefinition ? CUNode : nullptr, TParams, Decl,
MDTuple::getTemporary(VMContext, None).release(), ThrownTypes);
- if (isDefinition)
+ if (IsDefinition)
AllSubprograms.push_back(Node);
trackIfUnresolved(Node);
return Node;
@@ -770,35 +770,37 @@ DISubprogram *DIBuilder::createFunction(
DISubprogram *DIBuilder::createTempFunctionFwdDecl(
DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
- unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit,
- bool isDefinition, unsigned ScopeLine, DINode::DIFlags Flags,
- bool isOptimized, DITemplateParameterArray TParams, DISubprogram *Decl,
+ unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine,
+ DINode::DIFlags Flags, DISubprogram::DISPFlags SPFlags,
+ DITemplateParameterArray TParams, DISubprogram *Decl,
DITypeArray ThrownTypes) {
- return DISubprogram::getTemporary(
- VMContext, getNonCompileUnitScope(Context), Name, LinkageName,
- File, LineNo, Ty, isLocalToUnit, isDefinition, ScopeLine, nullptr,
- 0, 0, 0, Flags, isOptimized, isDefinition ? CUNode : nullptr,
- TParams, Decl, nullptr, ThrownTypes)
+ bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
+ return DISubprogram::getTemporary(VMContext, getNonCompileUnitScope(Context),
+ Name, LinkageName, File, LineNo, Ty,
+ ScopeLine, nullptr, 0, 0, Flags, SPFlags,
+ IsDefinition ? CUNode : nullptr, TParams,
+ Decl, nullptr, ThrownTypes)
.release();
}
DISubprogram *DIBuilder::createMethod(
DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F,
- unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit,
- bool isDefinition, unsigned VK, unsigned VIndex, int ThisAdjustment,
- DIType *VTableHolder, DINode::DIFlags Flags, bool isOptimized,
- DITemplateParameterArray TParams, DITypeArray ThrownTypes) {
+ unsigned LineNo, DISubroutineType *Ty, unsigned VIndex, int ThisAdjustment,
+ DIType *VTableHolder, DINode::DIFlags Flags,
+ DISubprogram::DISPFlags SPFlags, DITemplateParameterArray TParams,
+ DITypeArray ThrownTypes) {
assert(getNonCompileUnitScope(Context) &&
"Methods should have both a Context and a context that isn't "
"the compile unit.");
// FIXME: Do we want to use different scope/lines?
+ bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
auto *SP = getSubprogram(
- /* IsDistinct = */ isDefinition, VMContext, cast<DIScope>(Context), Name,
- LinkageName, F, LineNo, Ty, isLocalToUnit, isDefinition, LineNo,
- VTableHolder, VK, VIndex, ThisAdjustment, Flags, isOptimized,
- isDefinition ? CUNode : nullptr, TParams, nullptr, nullptr, ThrownTypes);
+ /*IsDistinct=*/IsDefinition, VMContext, cast<DIScope>(Context), Name,
+ LinkageName, F, LineNo, Ty, LineNo, VTableHolder, VIndex, ThisAdjustment,
+ Flags, SPFlags, IsDefinition ? CUNode : nullptr, TParams, nullptr,
+ nullptr, ThrownTypes);
- if (isDefinition)
+ if (IsDefinition)
AllSubprograms.push_back(SP);
trackIfUnresolved(SP);
return SP;