Debug Info: move DIScope::getContext back from DwarfDebug.

This partially reverts r190330. DIScope::getContext now returns DIScopeRef
instead of DIScope. We construct a DIScopeRef from DIScope when we are
dealing with subprogram, lexical block or name space.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190362 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index 1a527f2..4893c25 100644
--- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -919,7 +919,7 @@
     // Don't generate a hash for anything scoped inside a function.
     if (Parent.isSubprogram())
       return false;
-    Parent = DD->getScopeContext(Parent);
+    Parent = DD->resolve(Parent.getContext());
   }
   return true;
 }
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 79bb884..7db6df0 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2649,26 +2649,3 @@
 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 resolve(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();
-}
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.h b/lib/CodeGen/AsmPrinter/DwarfDebug.h
index c18fe37..e026c66 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -690,9 +690,6 @@
   /// or another context nested inside a subprogram.
   bool isSubprogramContext(const MDNode *Context);
 
-  /// Gets the parent scope for this scope node or returns a
-  /// default constructed scope.
-  DIScope getScopeContext(DIScope S) const;
 };
 } // End of namespace llvm