diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-04-11 17:37:23 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-04-11 17:37:23 +0000 |
commit | f0d81a50bf4022d62297b842072fbcb5d29c345f (patch) | |
tree | fac4675b2878bea5d7447915e14a8effeb90f0f7 /llvm/lib/IR/DebugInfoMetadata.cpp | |
parent | 93c6a668fc17c116cb1ae184d9969b15b5fa8f65 (diff) | |
download | llvm-f0d81a50bf4022d62297b842072fbcb5d29c345f.zip llvm-f0d81a50bf4022d62297b842072fbcb5d29c345f.tar.gz llvm-f0d81a50bf4022d62297b842072fbcb5d29c345f.tar.bz2 |
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
Diffstat (limited to 'llvm/lib/IR/DebugInfoMetadata.cpp')
-rw-r--r-- | llvm/lib/IR/DebugInfoMetadata.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp index 6ce091f..e98be8e 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<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) |