DebugInfo: Gut DIType and subclasses
Continuing PR23080, gut `DIType` and its various subclasses, leaving
behind thin wrappers around the pointer types in the new debug info
hierarchy.
llvm-svn: 235064
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp
index 49358d6..067a7ee 100644
--- a/llvm/lib/IR/DIBuilder.cpp
+++ b/llvm/lib/IR/DIBuilder.cpp
@@ -487,7 +487,7 @@
auto *R =
MDCompositeType::get(VMContext, dwarf::DW_TAG_array_type, "", nullptr, 0,
nullptr, MDTypeRef::get(Ty), Size, AlignInBits, 0,
- DIType::FlagVector, Subscripts, 0, nullptr);
+ DebugNode::FlagVector, Subscripts, 0, nullptr);
trackIfUnresolved(R);
return R;
}
@@ -501,27 +501,25 @@
DIType DIBuilder::createArtificialType(DIType Ty) {
// FIXME: Restrict this to the nodes where it's valid.
- if (Ty.isArtificial())
+ if (Ty->isArtificial())
return Ty;
- return createTypeWithFlags(VMContext, Ty, DIType::FlagArtificial);
+ return createTypeWithFlags(VMContext, Ty, DebugNode::FlagArtificial);
}
DIType DIBuilder::createObjectPointerType(DIType Ty) {
// FIXME: Restrict this to the nodes where it's valid.
- if (Ty.isObjectPointer())
+ if (Ty->isObjectPointer())
return Ty;
- unsigned Flags = DIType::FlagObjectPointer | DIType::FlagArtificial;
+ unsigned Flags = DebugNode::FlagObjectPointer | DebugNode::FlagArtificial;
return createTypeWithFlags(VMContext, Ty, Flags);
}
void DIBuilder::retainType(DIType T) {
- assert(T.get() && "Expected non-null type");
+ assert(T && "Expected non-null type");
AllRetainTypes.emplace_back(T);
}
-DIBasicType DIBuilder::createUnspecifiedParameter() {
- return DIBasicType();
-}
+DIBasicType DIBuilder::createUnspecifiedParameter() { return nullptr; }
DICompositeType
DIBuilder::createForwardDecl(unsigned Tag, StringRef Name, DIDescriptor Scope,
@@ -579,9 +577,9 @@
static void checkGlobalVariableScope(DIDescriptor Context) {
#ifndef NDEBUG
- if (DICompositeType CT =
+ if (auto *CT =
dyn_cast_or_null<MDCompositeType>(getNonCompileUnitScope(Context)))
- assert(!CT.getIdentifier() &&
+ assert(CT->getIdentifier().empty() &&
"Context of a global variable should not be a type with identifier");
#endif
}
@@ -675,11 +673,11 @@
unsigned ScopeLine, unsigned Flags,
bool isOptimized, Function *Fn,
MDNode *TParams, MDNode *Decl) {
- assert(Ty.getTag() == dwarf::DW_TAG_subroutine_type &&
+ assert(Ty->getTag() == dwarf::DW_TAG_subroutine_type &&
"function types should be subroutines");
auto *Node = MDSubprogram::get(
VMContext, MDScopeRef::get(DIScope(getNonCompileUnitScope(Context))),
- Name, LinkageName, File, LineNo, cast_or_null<MDSubroutineType>(Ty.get()),
+ Name, LinkageName, File, LineNo, cast_or_null<MDSubroutineType>(Ty),
isLocalToUnit, isDefinition, ScopeLine, nullptr, 0, 0, Flags, isOptimized,
Fn, cast_or_null<MDTuple>(TParams), cast_or_null<MDSubprogram>(Decl),
MDTuple::getTemporary(VMContext, None).release());
@@ -701,11 +699,10 @@
return MDSubprogram::getTemporary(
VMContext,
MDScopeRef::get(DIScope(getNonCompileUnitScope(Context))), Name,
- LinkageName, File, LineNo,
- cast_or_null<MDSubroutineType>(Ty.get()), isLocalToUnit,
- isDefinition, ScopeLine, nullptr, 0, 0, Flags, isOptimized, Fn,
- cast_or_null<MDTuple>(TParams), cast_or_null<MDSubprogram>(Decl),
- nullptr)
+ LinkageName, File, LineNo, cast_or_null<MDSubroutineType>(Ty),
+ isLocalToUnit, isDefinition, ScopeLine, nullptr, 0, 0, Flags,
+ isOptimized, Fn, cast_or_null<MDTuple>(TParams),
+ cast_or_null<MDSubprogram>(Decl), nullptr)
.release();
}
@@ -717,7 +714,7 @@
DIType VTableHolder, unsigned Flags,
bool isOptimized, Function *Fn,
MDNode *TParam) {
- assert(Ty.getTag() == dwarf::DW_TAG_subroutine_type &&
+ assert(Ty->getTag() == dwarf::DW_TAG_subroutine_type &&
"function types should be subroutines");
assert(getNonCompileUnitScope(Context) &&
"Methods should have both a Context and a context that isn't "
@@ -725,9 +722,9 @@
// FIXME: Do we want to use different scope/lines?
auto *SP = MDSubprogram::get(
VMContext, MDScopeRef::get(cast<MDScope>(Context)), Name, LinkageName, F,
- LineNo, cast_or_null<MDSubroutineType>(Ty.get()), isLocalToUnit,
- isDefinition, LineNo, MDTypeRef::get(VTableHolder), VK, VIndex, Flags,
- isOptimized, Fn, cast_or_null<MDTuple>(TParam), nullptr, nullptr);
+ LineNo, cast_or_null<MDSubroutineType>(Ty), isLocalToUnit, isDefinition,
+ LineNo, MDTypeRef::get(VTableHolder), VK, VIndex, Flags, isOptimized, Fn,
+ cast_or_null<MDTuple>(TParam), nullptr, nullptr);
if (isDefinition)
AllSubprograms.push_back(SP);