Fix context info for enums.
Radar 8595129

llvm-svn: 117507
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 241b25f..6f905c0 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -1376,10 +1376,12 @@
     Size = CGM.getContext().getTypeSize(ED->getTypeForDecl());
     Align = CGM.getContext().getTypeAlign(ED->getTypeForDecl());
   }
+  llvm::DIDescriptor EnumContext = 
+    getContextDescriptor(dyn_cast<Decl>(ED->getDeclContext()), Unit);
   llvm::DIType DbgTy = 
     DebugFactory.CreateCompositeType(llvm::dwarf::DW_TAG_enumeration_type,
-                                     Unit, ED->getName(), DefUnit, Line,
-                                     Size, Align, 0, 0,
+                                     EnumContext, ED->getName(),
+                                     DefUnit, Line, Size, Align, 0, 0,
                                      llvm::DIType(), EltArray);
   return DbgTy;
 }
diff --git a/clang/test/CodeGenCXX/debug-info-namespace.cpp b/clang/test/CodeGenCXX/debug-info-namespace.cpp
new file mode 100644
index 0000000..2e0a96d
--- /dev/null
+++ b/clang/test/CodeGenCXX/debug-info-namespace.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang  -g -S %s -o - | FileCheck %s
+
+// CHECK: TAG_namespace
+namespace A {
+  enum numbers {
+    ZERO,
+    ONE
+  };
+}
+
+using namespace A;
+numbers n;