summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-10-27 23:23:58 +0000
committerDevang Patel <dpatel@apple.com>2010-10-27 23:23:58 +0000
commit1bee63f3250c33d88a8d6e12aa700b3ceeeef1ca (patch)
tree1686c713282efd206da41bc9d217f7b6896b6b02 /clang
parentcbdf7e874ae5fa0ab93bc578473b01a099791098 (diff)
downloadbcm5719-llvm-1bee63f3250c33d88a8d6e12aa700b3ceeeef1ca.tar.gz
bcm5719-llvm-1bee63f3250c33d88a8d6e12aa700b3ceeeef1ca.zip
Fix context info for enums.
Radar 8595129 llvm-svn: 117507
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp6
-rw-r--r--clang/test/CodeGenCXX/debug-info-namespace.cpp12
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;
OpenPOWER on IntegriCloud