• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: rm -rf %t
2// Test that only forward declarations are emitted for types defined in modules.
3
4// Modules:
5// RUN: %clang_cc1 -x objective-c -debug-info-kind=limited -dwarf-ext-refs -fmodules \
6// RUN:     -fmodule-format=obj -fimplicit-module-maps -DMODULES \
7// RUN:     -fmodules-cache-path=%t %s -I %S/Inputs -I %t -emit-llvm -o %t-mod.ll
8// RUN: cat %t-mod.ll |  FileCheck %s
9
10// PCH:
11// RUN: %clang_cc1 -x objective-c -fmodule-format=obj -emit-pch -I%S/Inputs \
12// RUN:     -o %t.pch %S/Inputs/DebugObjC.h
13// RUN: %clang_cc1 -x objective-c -debug-info-kind=limited -dwarf-ext-refs -fmodule-format=obj \
14// RUN:     -include-pch %t.pch %s -emit-llvm -o %t-pch.ll %s
15// RUN: cat %t-pch.ll |  FileCheck %s
16
17#ifdef MODULES
18@import DebugObjC;
19#endif
20
21@implementation ObjCClassWithPrivateIVars {
22  int hidden_ivar;
23}
24@end
25
26TypedefUnion tdu;
27TypedefEnum tde;
28TypedefStruct tds;
29
30int foo(ObjCClass *c) {
31  InnerEnum e = e0;
32  GlobalStruct.i = GlobalUnion.i = GlobalEnum;
33  [c instanceMethodWithInt: 0];
34  return [c property];
35}
36
37// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClassWithPrivateIVars",
38// CHECK-SAME:             flags: DIFlagObjcClassComplete
39
40// CHECK: ![[MOD:.*]] = !DIModule(scope: null, name: "DebugObjC
41
42// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "hidden_ivar",
43// CHECK-SAME:           flags: DIFlagPrivate)
44
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]+}})
49
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]+}})
54
55// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefUnion",
56// CHECK-SAME:           baseType: ![[TD_UNION:.*]])
57// CHECK: ![[TD_UNION]] = !DICompositeType(tag: DW_TAG_union_type,
58// CHECK-SAME:             flags: DIFlagFwdDecl)
59
60// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefEnum",
61// CHECK-SAME:           baseType: ![[TD_ENUM:.*]])
62// CHECK: ![[TD_ENUM]] = !DICompositeType(tag: DW_TAG_enumeration_type,
63// CHECK-SAME:             flags: DIFlagFwdDecl)
64
65// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefStruct",
66// CHECK-SAME:           baseType: ![[TD_STRUCT:.*]])
67// CHECK: ![[TD_STRUCT]] = !DICompositeType(tag: DW_TAG_structure_type,
68// CHECK-SAME:             flags: DIFlagFwdDecl)
69
70// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass",
71// CHECK-SAME:             scope: ![[MOD]],
72// CHECK-SAME:             flags: DIFlagFwdDecl)
73
74// CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type,
75// CHECK: !DICompositeType(tag: DW_TAG_enumeration_type,
76// CHECK-SAME:             scope: ![[MOD]],
77// CHECK-SAME:             flags: DIFlagFwdDecl)
78