• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Test that debug info is emitted for an Objective-C module and
2// a precompiled header.
3
4// REQUIRES: asserts, shell
5
6// Modules:
7// RUN: rm -rf %t
8// RUN: %clang_cc1 -x objective-c -fmodules -fmodule-format=obj \
9// RUN:   -fimplicit-module-maps -DMODULES -fmodules-cache-path=%t %s \
10// RUN:   -I %S/Inputs -I %t -emit-llvm -o %t.ll \
11// RUN:   -mllvm -debug-only=pchcontainer &>%t-mod.ll
12// RUN: cat %t-mod.ll | FileCheck %s
13// RUN: cat %t-mod.ll | FileCheck %s --check-prefix=CHECK2
14
15// PCH:
16// RUN: %clang_cc1 -x objective-c -emit-pch -fmodule-format=obj -I %S/Inputs \
17// RUN:   -o %t.pch %S/Inputs/DebugObjC.h \
18// RUN:   -mllvm -debug-only=pchcontainer &>%t-pch.ll
19// RUN: cat %t-pch.ll | FileCheck %s
20// RUN: cat %t-pch.ll | FileCheck %s --check-prefix=CHECK2
21
22#ifdef MODULES
23@import DebugObjC;
24#endif
25
26// CHECK: distinct !DICompileUnit(language: DW_LANG_ObjC
27// CHECK-SAME:                    isOptimized: false,
28
29// CHECK: !DICompositeType(tag: DW_TAG_enumeration_type,
30// CHECK-SAME:             scope: ![[MODULE:[0-9]+]],
31// CHECK: ![[MODULE]] = !DIModule(scope: null, name: "DebugObjC
32
33// CHECK: ![[TD_ENUM:.*]] = !DICompositeType(tag: DW_TAG_enumeration_type,
34// CHECK-NOT:              name:
35// CHECK-SAME:             elements:
36
37// CHECK: !DISubprogram(name: "+[ObjCClass classMethod]",
38// CHECK-SAME:          scope: ![[MODULE]],
39
40// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass",
41// CHECK-SAME:             scope: ![[MODULE]],
42// CHECK-SAME:             elements
43
44// The forward declaration should not be in the module scope.
45// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "OpaqueData", file
46
47// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "FwdDecl",
48// CHECK-SAME:             scope: ![[MODULE]],
49
50// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClassWithPrivateIVars",
51// CHECK-SAME:             scope: ![[MODULE]],
52// CHECK-SAME:             elements
53
54// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "FwdDeclared"
55// CHECK-SAME:             elements:
56
57// CHECK: ![[TD_UNION:.*]] = distinct !DICompositeType(tag: DW_TAG_union_type,
58// CHECK-NOT:              name:
59// CHECK-SAME:             elements:
60
61// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefUnion",
62// CHECK-SAME:           baseType: ![[TD_UNION]])
63
64// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefEnum",
65// CHECK-SAME:           baseType: ![[TD_ENUM:.*]])
66
67// CHECK: ![[TD_STRUCT:.*]] = distinct !DICompositeType(tag: DW_TAG_structure_type,
68// CHECK-NOT:              name:
69// CHECK-SAME:             elements:
70// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefStruct",
71// CHECK-SAME:           baseType: ![[TD_STRUCT]])
72
73// CHECK: !DICompositeType(tag: DW_TAG_union_type,
74// CHECK-NOT:              name:
75// CHECK-SAME:             )
76
77// CHECK: !DICompositeType(tag: DW_TAG_structure_type,
78// CHECK-NOT:              name:
79// CHECK-SAME:             )
80
81// CHECK-NEG-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "PureForwardDecl"
82
83// The output order is sublty different for module vs. pch,
84// so these are checked separately:
85//
86// CHECK2: !DISubprogram(name: "+[ObjCClass classMethod]"
87// CHECK2: !DISubprogram(name: "-[ObjCClass instanceMethodWithInt:]"
88// CHECK2: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass",
89// CHECK2: !DIObjCProperty(name: "property",
90// CHECK2: !DIDerivedType(tag: DW_TAG_member, name: "ivar"
91// CHECK2: !DISubprogram(name: "-[Category(Category) categoryMethod]"
92// CHECK2: !DICompositeType(tag: DW_TAG_structure_type, name: "FwdDecl",
93// CHECK2: !DIDerivedType(tag: DW_TAG_typedef, name: "InnerEnum"
94