185b9e8ca6e157fde1e4526c157979ac49835a5b8Eric Christopher// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s
2435e106f94a4e17bbbf6b1ad82185b305943ad3fEric Christopher
3435e106f94a4e17bbbf6b1ad82185b305943ad3fEric Christopherstruct baz {
4435e106f94a4e17bbbf6b1ad82185b305943ad3fEric Christopher    int h;
5435e106f94a4e17bbbf6b1ad82185b305943ad3fEric Christopher    baz(int a) : h(a) {}
6435e106f94a4e17bbbf6b1ad82185b305943ad3fEric Christopher};
7435e106f94a4e17bbbf6b1ad82185b305943ad3fEric Christopher
8435e106f94a4e17bbbf6b1ad82185b305943ad3fEric Christopherstruct bar {
9435e106f94a4e17bbbf6b1ad82185b305943ad3fEric Christopher    baz b;
10435e106f94a4e17bbbf6b1ad82185b305943ad3fEric Christopher    baz& b_ref;
11435e106f94a4e17bbbf6b1ad82185b305943ad3fEric Christopher    bar(int x) : b(x), b_ref(b) {}
12435e106f94a4e17bbbf6b1ad82185b305943ad3fEric Christopher};
13435e106f94a4e17bbbf6b1ad82185b305943ad3fEric Christopher
14435e106f94a4e17bbbf6b1ad82185b305943ad3fEric Christopherint main(int argc, char** argv) {
15435e106f94a4e17bbbf6b1ad82185b305943ad3fEric Christopher    bar myBar(1);
16435e106f94a4e17bbbf6b1ad82185b305943ad3fEric Christopher    return 0;
17435e106f94a4e17bbbf6b1ad82185b305943ad3fEric Christopher}
18435e106f94a4e17bbbf6b1ad82185b305943ad3fEric Christopher
19973bbb6a8abdc8af99c9a0b78cdbf6e7adb684ebEric Christopher// Make sure we have two DW_TAG_class_types for baz and bar and no forward
20435e106f94a4e17bbbf6b1ad82185b305943ad3fEric Christopher// references.
21435e106f94a4e17bbbf6b1ad82185b305943ad3fEric Christopher// FIXME: These should be struct types to match the declaration.
2287380aaf4273b2259fa75790f2f544c4514cc763Eric Christopher// 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_class_type ]
2387380aaf4273b2259fa75790f2f544c4514cc763Eric Christopher// 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_class_type ]
2487380aaf4273b2259fa75790f2f544c4514cc763Eric Christopher// 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_class_type ]
25c08c88c3cfc57b45ec1a9b4707b1f3df3108a639Devang Patel// 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_class_type ]
26973bbb6a8abdc8af99c9a0b78cdbf6e7adb684ebEric Christopher
27