2015-09-09 04:41:52 +08:00
|
|
|
// Test that debug info is emitted for an Objective-C module and
|
|
|
|
// a precompiled header.
|
|
|
|
|
|
|
|
// REQUIRES: asserts, shell
|
|
|
|
|
|
|
|
// Modules:
|
|
|
|
// RUN: rm -rf %t
|
2015-10-03 01:36:10 +08:00
|
|
|
// RUN: %clang_cc1 -x objective-c -fmodules -fmodule-format=obj \
|
|
|
|
// RUN: -fimplicit-module-maps -DMODULES -fmodules-cache-path=%t %s \
|
|
|
|
// RUN: -I %S/Inputs -I %t -emit-llvm -o %t.ll \
|
|
|
|
// RUN: -mllvm -debug-only=pchcontainer &>%t-mod.ll
|
2015-09-09 04:41:52 +08:00
|
|
|
// RUN: cat %t-mod.ll | FileCheck %s
|
2016-01-23 05:14:41 +08:00
|
|
|
// RUN: cat %t-mod.ll | FileCheck %s --check-prefix=CHECK2
|
2015-09-09 04:41:52 +08:00
|
|
|
|
|
|
|
// PCH:
|
2015-10-03 01:36:10 +08:00
|
|
|
// RUN: %clang_cc1 -x objective-c -emit-pch -fmodule-format=obj -I %S/Inputs \
|
|
|
|
// RUN: -o %t.pch %S/Inputs/DebugObjC.h \
|
|
|
|
// RUN: -mllvm -debug-only=pchcontainer &>%t-pch.ll
|
2015-09-09 04:41:52 +08:00
|
|
|
// RUN: cat %t-pch.ll | FileCheck %s
|
2016-01-23 05:14:41 +08:00
|
|
|
// RUN: cat %t-pch.ll | FileCheck %s --check-prefix=CHECK2
|
2015-09-09 04:41:52 +08:00
|
|
|
|
|
|
|
#ifdef MODULES
|
|
|
|
@import DebugObjC;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// CHECK: distinct !DICompileUnit(language: DW_LANG_ObjC
|
|
|
|
// CHECK-SAME: isOptimized: false,
|
2016-01-23 05:14:41 +08:00
|
|
|
|
|
|
|
// CHECK: !DICompositeType(tag: DW_TAG_enumeration_type,
|
|
|
|
// CHECK-SAME: scope: ![[MODULE:[0-9]+]],
|
2016-01-23 07:30:56 +08:00
|
|
|
// CHECK: ![[MODULE]] = !DIModule(scope: null, name: "DebugObjC
|
2016-01-23 05:14:41 +08:00
|
|
|
|
|
|
|
// CHECK: ![[TD_ENUM:.*]] = !DICompositeType(tag: DW_TAG_enumeration_type,
|
2016-02-10 08:38:15 +08:00
|
|
|
// CHECK-NOT: name:
|
2016-01-23 05:14:41 +08:00
|
|
|
// CHECK-SAME: elements:
|
|
|
|
|
2016-04-15 23:55:45 +08:00
|
|
|
// CHECK: !DISubprogram(name: "+[ObjCClass classMethod]",
|
|
|
|
// CHECK-SAME: scope: ![[MODULE]],
|
|
|
|
|
|
|
|
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass",
|
2016-01-23 05:14:41 +08:00
|
|
|
// CHECK-SAME: scope: ![[MODULE]],
|
2016-04-21 07:59:32 +08:00
|
|
|
// CHECK-SAME: elements
|
2016-04-15 23:55:45 +08:00
|
|
|
|
|
|
|
// The forward declaration should not be in the module scope.
|
|
|
|
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "OpaqueData", file
|
|
|
|
|
|
|
|
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "FwdDecl",
|
2016-01-23 05:14:41 +08:00
|
|
|
// CHECK-SAME: scope: ![[MODULE]],
|
2016-01-20 07:42:56 +08:00
|
|
|
|
2016-04-21 07:59:32 +08:00
|
|
|
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClassWithPrivateIVars",
|
|
|
|
// CHECK-SAME: scope: ![[MODULE]],
|
|
|
|
// CHECK-SAME: elements
|
|
|
|
|
2016-01-23 05:14:41 +08:00
|
|
|
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "FwdDeclared"
|
|
|
|
// CHECK-SAME: elements:
|
2016-01-20 07:42:56 +08:00
|
|
|
|
2016-04-17 15:45:08 +08:00
|
|
|
// CHECK: ![[TD_UNION:.*]] = distinct !DICompositeType(tag: DW_TAG_union_type,
|
2016-02-10 08:38:15 +08:00
|
|
|
// CHECK-NOT: name:
|
2016-01-23 05:14:41 +08:00
|
|
|
// CHECK-SAME: elements:
|
2016-01-20 07:42:56 +08:00
|
|
|
|
2016-01-23 05:14:41 +08:00
|
|
|
// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefUnion",
|
|
|
|
// CHECK-SAME: baseType: ![[TD_UNION]])
|
2016-01-20 07:42:56 +08:00
|
|
|
|
2016-01-23 05:14:41 +08:00
|
|
|
// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefEnum",
|
|
|
|
// CHECK-SAME: baseType: ![[TD_ENUM:.*]])
|
2016-01-20 07:42:56 +08:00
|
|
|
|
2016-04-17 15:45:08 +08:00
|
|
|
// CHECK: ![[TD_STRUCT:.*]] = distinct !DICompositeType(tag: DW_TAG_structure_type,
|
2016-02-10 08:38:15 +08:00
|
|
|
// CHECK-NOT: name:
|
2016-01-23 05:14:41 +08:00
|
|
|
// CHECK-SAME: elements:
|
|
|
|
// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefStruct",
|
|
|
|
// CHECK-SAME: baseType: ![[TD_STRUCT]])
|
2016-01-20 07:42:56 +08:00
|
|
|
|
2016-01-23 05:14:41 +08:00
|
|
|
// CHECK: !DICompositeType(tag: DW_TAG_union_type,
|
2016-02-10 08:38:15 +08:00
|
|
|
// CHECK-NOT: name:
|
|
|
|
// CHECK-SAME: )
|
2016-01-20 07:42:56 +08:00
|
|
|
|
2016-01-23 05:14:41 +08:00
|
|
|
// CHECK: !DICompositeType(tag: DW_TAG_structure_type,
|
2016-02-10 08:38:15 +08:00
|
|
|
// CHECK-NOT: name:
|
|
|
|
// CHECK-SAME: )
|
2016-01-20 07:42:56 +08:00
|
|
|
|
2016-01-23 05:14:41 +08:00
|
|
|
// CHECK-NEG-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "PureForwardDecl"
|
|
|
|
|
|
|
|
// The output order is sublty different for module vs. pch,
|
|
|
|
// so these are checked separately:
|
|
|
|
//
|
|
|
|
// CHECK2: !DISubprogram(name: "+[ObjCClass classMethod]"
|
|
|
|
// CHECK2: !DISubprogram(name: "-[ObjCClass instanceMethodWithInt:]"
|
2016-04-15 23:55:45 +08:00
|
|
|
// CHECK2: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass",
|
|
|
|
// CHECK2: !DIObjCProperty(name: "property",
|
|
|
|
// CHECK2: !DIDerivedType(tag: DW_TAG_member, name: "ivar"
|
2016-01-23 05:14:41 +08:00
|
|
|
// CHECK2: !DISubprogram(name: "-[Category(Category) categoryMethod]"
|
2016-04-15 23:55:45 +08:00
|
|
|
// CHECK2: !DICompositeType(tag: DW_TAG_structure_type, name: "FwdDecl",
|
|
|
|
// CHECK2: !DIDerivedType(tag: DW_TAG_typedef, name: "InnerEnum"
|