DIBuilder: Change a few helpers to return downcasted MDNodes

Change `getNonCompileUnitScope()` to return `MDScope` and
`getConstantAsMetadata()` to return `ConstantAsMetadata`.  This will
make it easier to start requiring more type safety in the debug info
hierarchy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233340 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith 2015-03-27 00:34:10 +00:00
parent 50b75d5804
commit 9f2b49c521

View File

@ -121,10 +121,10 @@ void DIBuilder::finalize() {
}
/// If N is compile unit return NULL otherwise return N.
static MDNode *getNonCompileUnitScope(MDNode *N) {
if (DIDescriptor(N).isCompileUnit())
static MDScope *getNonCompileUnitScope(MDNode *N) {
if (!N || isa<MDCompileUnit>(N))
return nullptr;
return N;
return cast<MDScope>(N);
}
DICompileUnit DIBuilder::createCompileUnit(unsigned Lang, StringRef Filename,
@ -304,7 +304,7 @@ DIDerivedType DIBuilder::createMemberType(DIDescriptor Scope, StringRef Name,
AlignInBits, OffsetInBits, Flags);
}
static Metadata *getConstantOrNull(Constant *C) {
static ConstantAsMetadata *getConstantOrNull(Constant *C) {
if (C)
return ConstantAsMetadata::get(C);
return nullptr;