summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/DebugInfo.cpp31
-rw-r--r--llvm/lib/IR/DebugInfoMetadata.cpp30
2 files changed, 30 insertions, 31 deletions
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index 4b1c1f7bbd1..6845827fc24 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -112,37 +112,6 @@ GlobalVariable *DIGlobalVariable::getGlobal() const {
return dyn_cast_or_null<GlobalVariable>(getConstant());
}
-DIScopeRef DIScope::getContext() const {
- if (DIType T = dyn_cast<MDType>(*this))
- return T.getContext();
-
- if (DISubprogram SP = dyn_cast<MDSubprogram>(*this))
- return MDScopeRef(SP.getContext());
-
- if (DILexicalBlock LB = dyn_cast<MDLexicalBlockBase>(*this))
- return MDScopeRef(LB.getContext());
-
- if (DINameSpace NS = dyn_cast<MDNamespace>(*this))
- return MDScopeRef(NS.getContext());
-
- assert((isa<MDFile>(*this) || isa<MDCompileUnit>(*this)) &&
- "Unhandled type of scope.");
- return MDScopeRef();
-}
-
-StringRef DIScope::getName() const {
- if (DIType T = dyn_cast<MDType>(*this))
- return T.getName();
- if (DISubprogram SP = dyn_cast<MDSubprogram>(*this))
- return SP.getName();
- if (DINameSpace NS = dyn_cast<MDNamespace>(*this))
- return NS.getName();
- assert((isa<MDLexicalBlockBase>(*this) || isa<MDFile>(*this) ||
- isa<MDCompileUnit>(*this)) &&
- "Unhandled type of scope.");
- return StringRef();
-}
-
void DICompileUnit::replaceSubprograms(DIArray Subprograms) {
get()->replaceSubprograms(MDSubprogramArray(Subprograms));
}
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<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)
OpenPOWER on IntegriCloud