Make sure that enumerators show up within the enumeration declaration. Fixes. PR clang/3220

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61116 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index 4628761..dcefaa9 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -121,7 +121,6 @@
 }
 
 void EnumDecl::Destroy(ASTContext& C) {
-  DeclContext::DestroyDecls(C);
   Decl::Destroy(C);
 }
 
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index b7c8316..177bf1a 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -3185,6 +3185,12 @@
   
   // Register this decl in the current scope stack.
   PushOnScopeChains(New, S);
+
+  // Add this enumerator into the enum itself.
+  // FIXME: This means that the enumerator is stored in two
+  // DeclContexts. This is not a long-term solution.
+  New->setLexicalDeclContext(TheEnumDecl);
+  TheEnumDecl->addDecl(Context, New, true);
   return New;
 }