1 // Test that (the same) debug info is emitted for an Objective-C++
2 // module and a C++ precompiled header.
3 
4 // REQUIRES: asserts, shell
5 
6 // Modules:
7 // RUN: rm -rf %t
8 // RUN: %clang_cc1 -triple %itanium_abi_triple -x objective-c++ -std=c++11 -debug-info-kind=limited -fmodules -fmodule-format=obj -fimplicit-module-maps -DMODULES -fmodules-cache-path=%t %s -I %S/Inputs -I %t -emit-llvm -o %t.ll -mllvm -debug-only=pchcontainer &>%t-mod.ll
9 // RUN: cat %t-mod.ll | FileCheck %s
10 // RUN: cat %t-mod.ll | FileCheck --check-prefix=CHECK-NEG %s
11 
12 // PCH:
13 // RUN: %clang_cc1 -triple %itanium_abi_triple -x c++ -std=c++11 -emit-pch -fmodule-format=obj -I %S/Inputs -o %t.pch %S/Inputs/DebugCXX.h -mllvm -debug-only=pchcontainer &>%t-pch.ll
14 // RUN: cat %t-pch.ll | FileCheck %s
15 // RUN: cat %t-pch.ll | FileCheck --check-prefix=CHECK-NEG %s
16 
17 #ifdef MODULES
18 @import DebugCXX;
19 #endif
20 
21 // CHECK: distinct !DICompileUnit(language: DW_LANG_{{.*}}C_plus_plus,
22 // CHECK-SAME:                    isOptimized: false,
23 // CHECK-NOT:                     splitDebugFilename:
24 // CHECK-SAME:                    dwoId:
25 
26 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "Enum"
27 // CHECK-SAME:             identifier: "_ZTSN8DebugCXX4EnumE")
28 // CHECK: !DINamespace(name: "DebugCXX"
29 
30 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type,
31 // CHECK-NOT:              name:
32 // CHECK-SAME:             )
33 
34 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type,
35 // CHECK-NOT:              name:
36 // CHECK-SAME:             )
37 
38 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type,
39 // CHECK-NOT:              name:
40 // CHECK-SAME:             identifier: "_ZTS11TypedefEnum")
41 
42 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type,
43 // CHECK-NOT:              name:
44 // CHECK-SAME:             )
45 // CHECK: !DIEnumerator(name: "e5", value: 5)
46 
47 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Struct"
48 // CHECK-SAME:             identifier: "_ZTSN8DebugCXX6StructE")
49 
50 // CHECK: !DICompositeType(tag: DW_TAG_class_type,
51 // CHECK-SAME:             name: "Template<int, DebugCXX::traits<int> >"
52 // CHECK-SAME:             identifier: "_ZTSN8DebugCXX8TemplateIiNS_6traitsIiEEEE")
53 
54 // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "A<void>"
55 // CHECK-SAME:             identifier: "_ZTSN8DebugCXX1AIJvEEE")
56 
57 // CHECK: !DICompositeType(tag: DW_TAG_class_type,
58 // CHECK-SAME:             name: "Template<float, DebugCXX::traits<float> >"
59 // CHECK-SAME:             identifier: "_ZTSN8DebugCXX8TemplateIfNS_6traitsIfEEEE")
60 
61 // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "FwdVirtual"
62 // CHECK-SAME:             elements:
63 // CHECK-SAME:             identifier: "_ZTS10FwdVirtual")
64 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "_vptr$FwdVirtual"
65 
66 // CHECK: !DICompositeType(tag: DW_TAG_union_type,
67 // CHECK-NOT:              name:
68 // CHECK-SAME:             identifier: "_ZTS12TypedefUnion")
69 
70 // CHECK: !DICompositeType(tag: DW_TAG_structure_type,
71 // CHECK-NOT:              name:
72 // CHECK-SAME:             identifier: "_ZTS13TypedefStruct")
73 
74 // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "Derived",
75 // CHECK-SAME:             identifier: "_ZTS7Derived")
76 // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "B", scope: !"_ZTS7Derived",
77 // CHECK-SAME:             elements: ![[B_MBRS:.*]], vtableHolder: !"_ZTS1A"
78 // CHECK: ![[B_MBRS]] = !{{{.*}}, ![[GET_PARENT:.*]]}
79 // CHECK: ![[GET_PARENT]] = !DISubprogram(name: "getParent"
80 
81 // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "FloatInstatiation"
82 // no mangled name here yet.
83 
84 // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "B",
85 // no mangled name here yet.
86 
87 // CHECK: !DICompositeType(tag: DW_TAG_union_type,
88 // CHECK-NOT:              name:
89 // CHECK-SAME:             )
90 
91 // CHECK: !DICompositeType(tag: DW_TAG_structure_type,
92 // CHECK-NOT:              name:
93 // CHECK-SAME:             )
94 
95 // CHECK: !DICompositeType(tag: DW_TAG_structure_type,
96 // CHECK-SAME:             name: "InAnonymousNamespace",
97 // CHECK-SAME:             elements: !{{[0-9]+}})
98 
99 // CHECK-NEG-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "PureForwardDecl"
100