DebugInfo: Move DIScope::getName() and getContext() to MDScope

Continue gutting the `DIDescriptor` hierarchy.  In this case, move the
guts of `DIScope::getName()` and `DIScope::getContext()` to
`MDScope::getName()` and `MDScope::getScope()`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234691 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith
2015-04-11 17:37:23 +00:00
parent 829e013107
commit 4e1b79bbd8
4 changed files with 37 additions and 40 deletions

View File

@ -108,6 +108,36 @@ unsigned DebugNode::splitFlags(unsigned Flags,
return Flags;
}
MDScopeRef MDScope::getScope() const {
if (auto *T = dyn_cast<MDType>(this))
return T->getScope();
if (auto *SP = dyn_cast<MDSubprogram>(this))
return SP->getScope();
if (auto *LB = dyn_cast<MDLexicalBlockBase>(this))
return MDScopeRef(LB->getScope());
if (auto *NS = dyn_cast<MDNamespace>(this))
return MDScopeRef(NS->getScope());
assert((isa<MDFile>(this) || isa<MDCompileUnit>(this)) &&
"Unhandled type of scope.");
return nullptr;
}
StringRef MDScope::getName() const {
if (auto *T = dyn_cast<MDType>(this))
return T->getName();
if (auto *SP = dyn_cast<MDSubprogram>(this))
return SP->getName();
if (auto *NS = dyn_cast<MDNamespace>(this))
return NS->getName();
assert((isa<MDLexicalBlockBase>(this) || isa<MDFile>(this) ||
isa<MDCompileUnit>(this)) &&
"Unhandled type of scope.");
return "";
}
static StringRef getString(const MDString *S) {
if (S)