aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index bdcb813..1cfadc9 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2650,3 +2650,26 @@ void DwarfDebug::emitDebugStrDWO() {
DIScope DwarfDebug::resolve(DIScopeRef SRef) const {
return SRef.resolve(TypeIdentifierMap);
}
+
+// If the current node has a parent scope then return that,
+// else return an empty scope.
+DIScope DwarfDebug::getScopeContext(DIScope S) const {
+
+ if (S.isType())
+ return DIType(S).getContext();
+
+ if (S.isSubprogram())
+ return DISubprogram(S).getContext();
+
+ if (S.isLexicalBlock())
+ return DILexicalBlock(S).getContext();
+
+ if (S.isLexicalBlockFile())
+ return DILexicalBlockFile(S).getContext();
+
+ if (S.isNameSpace())
+ return DINameSpace(S).getContext();
+
+ assert((S.isFile() || S.isCompileUnit()) && "Unhandled type of scope.");
+ return DIScope();
+}