r181552 - DebugInfo: Simply & constrain test(s) for PR9600/PR9608
David Blaikie
dblaikie at gmail.com
Thu May 9 14:32:04 PDT 2013
Author: dblaikie
Date: Thu May 9 16:32:04 2013
New Revision: 181552
URL: http://llvm.org/viewvc/llvm-project?rev=181552&view=rev
Log:
DebugInfo: Simply & constrain test(s) for PR9600/PR9608
Both these tests were ultimately fixed by the check for
"isIncompleteType" & neither test case was really reduced to a minimal
form. On doing so it becomes apparent that the problem wasn't specific
to templates at all, so I've moved the test case to a more appropriate
test file and added FileCheck verification to it (to show the forward
declaration of the array element type as well as the array alignment and
size being 0 since it cannot be computed). That's about as far down this
rabbithole as I'm willing to go today, so the rest of the un-FileChecked
tests in test/CodeGenCXX/debug-info.cpp will have to go another day
without actually testing anything other than the fact that they don't
crash.
& improve the actually interesting test case in
test/CodeGenCXX/debug-info-templates.cpp which was my original goal (in
preparation for expanding it/fixing some related bugs in non-type
template parameters)
Modified:
cfe/trunk/test/CodeGenCXX/debug-info-template.cpp
cfe/trunk/test/CodeGenCXX/debug-info.cpp
Modified: cfe/trunk/test/CodeGenCXX/debug-info-template.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-template.cpp?rev=181552&r1=181551&r2=181552&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-template.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-template.cpp Thu May 9 16:32:04 2013
@@ -1,46 +1,19 @@
// RUN: %clang -emit-llvm -g -S %s -o - | FileCheck %s
-//CHECK: TC<int>
-//CHECK: DW_TAG_template_type_parameter
+// CHECK: [[INT:![0-9]*]] = {{.*}} ; [ DW_TAG_base_type ] [int]
+// CHECK: metadata [[TCI:![0-9]*]], i32 0, i32 1, %class.TC* @tci, null} ; [ DW_TAG_variable ] [tci]
+// CHECK: [[TC:![0-9]*]] = {{.*}}, metadata [[TCARGS:![0-9]*]]} ; [ DW_TAG_class_type ] [TC<int, 2>]
+// CHECK: [[TCARGS]] = metadata !{metadata [[TCARG1:![0-9]*]], metadata [[TCARG2:![0-9]*]]}
+//
+// We seem to be missing file/line/col info on template value parameters -
+// metadata supports it but it's not populated.
+//
+// CHECK: [[TCARG1]] = {{.*}}metadata !"T", metadata [[INT]], {{.*}} ; [ DW_TAG_template_type_parameter ]
+// CHECK: [[TCARG2]] = {{.*}}metadata !"", metadata [[UINT:![0-9]*]], i64 2, {{.*}} ; [ DW_TAG_template_value_parameter ]
+// CHECK: [[UINT]] = {{.*}} ; [ DW_TAG_base_type ] [unsigned int]
-template<typename T>
+template<typename T, unsigned>
class TC {
-public:
- TC(const TC &) {}
- TC() {}
};
-TC<int> tci;
-
-//CHECK: TU<2>
-//CHECK: DW_TAG_template_value_parameter
-template<unsigned >
-class TU {
- int b;
-};
-
-TU<2> u2;
-
-// PR9600
-template<typename T> class vector {};
-class Foo;
-typedef vector<Foo*> FooVector[3];
-struct Test {
- virtual void foo(FooVector *);
-};
-static Test test;
-
-// PR9608
-template <int i> struct TheTemplate {
- struct Empty2 {};
- typedef const Empty2 DependentType[i];
- TheTemplate() {}
-};
-
-class TheTemplateTest : public TheTemplate<42> {
- TheTemplateTest();
- void method(const TheTemplate<42>::DependentType *) {}
-};
-
-TheTemplateTest::TheTemplateTest() : TheTemplate<42>() {}
-
+TC<int, 2> tci;
Modified: cfe/trunk/test/CodeGenCXX/debug-info.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info.cpp?rev=181552&r1=181551&r2=181552&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info.cpp Thu May 9 16:32:04 2013
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm-only -g %s
+// RUN: %clang_cc1 -emit-llvm-only -g %s -o - | FileCheck %s
template<typename T> struct Identity {
typedef T Type;
};
@@ -67,3 +67,12 @@ class Cls {
Cls obj;
}
+
+namespace pr9608 { // also pr9600
+struct incomplete;
+incomplete (*x)[3];
+// CHECK: metadata [[INCARRAYPTR:![0-9]*]], i32 0, i32 1, [3 x i8]** @_ZN6pr96081xE, null} ; [ DW_TAG_variable ] [x]
+// CHECK: [[INCARRAYPTR]] = {{.*}}metadata [[INCARRAY:![0-9]*]]} ; [ DW_TAG_pointer_type ]
+// CHECK: [[INCARRAY]] = {{.*}}metadata [[INCTYPE:![0-9]*]], metadata {{![0-9]*}}, i32 0, i32 0} ; [ DW_TAG_array_type ] [line 0, size 0, align 0, offset 0] [from incomplete]
+// CHECK: [[INCTYPE]] = {{.*}} ; [ DW_TAG_structure_type ] [incomplete]{{.*}} [fwd]
+}
More information about the cfe-commits
mailing list