diff options
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 6 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/debug-info-namespace.cpp | 12 |
2 files changed, 16 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 241b25f2e5f..6f905c09ba5 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/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<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 00000000000..2e0a96d5666 --- /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; |