aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/DIBuilder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR/DIBuilder.cpp')
-rw-r--r--llvm/lib/IR/DIBuilder.cpp37
1 files changed, 10 insertions, 27 deletions
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp
index d3e618b..1ce8c17 100644
--- a/llvm/lib/IR/DIBuilder.cpp
+++ b/llvm/lib/IR/DIBuilder.cpp
@@ -31,7 +31,7 @@ DIBuilder::DIBuilder(Module &m, bool AllowUnresolvedNodes, DICompileUnit *CU)
AllowUnresolvedNodes(AllowUnresolvedNodes) {
if (CUNode) {
if (const auto &ETs = CUNode->getEnumTypes())
- EnumTypes.assign(ETs.begin(), ETs.end());
+ AllEnumTypes.assign(ETs.begin(), ETs.end());
if (const auto &RTs = CUNode->getRetainedTypes())
AllRetainTypes.assign(RTs.begin(), RTs.end());
if (const auto &GVs = CUNode->getGlobalVariables())
@@ -68,10 +68,10 @@ void DIBuilder::finalize() {
return;
}
- if (!EnumTypes.empty())
+ if (!AllEnumTypes.empty())
CUNode->replaceEnumTypes(MDTuple::get(
- VMContext, SmallVector<Metadata *, 16>(EnumTypes.begin(),
- EnumTypes.end())));
+ VMContext, SmallVector<Metadata *, 16>(AllEnumTypes.begin(),
+ AllEnumTypes.end())));
SmallVector<Metadata *, 16> RetainValues;
// Declarations and definitions of the same type may be retained. Some
@@ -336,13 +336,10 @@ DIDerivedType *DIBuilder::createTypedef(DIType *Ty, StringRef Name,
DIScope *Context, uint32_t AlignInBits,
DINode::DIFlags Flags,
DINodeArray Annotations) {
- auto *T =
- DIDerivedType::get(VMContext, dwarf::DW_TAG_typedef, Name, File, LineNo,
- getNonCompileUnitScope(Context), Ty, 0, AlignInBits, 0,
- std::nullopt, Flags, nullptr, Annotations);
- if (isa_and_nonnull<DILocalScope>(Context))
- getSubprogramNodesTrackingVector(Context).emplace_back(T);
- return T;
+ return DIDerivedType::get(VMContext, dwarf::DW_TAG_typedef, Name, File,
+ LineNo, getNonCompileUnitScope(Context), Ty, 0,
+ AlignInBits, 0, std::nullopt, Flags, nullptr,
+ Annotations);
}
DIDerivedType *DIBuilder::createFriend(DIType *Ty, DIType *FriendTy) {
@@ -490,8 +487,6 @@ DICompositeType *DIBuilder::createClassType(
OffsetInBits, Flags, Elements, 0, VTableHolder,
cast_or_null<MDTuple>(TemplateParams), UniqueIdentifier);
trackIfUnresolved(R);
- if (isa_and_nonnull<DILocalScope>(Context))
- getSubprogramNodesTrackingVector(Context).emplace_back(R);
return R;
}
@@ -505,8 +500,6 @@ DICompositeType *DIBuilder::createStructType(
getNonCompileUnitScope(Context), DerivedFrom, SizeInBits, AlignInBits, 0,
Flags, Elements, RunTimeLang, VTableHolder, nullptr, UniqueIdentifier);
trackIfUnresolved(R);
- if (isa_and_nonnull<DILocalScope>(Context))
- getSubprogramNodesTrackingVector(Context).emplace_back(R);
return R;
}
@@ -519,8 +512,6 @@ DICompositeType *DIBuilder::createUnionType(
getNonCompileUnitScope(Scope), nullptr, SizeInBits, AlignInBits, 0, Flags,
Elements, RunTimeLang, nullptr, nullptr, UniqueIdentifier);
trackIfUnresolved(R);
- if (isa_and_nonnull<DILocalScope>(Scope))
- getSubprogramNodesTrackingVector(Scope).emplace_back(R);
return R;
}
@@ -553,10 +544,7 @@ DICompositeType *DIBuilder::createEnumerationType(
getNonCompileUnitScope(Scope), UnderlyingType, SizeInBits, AlignInBits, 0,
IsScoped ? DINode::FlagEnumClass : DINode::FlagZero, Elements, 0, nullptr,
nullptr, UniqueIdentifier);
- if (isa_and_nonnull<DILocalScope>(Scope))
- getSubprogramNodesTrackingVector(Scope).emplace_back(CTy);
- else
- EnumTypes.emplace_back(CTy);
+ AllEnumTypes.emplace_back(CTy);
trackIfUnresolved(CTy);
return CTy;
}
@@ -637,8 +625,7 @@ void DIBuilder::retainType(DIScope *T) {
assert((isa<DIType>(T) || (isa<DISubprogram>(T) &&
cast<DISubprogram>(T)->isDefinition() == false)) &&
"Expected type or subprogram declaration");
- if (!isa_and_nonnull<DILocalScope>(T->getScope()))
- AllRetainTypes.emplace_back(T);
+ AllRetainTypes.emplace_back(T);
}
DIBasicType *DIBuilder::createUnspecifiedParameter() { return nullptr; }
@@ -655,8 +642,6 @@ DIBuilder::createForwardDecl(unsigned Tag, StringRef Name, DIScope *Scope,
SizeInBits, AlignInBits, 0, DINode::FlagFwdDecl, nullptr, RuntimeLang,
nullptr, nullptr, UniqueIdentifier);
trackIfUnresolved(RetTy);
- if (isa_and_nonnull<DILocalScope>(Scope))
- getSubprogramNodesTrackingVector(Scope).emplace_back(RetTy);
return RetTy;
}
@@ -673,8 +658,6 @@ DICompositeType *DIBuilder::createReplaceableCompositeType(
nullptr, Annotations)
.release();
trackIfUnresolved(RetTy);
- if (isa_and_nonnull<DILocalScope>(Scope))
- getSubprogramNodesTrackingVector(Scope).emplace_back(RetTy);
return RetTy;
}