Generalize DebugInfo tests by avoiding explicit metadata numbers

This addresses several (not all) debug info tests that use explicit metadata
numbers. Wherever the same number appeared more than once in a test I used
a named match to ensure the same number appeared in all those cases (this may
still be overly constraining test cases as they may not have actually cared
about that relationship). For one-off numbers I just replaced them with an
unnamed regex.

This may underconstrain poorly written test cases that were interested in
checking that certain metadata nodes were related but didn't actually match
on all the related nodes numbers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174247 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie 2013-02-02 00:34:26 +00:00
Родитель 1513eb9284
Коммит 083b90d654
17 изменённых файлов: 39 добавлений и 36 удалений

Просмотреть файл

@ -6,5 +6,5 @@ int main() {
return 0;
}
// CHECK: metadata !{i32 {{.*}}, i32 0, metadata !5, metadata !"localstatic", metadata !"localstatic", metadata !"", metadata !6, i32 5, metadata !9, i32 1, i32 1, i32* @main.localstatic, null} ; [ DW_TAG_variable ]
// CHECK: metadata !{i32 {{.*}}, i32 0, null, metadata !"global", metadata !"global", metadata !"", metadata !6, i32 3, metadata !9, i32 0, i32 1, i32* @global, null} ; [ DW_TAG_variable ]
// CHECK: metadata !{i32 {{.*}}, i32 0, metadata !{{.*}}, metadata !"localstatic", metadata !"localstatic", metadata !"", metadata !{{.*}}, i32 5, metadata !{{.*}}, i32 1, i32 1, i32* @main.localstatic, null} ; [ DW_TAG_variable ]
// CHECK: metadata !{i32 {{.*}}, i32 0, null, metadata !"global", metadata !"global", metadata !"", metadata !{{.*}}, i32 3, metadata !{{.*}}, i32 0, i32 1, i32* @global, null} ; [ DW_TAG_variable ]

Просмотреть файл

@ -2,8 +2,8 @@
int somefunc(char *x, int y, double z) {
// CHECK: {{.*metadata !8, i32 0, i32 0}.*DW_TAG_subroutine_type}}
// CHECK: {{!8 = .*metadata ![^,]*, metadata ![^,]*, metadata ![^,]*, metadata ![^,]*}}
// CHECK: metadata ![[NUM:[^,]*]], i32 0, i32 0} ; [ DW_TAG_subroutine_type
// CHECK: ![[NUM]] = {{metadata !{metadata ![^,]*, metadata ![^,]*, metadata ![^,]*, metadata ![^,]*}}}
return y;
}

Просмотреть файл

@ -23,8 +23,8 @@ int main(int argc, char **argv) {
}
// FIXME: The numbers are truly awful.
// CHECK: !16 = metadata !{i32 786447, i32 0, metadata !"", i32 0, i32 0, i64 64, i64 64, i64 0, i32 1088, metadata !17} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [artificial] [from A]
// CHECK: !17 = metadata !{i32 {{.*}}, null, metadata !"A", metadata !6, i32 8, i64 128, i64 64, i32 0, i32 0, null, metadata !18, i32 0, metadata !17, null} ; [ DW_TAG_class_type ]
// CHECK: metadata !17, metadata !"A", metadata !"A", metadata !"", metadata !6, i32 12, metadata !43, i1 false, i1 false, i32 0, i32 0, null, i32 256, i1 false, null, null, i32 0, metadata !45, i32 12} ; [ DW_TAG_subprogram ]
// CHECK: metadata !"", i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !44, i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
// CHECK: !44 = metadata !{null, metadata !16, metadata !9, metadata !32}
// CHECK: ![[ARTARG:.*]] = metadata !{i32 786447, i32 0, metadata !"", i32 0, i32 0, i64 64, i64 64, i64 0, i32 1088, metadata ![[CLASSTYPE:.*]]} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [artificial] [from A]
// CHECK: ![[CLASSTYPE]] = metadata !{i32 {{.*}}, null, metadata !"A", metadata !{{.*}}, i32 8, i64 128, i64 64, i32 0, i32 0, null, metadata !{{.*}}, i32 0, metadata ![[CLASSTYPE]], null} ; [ DW_TAG_class_type ]
// CHECK: metadata ![[CLASSTYPE]], metadata !"A", metadata !"A", metadata !"", metadata !{{.*}}, i32 12, metadata !{{.*}}, i1 false, i1 false, i32 0, i32 0, null, i32 256, i1 false, null, null, i32 0, metadata !{{.*}}, i32 12} ; [ DW_TAG_subprogram ]
// CHECK: metadata !"", i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata ![[FUNCTYPE:.*]], i32 0, i32 0} ; [ DW_TAG_subroutine_type ]
// CHECK: ![[FUNCTYPE]] = metadata !{null, metadata ![[ARTARG]], metadata !{{.*}}, metadata !{{.*}}}

Просмотреть файл

@ -3,4 +3,4 @@
// 16 is DW_ATE_UTF (0x10) encoding attribute.
char16_t char_a = u'h';
// CHECK: !7 = metadata !{i32 {{.*}}, null, metadata !"char16_t", null, i32 0, i64 16, i64 16, i64 0, i32 0, i32 16} ; [ DW_TAG_base_type ]
// CHECK: !{{.*}} = metadata !{i32 {{.*}}, null, metadata !"char16_t", null, i32 0, i64 16, i64 16, i64 0, i32 0, i32 16} ; [ DW_TAG_base_type ]

Просмотреть файл

@ -20,5 +20,5 @@ protected:
Test t;
// CHECK: metadata !"", null, i32 0, i64 64, i64 64, i64 0, i32 0, metadata {{.*}} [ DW_TAG_pointer_type ]
// CHECK: metadata !"data", metadata !6, i32 14, i64 32, i64 32, i32 0, i32 0
// CHECK: metadata !"data", metadata !{{.*}}, i32 14, i64 32, i64 32, i32 0, i32 0
// CHECK-NOT: metadata !"data", metadata {{.*}}, i32 14, i64 0, i64 0, i32 0, i32 4,

Просмотреть файл

@ -9,10 +9,10 @@ B b;
C c;
D d;
// CHECK: metadata !{i32 {{.*}}, null, metadata !"A", metadata !4, i32 3, i64 32, i64 32, i32 0, i32 0, metadata !5, metadata !6, i32 0, i32 0} ; [ DW_TAG_enumeration_type ]
// CHECK: metadata !{i32 {{.*}}, null, metadata !"B", metadata !4, i32 4, i64 64, i64 64, i32 0, i32 0, metadata !9, metadata !10, i32 0, i32 0} ; [ DW_TAG_enumeration_type ]
// CHECK: metadata !{i32 {{.*}}, null, metadata !"C", metadata !4, i32 5, i64 32, i64 32, i32 0, i32 0, null, metadata !13, i32 0, i32 0} ; [ DW_TAG_enumeration_type ]
// CHECK: metadata !{i32 {{.*}}, null, metadata !"D", metadata !4, i32 6, i64 16, i64 16, i32 0, i32 4, null, null, i32 0} ; [ DW_TAG_enumeration_type ]
// CHECK: metadata !{i32 {{.*}}, null, metadata !"A", metadata ![[FILE:.*]], i32 3, i64 32, i64 32, i32 0, i32 0, metadata !{{.*}}, metadata !{{.*}}, i32 0, i32 0} ; [ DW_TAG_enumeration_type ]
// CHECK: metadata !{i32 {{.*}}, null, metadata !"B", metadata ![[FILE]], i32 4, i64 64, i64 64, i32 0, i32 0, metadata !{{.*}}, metadata !{{.*}}, i32 0, i32 0} ; [ DW_TAG_enumeration_type ]
// CHECK: metadata !{i32 {{.*}}, null, metadata !"C", metadata ![[FILE]], i32 5, i64 32, i64 32, i32 0, i32 0, null, metadata !{{.*}}, i32 0, i32 0} ; [ DW_TAG_enumeration_type ]
// CHECK: metadata !{i32 {{.*}}, null, metadata !"D", metadata ![[FILE]], i32 6, i64 16, i64 16, i32 0, i32 4, null, null, i32 0} ; [ DW_TAG_enumeration_type ]
namespace PR14029 {
// Make sure this doesn't crash/assert.

Просмотреть файл

@ -18,8 +18,8 @@ int main(int argc, char** argv) {
// Make sure we have two DW_TAG_structure_types for baz and bar and no forward
// references.
// CHECK: metadata !{i32 {{.*}}, null, metadata !"bar", metadata !6, i32 8, i64 128, i64 64, i32 0, i32 0, null, metadata !18, i32 0, null, null} ; [ DW_TAG_structure_type ]
// CHECK: metadata !{i32 {{.*}}, null, metadata !"baz", metadata !6, i32 3, i64 32, i64 32, i32 0, i32 0, null, metadata !21, i32 0, null, null} ; [ DW_TAG_structure_type ]
// CHECK-NOT: metadata !{i32 {{.*}}, null, metadata !"bar", metadata !6, i32 8, i64 0, i64 0, i32 0, i32 4, i32 0, null, i32 0, i32 0} ; [ DW_TAG_structure_type ]
// CHECK-NOT: metadata !{i32 {{.*}}, null, metadata !"baz", metadata !6, i32 3, i64 0, i64 0, i32 0, i32 4, null, null, i32 0, null, null} ; [ DW_TAG_structure_type ]
// CHECK: metadata !{i32 {{.*}}, null, metadata !"bar", metadata ![[FILE:.*]], i32 8, i64 128, i64 64, i32 0, i32 0, null, metadata !{{.*}}, i32 0, null, null} ; [ DW_TAG_structure_type ]
// CHECK: metadata !{i32 {{.*}}, null, metadata !"baz", metadata ![[FILE]], i32 3, i64 32, i64 32, i32 0, i32 0, null, metadata !{{.*}}, i32 0, null, null} ; [ DW_TAG_structure_type ]
// CHECK-NOT: metadata !{i32 {{.*}}, null, metadata !"bar", metadata ![[FILE]], i32 8, i64 0, i64 0, i32 0, i32 4, i32 0, null, i32 0, i32 0} ; [ DW_TAG_structure_type ]
// CHECK-NOT: metadata !{i32 {{.*}}, null, metadata !"baz", metadata ![[FILE]], i32 3, i64 0, i64 0, i32 0, i32 4, null, null, i32 0, null, null} ; [ DW_TAG_structure_type ]

Просмотреть файл

@ -8,4 +8,4 @@ void foo (int &&i)
printf("%d\n", i);
}
// CHECK: metadata !{i32 {{.*}}, null, null, null, i32 0, i64 0, i64 0, i64 0, i32 0, metadata !10} ; [ DW_TAG_rvalue_reference_type ]
// CHECK: metadata !{i32 {{.*}}, null, null, null, i32 0, i64 0, i64 0, i64 0, i32 0, metadata !{{.*}}} ; [ DW_TAG_rvalue_reference_type ]

Просмотреть файл

@ -7,4 +7,4 @@ namespace A {
}
// Verify that a is present and mangled.
// CHECK: metadata !{i32 {{.*}}, i32 0, metadata !6, metadata !"a", metadata !"a", metadata !"_ZN1AL1aEi", metadata !7, i32 4, metadata !8, i1 true, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 (i32)* @_ZN1AL1aEi, null, null, metadata !1, i32 4} ; [ DW_TAG_subprogram ]
// CHECK: metadata !{i32 {{.*}}, i32 0, metadata !{{.*}}, metadata !"a", metadata !"a", metadata !"_ZN1AL1aEi", metadata !{{.*}}, i32 4, metadata !{{.*}}, i1 true, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 (i32)* @_ZN1AL1aEi, null, null, metadata !{{.*}}, i32 4} ; [ DW_TAG_subprogram ]

Просмотреть файл

@ -18,9 +18,9 @@ void foo (const char *c) {
// CHECK: [[P:.*]] = metadata !{i32 {{.*}}, metadata [[CON:.*]]} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from ]
// CHECK: [[CON]] = metadata !{i32 {{.*}}, metadata [[CH:.*]]} ; [ DW_TAG_const_type ] [line 0, size 0, align 0, offset 0] [from char]
// CHECK: [[CH]] = metadata !{i32 {{.*}}, metadata !"char", {{.*}}} ; [ DW_TAG_base_type ] [char] [line 0, size 8, align 8, offset 0, enc DW_ATE_signed_char]
// CHECK: metadata !{i32 {{.*}}, metadata !"_ZN12basic_stringIcE6assignEPKcRKS0_", metadata !6, i32 7, metadata [[TYPE:.*]], i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, %struct.basic_string* (%struct.basic_string*, i8*, %struct.basic_string*)* @_ZN12basic_stringIcE6assignEPKcRKS0_, null, metadata !18, metadata !1, i32 8} ; [ DW_TAG_subprogram ] [line 7] [def] [scope 8] [assign]
// CHECK: metadata !{i32 {{.*}}, metadata !"_ZN12basic_stringIcE6assignEPKcRKS0_", metadata ![[FILE:.*]], i32 7, metadata [[TYPE:.*]], i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, %struct.basic_string* (%struct.basic_string*, i8*, %struct.basic_string*)* @_ZN12basic_stringIcE6assignEPKcRKS0_, null, metadata !{{.*}}, metadata !{{.*}}, i32 8} ; [ DW_TAG_subprogram ] [line 7] [def] [scope 8] [assign]
// CHECK: [[TYPE]] = metadata !{i32 {{.*}}, null, metadata [[ARGS:.*]], i32 0, i32 0}
// CHECK: [[ARGS]] = metadata !{metadata !15, metadata !24, metadata [[P]], metadata [[R:.*]]}
// CHECK: [[BS:.*]] = metadata !{i32 {{.*}}, null, metadata !"basic_string<char>", metadata !6, i32 4, i64 8, i64 8, i32 0, i32 0, null, metadata !17, i32 0, null, metadata !27} ; [ DW_TAG_structure_type ] [basic_string<char>] [line 4, size 8, align 8, offset 0] [from ]
// CHECK: [[ARGS]] = metadata !{metadata !{{.*}}, metadata !{{.*}}, metadata [[P]], metadata [[R:.*]]}
// CHECK: [[BS:.*]] = metadata !{i32 {{.*}}, null, metadata !"basic_string<char>", metadata ![[FILE]], i32 4, i64 8, i64 8, i32 0, i32 0, null, metadata !{{.*}}, i32 0, null, metadata !{{.*}}} ; [ DW_TAG_structure_type ] [basic_string<char>] [line 4, size 8, align 8, offset 0] [from ]
// CHECK: [[R]] = metadata !{i32 {{.*}}, null, null, null, i32 0, i64 0, i64 0, i64 0, i32 0, metadata [[CON2:.*]]} ; [ DW_TAG_reference_type ] [line 0, size 0, align 0, offset 0] [from ]
// CHECK: [[CON2]] = metadata !{i32 {{.*}}, metadata [[BS]]} ; [ DW_TAG_const_type ] [line 0, size 0, align 0, offset 0] [from basic_string<char>]

Просмотреть файл

@ -6,7 +6,7 @@ class A {
};
A a;
// CHECK: !9 = metadata !{i32 {{.*}}, metadata {{.*}}, metadata !"x", metadata {{.*}}, i32 5, i64 0, i64 0, i64 0, i32 1, metadata [[ARRAY_TYPE:.*]]} ; [ DW_TAG_member ]
// CHECK: !{{.*}} = metadata !{i32 {{.*}}, metadata {{.*}}, metadata !"x", metadata {{.*}}, i32 5, i64 0, i64 0, i64 0, i32 1, metadata [[ARRAY_TYPE:.*]]} ; [ DW_TAG_member ]
// CHECK: [[ARRAY_TYPE]] = metadata !{i32 {{.*}}, null, metadata !"", null, i32 0, i64 0, i64 32, i32 0, i32 0, metadata [[BASE_TYPE:.*]], metadata [[ELEM_TYPE:.*]], i32 0, i32 0} ; [ DW_TAG_array_type ]
// CHECK: [[BASE_TYPE]] = metadata !{i32 {{.*}}, null, metadata !"int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
// CHECK: [[ELEM_TYPE]] = metadata !{metadata [[SUBRANGE:.*]]}

Просмотреть файл

@ -12,4 +12,4 @@ int D::d(int x) {
}();
}
// CHECK: metadata !{i32 {{.*}}, metadata !"this", metadata !6, i32 11, i64 64, i64 64, i64 0, i32 1, metadata !37} ; [ DW_TAG_member ] [this] [line 11, size 64, align 64, offset 0] [private] [from ]
// CHECK: metadata !{i32 {{.*}}, metadata !"this", metadata !{{.*}}, i32 11, i64 64, i64 64, i64 0, i32 1, metadata !{{.*}}} ; [ DW_TAG_member ] [this] [line 11, size 64, align 64, offset 0] [private] [from ]

Просмотреть файл

@ -2,7 +2,7 @@
// RUN: %clang_cc1 -emit-llvm -fblocks -g -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 %s -o - | FileCheck %s
extern void foo(void(^)(void));
// CHECK: metadata !{i32 786478, i32 0, metadata !27, metadata !"__destroy_helper_block_", metadata !"__destroy_helper_block_", metadata !"", metadata !27, i32 24, metadata !37, i1 true, i1 true, i32 0, i32 0, null, i32 0, i1 false, void (i8*)* @__destroy_helper_block_, null, null, metadata !5, i32 24} ; [ DW_TAG_subprogram ]
// CHECK: metadata !{i32 786478, i32 0, metadata ![[FILE:.*]], metadata !"__destroy_helper_block_", metadata !"__destroy_helper_block_", metadata !"", metadata ![[FILE]], i32 24, metadata !{{.*}}, i1 true, i1 true, i32 0, i32 0, null, i32 0, i1 false, void (i8*)* @__destroy_helper_block_, null, null, metadata !{{.*}}, i32 24} ; [ DW_TAG_subprogram ]
@interface NSObject {
struct objc_object *isa;

Просмотреть файл

@ -1,6 +1,6 @@
// RUN: %clang_cc1 -S -emit-llvm -g %s -o - | FileCheck %s
// CHECK: metadata !"p1", metadata !6, i32 5, metadata !"", metadata !"", i32 2316, metadata !9} ; [ DW_TAG_APPLE_property ]
// CHECK: metadata !"p1", metadata !{{.*}}, i32 5, metadata !"", metadata !"", i32 2316, metadata !{{.*}}} ; [ DW_TAG_APPLE_property ]
@interface I1
@property int p1;
@end

Просмотреть файл

@ -1,7 +1,7 @@
// REQUIRES: x86-64-registered-target
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -g -emit-llvm %s -o - | FileCheck %s
// CHECK: !5 = metadata !{i32 {{.*}}, metadata !6, metadata !"H", metadata !6, i32 6, i64 0, i64 8, i32 0, i32 512, null, metadata !2, i32 16, i32 0, i32 0} ; [ DW_TAG_structure_type ]
// CHECK: !{{.*}} = metadata !{i32 {{.*}}, metadata ![[FILE:.*]], metadata !"H", metadata ![[FILE]], i32 6, i64 0, i64 8, i32 0, i32 512, null, metadata !{{.*}}, i32 16, i32 0, i32 0} ; [ DW_TAG_structure_type ]
@interface H
-(void) foo;

Просмотреть файл

@ -2,11 +2,6 @@
// self and _cmd are marked as DW_AT_artificial.
// myarg is not marked as DW_AT_artificial.
// CHECK: metadata !{i32 {{.*}}, metadata !9, metadata !"self", metadata !15, i32 16777232, metadata !30, i32 1088, i32 0} ; [ DW_TAG_arg_variable ] [self] [line 16]
// CHECK: metadata !{i32 {{.*}}, metadata !9, metadata !"_cmd", metadata !15, i32 33554448, metadata !33, i32 64, i32 0} ; [ DW_TAG_arg_variable ] [_cmd] [line 16]
// CHECK: metadata !{i32 {{.*}}, metadata !9, metadata !"myarg", metadata !6, i32 50331664, metadata !24, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [myarg] [line 16]
@interface MyClass {
}
- (id)init:(int) myarg;
@ -18,3 +13,11 @@
return self;
}
@end
// It's weird that the first two parameters are recorded as being in a
// different, ("<unknown>") file compared to the third parameter which is 'in'
// the actual source file. (see the metadata node after the arg name in each
// line)
// CHECK: metadata !{i32 {{.*}}, metadata ![[CTOR:.*]], metadata !"self", metadata ![[UNKFILE:.*]], i32 16777227, metadata !{{.*}}, i32 1088, i32 0} ; [ DW_TAG_arg_variable ] [self] [line 11]
// CHECK: metadata !{i32 {{.*}}, metadata ![[CTOR]], metadata !"_cmd", metadata ![[UNKFILE]], i32 33554443, metadata !{{.*}}, i32 64, i32 0} ; [ DW_TAG_arg_variable ] [_cmd] [line 11]
// CHECK: metadata !{i32 {{.*}}, metadata ![[CTOR]], metadata !"myarg", metadata !{{.*}}, i32 50331659, metadata !{{.*}}, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [myarg] [line 11]

Просмотреть файл

@ -30,5 +30,5 @@ int main(int argc, char *argv[]) {
}
}
// CHECK: !7 = metadata !{i32 {{.*}}, metadata !"./foo.h"
// CHECK: !29 = metadata !{i32 {{.*}}, i32 0, metadata !7, metadata !"-[Foo dict]", metadata !"-[Foo dict]", metadata !"", metadata !7, i32 8, metadata !30, i1 true, i1 true, i32 0, i32 0, null, i32 320, i1 false, %1* (%0*, i8*)* @"\01-[Foo dict]", null, null, metadata !1, i32 8} ; [ DW_TAG_subprogram ]
// CHECK: ![[FILE:.*]] = metadata !{i32 {{.*}}, metadata !"./foo.h"
// CHECK: !{{.*}} = metadata !{i32 {{.*}}, i32 0, metadata ![[FILE]], metadata !"-[Foo dict]", metadata !"-[Foo dict]", metadata !"", metadata ![[FILE]], i32 8, metadata !{{.*}}, i1 true, i1 true, i32 0, i32 0, null, i32 320, i1 false, %1* (%0*, i8*)* @"\01-[Foo dict]", null, null, metadata !{{.*}}, i32 8} ; [ DW_TAG_subprogram ]