From f0d81a50bf4022d62297b842072fbcb5d29c345f Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Sat, 11 Apr 2015 17:37:23 +0000 Subject: 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()`. llvm-svn: 234691 --- llvm/lib/IR/DebugInfoMetadata.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'llvm/lib/IR/DebugInfoMetadata.cpp') diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp index 6ce091f54d1..e98be8ed6e7 100644 --- a/llvm/lib/IR/DebugInfoMetadata.cpp +++ b/llvm/lib/IR/DebugInfoMetadata.cpp @@ -108,6 +108,36 @@ unsigned DebugNode::splitFlags(unsigned Flags, return Flags; } +MDScopeRef MDScope::getScope() const { + if (auto *T = dyn_cast(this)) + return T->getScope(); + + if (auto *SP = dyn_cast(this)) + return SP->getScope(); + + if (auto *LB = dyn_cast(this)) + return MDScopeRef(LB->getScope()); + + if (auto *NS = dyn_cast(this)) + return MDScopeRef(NS->getScope()); + + assert((isa(this) || isa(this)) && + "Unhandled type of scope."); + return nullptr; +} + +StringRef MDScope::getName() const { + if (auto *T = dyn_cast(this)) + return T->getName(); + if (auto *SP = dyn_cast(this)) + return SP->getName(); + if (auto *NS = dyn_cast(this)) + return NS->getName(); + assert((isa(this) || isa(this) || + isa(this)) && + "Unhandled type of scope."); + return ""; +} static StringRef getString(const MDString *S) { if (S) -- cgit v1.2.3