From: Devang Patel Date: Wed, 27 Oct 2010 23:23:58 +0000 (+0000) Subject: Fix context info for enums. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4bc48877db95b2afd6207fdb54ce271169c994f9;p=clang Fix context info for enums. Radar 8595129 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117507 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 241b25f2e5..6f905c09ba 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -1376,10 +1376,12 @@ llvm::DIType CGDebugInfo::CreateEnumType(const EnumDecl *ED, llvm::DIFile Unit){ Size = CGM.getContext().getTypeSize(ED->getTypeForDecl()); Align = CGM.getContext().getTypeAlign(ED->getTypeForDecl()); } + llvm::DIDescriptor EnumContext = + getContextDescriptor(dyn_cast(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/test/CodeGenCXX/debug-info-namespace.cpp b/test/CodeGenCXX/debug-info-namespace.cpp new file mode 100644 index 0000000000..2e0a96d566 --- /dev/null +++ b/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;