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 -fimplicit-module-maps -DMODULES -fmodules-cache-path=%t %s -I %S/Inputs -I %t -emit-llvm -o %t.ll -mllvm -debug-only=pchcontainer &>%t-mod.ll
9// RUN: cat %t-mod.ll | FileCheck %s
10// RUN: cat %t-mod.ll | FileCheck %s --check-prefix=MODULE-CHECK
11
12// PCH:
13// RUN: %clang_cc1 -x objective-c -emit-pch -fmodule-format=obj -I %S/Inputs -o %t.pch %S/Inputs/DebugObjC.h -mllvm -debug-only=pchcontainer &>%t-pch.ll
14// RUN: cat %t-pch.ll | FileCheck %s
15
16#ifdef MODULES
17@import DebugObjC;
18#endif
19
20// CHECK: distinct !DICompileUnit(language: DW_LANG_ObjC
21// CHECK-SAME:                    isOptimized: false,
22// CHECK: !DICompositeType(tag: DW_TAG_structure_type,
23// CHECK-SAME:             name: "ObjCClass",
24// CHECK: !DIObjCProperty(name: "property",
25// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "ivar"
26// CHECK: !DISubprogram(name: "+[ObjCClass classMethod]"
27// CHECK: !DISubprogram(name: "-[ObjCClass instanceMethodWithInt:]"
28// CHECK: !DISubprogram(name: "-[ categoryMethod]"
29
30// MODULE-CHECK: !DICompositeType(tag: DW_TAG_structure_type,
31// MODULE-CHECK-SAME:             name: "ObjCClass",
32// MODULE-CHECK-SAME:             scope: ![[MODULE:[0-9]+]],
33// MODULE-CHECK: ![[MODULE]] = !DIModule(scope: null, name: "DebugObjC"
34