[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Modules / ModuleDebugInfo.m
blob62c6fd68dd85462ce93e8d4fc3a1b9a6a0c608bf
1 // UNSUPPORTED: target={{.*}}-zos{{.*}}, target={{.*}}-aix{{.*}}
2 // Test that debug info is emitted for an Objective-C module and
3 // a precompiled header.
5 // REQUIRES: asserts
7 // Modules:
8 // RUN: rm -rf %t
9 // RUN: %clang_cc1 -x objective-c -fmodules -fmodule-format=obj \
10 // RUN:   -fimplicit-module-maps -DMODULES -fmodules-cache-path=%t %s \
11 // RUN:   -I %S/Inputs -I %t -emit-llvm -o %t.ll \
12 // RUN:   -mllvm -debug-only=pchcontainer &>%t-mod.ll
13 // RUN: cat %t-mod.ll | FileCheck %s
14 // RUN: cat %t-mod.ll | FileCheck %s --check-prefix=CHECK2
16 // PCH:
17 // RUN: %clang_cc1 -x objective-c -emit-pch -fmodule-format=obj -I %S/Inputs \
18 // RUN:   -o %t.pch %S/Inputs/DebugObjC.h \
19 // RUN:   -mllvm -debug-only=pchcontainer &>%t-pch.ll
20 // RUN: cat %t-pch.ll | FileCheck %s
21 // RUN: cat %t-pch.ll | FileCheck %s --check-prefix=CHECK2
23 #ifdef MODULES
24 @import DebugObjC;
25 #endif
27 // CHECK: distinct !DICompileUnit(language: DW_LANG_ObjC, file: ![[FILE:[0-9]+]],
28 // CHECK-SAME:                    isOptimized: false
30 // CHECK: ![[FILE]] = !DIFile(filename: "{{DebugObjC|.*DebugObjC.h}}"
32 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type,
33 // CHECK-SAME:             scope: ![[MODULE:[0-9]+]],
34 // CHECK: ![[MODULE]] = !DIModule(scope: null, name: "DebugObjC
36 // CHECK: ![[TD_ENUM:.*]] = !DICompositeType(tag: DW_TAG_enumeration_type,
37 // CHECK-NOT:              name:
38 // CHECK-SAME:             elements:
40 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "FwdDecl",
41 // CHECK-SAME:             scope: ![[MODULE]],
43 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass",
44 // CHECK-SAME:             scope: ![[MODULE]],
45 // CHECK-SAME:             elements
47 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClassWithPrivateIVars",
48 // CHECK-SAME:             scope: ![[MODULE]],
49 // CHECK-SAME:             elements
51 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "FwdDeclared"
52 // CHECK-SAME:             elements:
54 // CHECK: ![[TD_UNION:.*]] = distinct !DICompositeType(tag: DW_TAG_union_type,
55 // CHECK-NOT:              name:
56 // CHECK-SAME:             elements:
58 // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefUnion",
59 // CHECK-SAME:           baseType: ![[TD_UNION]])
61 // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefEnum",
62 // CHECK-SAME:           baseType: ![[TD_ENUM:.*]])
64 // CHECK: ![[TD_STRUCT:.*]] = distinct !DICompositeType(tag: DW_TAG_structure_type,
65 // CHECK-NOT:              name:
66 // CHECK-SAME:             elements:
67 // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefStruct",
68 // CHECK-SAME:           baseType: ![[TD_STRUCT]])
70 // CHECK: !DICompositeType(tag: DW_TAG_union_type,
71 // CHECK-NOT:              name:
72 // CHECK-SAME:             )
74 // CHECK: !DICompositeType(tag: DW_TAG_structure_type,
75 // CHECK-NOT:              name:
76 // CHECK-SAME:             )
78 // CHECK-NEG-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "PureForwardDecl"
80 // The output order is sublty different for module vs. pch,
81 // so these are checked separately:
83 // CHECK2: !DICompositeType(tag: DW_TAG_structure_type, name: "FwdDecl",
84 // CHECK2: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass",
85 // CHECK2: !DIObjCProperty(name: "property",
86 // CHECK2: !DIDerivedType(tag: DW_TAG_member, name: "ivar"
87 // CHECK2: !DIDerivedType(tag: DW_TAG_typedef, name: "InnerEnum"