summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/debug-info-template-member.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-08-18 17:36:19 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-08-18 17:36:19 +0000
commitd27858932960f74bf05223bf63d398f1143a8830 (patch)
tree03f61b7b023bf6678cb450b707d7cefe17857797 /clang/test/CodeGenCXX/debug-info-template-member.cpp
parentadfbf993d6068a9196ed1036a9039a8cb566b3d2 (diff)
downloadbcm5719-llvm-d27858932960f74bf05223bf63d398f1143a8830.tar.gz
bcm5719-llvm-d27858932960f74bf05223bf63d398f1143a8830.zip
DebugInfo: Avoid duplicating types that may be created during the process of creating their context
A partner to r188639, this is a somewhat heavy-handed fix to the general issue, since even after that prior change the issue does still unavoidably arise with template parameters (see test case). There are other ways we could consider addressing this (see FIXME). llvm-svn: 188640
Diffstat (limited to 'clang/test/CodeGenCXX/debug-info-template-member.cpp')
-rw-r--r--clang/test/CodeGenCXX/debug-info-template-member.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/debug-info-template-member.cpp b/clang/test/CodeGenCXX/debug-info-template-member.cpp
index 2354a1a5125..0e702ac8f82 100644
--- a/clang/test/CodeGenCXX/debug-info-template-member.cpp
+++ b/clang/test/CodeGenCXX/debug-info-template-member.cpp
@@ -17,3 +17,31 @@ inline int add3(int x) {
// CHECK: metadata [[C_MEM:![0-9]*]], i32 0, null, null} ; [ DW_TAG_structure_type ] [MyClass]
// CHECK: [[C_MEM]] = metadata !{metadata [[C_TEMP:![0-9]*]]}
// CHECK: [[C_TEMP]] = {{.*}} ; [ DW_TAG_subprogram ] [line 4] [add<2>]
+
+template<typename T>
+struct outer {
+ struct inner {
+ int i;
+ };
+};
+
+struct foo {
+ void func(outer<foo>::inner);
+};
+
+inline void func() {
+ // require 'foo' to be complete before the emission of 'inner' so that, when
+ // constructing the context chain for 'x' we emit the full definition of
+ // 'foo', which requires the definition of 'inner' again
+ foo f;
+}
+
+outer<foo>::inner x;
+
+// CHECK: metadata [[OUTER_FOO_INNER:![0-9]*]], i32 {{[0-9]*}}, i32 {{[0-9]*}}, %"struct.outer<foo>::inner"* @x, {{.*}} ; [ DW_TAG_variable ] [x]
+// CHECK: [[OUTER_FOO_INNER]] = {{.*}} ; [ DW_TAG_structure_type ] [inner]
+// CHECK: [[FOO_MEM:![0-9]*]], i32 0, null, null} ; [ DW_TAG_structure_type ] [foo]
+// CHECK: [[FOO_MEM]] = metadata !{metadata [[FOO_FUNC:![0-9]*]]}
+// CHECK: [[FOO_FUNC]] = {{.*}}, metadata !"_ZN3foo4funcEN5outerIS_E5innerE", i32 {{[0-9]*}}, metadata [[FOO_FUNC_TYPE:![0-9]*]], {{.*}} ; [ DW_TAG_subprogram ] {{.*}} [func]
+// CHECK: [[FOO_FUNC_TYPE]] = {{.*}}, metadata [[FOO_FUNC_PARAMS:![0-9]*]], i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
+// CHECK: [[FOO_FUNC_PARAMS]] = metadata !{null, metadata !{{[0-9]*}}, metadata [[OUTER_FOO_INNER]]}
OpenPOWER on IntegriCloud