[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Modules / ExtDebugInfo.m
blobb6a8b2676e5ba4d468da156736c6eacd796384f1
1 // UNSUPPORTED: target={{.*}}-zos{{.*}}, target={{.*}}-aix{{.*}}
2 // RUN: rm -rf %t
3 // Test that only forward declarations are emitted for types defined in modules.
5 // Modules:
6 // RUN: %clang_cc1 -x objective-c -debug-info-kind=limited -dwarf-ext-refs -fmodules \
7 // RUN:     -fmodule-format=obj -fimplicit-module-maps -DMODULES \
8 // RUN:     -fmodules-cache-path=%t %s -I %S/Inputs -I %t -emit-llvm -o %t-mod.ll
9 // RUN: cat %t-mod.ll |  FileCheck %s
10 // RUN: cat %t-mod.ll |  FileCheck %s --check-prefix=DWOID
12 // PCH:
13 // RUN: %clang_cc1 -x objective-c -fmodule-format=obj -emit-pch -I%S/Inputs \
14 // RUN:     -o %t.pch %S/Inputs/DebugObjC.h
15 // RUN: %clang_cc1 -x objective-c -debug-info-kind=limited -dwarf-ext-refs \
16 // RUN:     -fmodule-format=obj \
17 // RUN:     -include-pch %t.pch %s -emit-llvm -o %t-pch.ll %s
18 // RUN: cat %t-pch.ll |  FileCheck %s
19 // RUN: cat %t-pch.ll |  FileCheck %s --check-prefix=DWOID
21 #ifdef MODULES
22 @import DebugObjC;
23 #endif
25 @implementation ObjCClassWithPrivateIVars {
26   int hidden_ivar;
28 @end
30 TypedefUnion tdu;
31 TypedefEnum tde;
32 TypedefStruct tds;
34 int foo(ObjCClass *c) {
35   InnerEnum e = e0;
36   GlobalStruct.i = GlobalUnion.i = GlobalEnum;
37   [c instanceMethodWithInt: 0];
38   return [c property];
41 // DWOID: !DICompileUnit(language: DW_LANG_ObjC,{{.*}}isOptimized: false,{{.*}}dwoId:
43 // CHECK: ![[MOD:.*]] = !DIModule(scope: null, name: "DebugObjC
45 // CHECK: !DIGlobalVariable(name: "GlobalUnion",
46 // CHECK-SAME:              type: ![[GLOBAL_UNION:[0-9]+]]
47 // CHECK: ![[GLOBAL_UNION]] = distinct !DICompositeType(tag: DW_TAG_union_type,
48 // CHECK-SAME:                elements: !{{[0-9]+}})
50 // CHECK: !DIGlobalVariable(name: "GlobalStruct",
51 // CHECK-SAME:              type: ![[GLOBAL_STRUCT:[0-9]+]]
52 // CHECK: ![[GLOBAL_STRUCT]] = distinct !DICompositeType(tag: DW_TAG_structure_type,
53 // CHECK-SAME:                elements: !{{[0-9]+}})
55 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClassWithPrivateIVars",
56 // CHECK-SAME:             flags: DIFlagObjcClassComplete
58 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "hidden_ivar",
59 // CHECK-SAME:           flags: DIFlagPrivate)
61 // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefEnum",
62 // CHECK-SAME:           baseType: ![[TD_ENUM:.*]])
63 // CHECK: ![[TD_ENUM]] = !DICompositeType(tag: DW_TAG_enumeration_type,
64 // CHECK-SAME:             flags: DIFlagFwdDecl)
66 // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefStruct",
67 // CHECK-SAME:           baseType: ![[TD_STRUCT:.*]])
68 // CHECK: ![[TD_STRUCT]] = !DICompositeType(tag: DW_TAG_structure_type,
69 // CHECK-SAME:             flags: DIFlagFwdDecl)
71 // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefUnion",
72 // CHECK-SAME:           baseType: ![[TD_UNION:.*]])
73 // CHECK: ![[TD_UNION]] = !DICompositeType(tag: DW_TAG_union_type,
74 // CHECK-SAME:             flags: DIFlagFwdDecl)
76 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass",
77 // CHECK-SAME:             scope: ![[MOD]],
78 // CHECK-SAME:             flags: DIFlagFwdDecl)
80 // CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type,
81 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type,
82 // CHECK-SAME:             scope: ![[MOD]],
83 // CHECK-SAME:             flags: DIFlagFwdDecl)