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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235064 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith
2015-04-16 01:01:28 +00:00
parent 782028b4bc
commit 7f76d2954e
10 changed files with 182 additions and 241 deletions

View File

@ -487,7 +487,7 @@ DICompositeType DIBuilder::createVectorType(uint64_t Size, uint64_t AlignInBits,
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 @@ static DIType createTypeWithFlags(LLVMContext &Context, DIType Ty,
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 @@ DISubrange DIBuilder::getOrCreateSubrange(int64_t Lo, int64_t Count) {
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 @@ DISubprogram DIBuilder::createFunction(DIDescriptor Context, StringRef Name,
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 @@ DIBuilder::createTempFunctionFwdDecl(DIDescriptor Context, StringRef Name,
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 @@ DISubprogram DIBuilder::createMethod(DIDescriptor Context, StringRef Name,
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 @@ DISubprogram DIBuilder::createMethod(DIDescriptor Context, StringRef Name,
// 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);