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
21int foo(ObjCClass *c) {
22  InnerEnum e = e0;
23  [c instanceMethodWithInt: 0];
24  return [c property];
25}
26
27// CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type,
28// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass",
29// CHECK-SAME:             scope: ![[MOD:[0-9]+]],
30// CHECK-SAME:             flags: DIFlagFwdDecl)
31// CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type,
32// CHECK: ![[MOD]] = !DIModule(scope: null, name: {{.*}}DebugObjC
33// CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type,
34// CHECK: !DICompositeType(tag: DW_TAG_enumeration_type,
35// CHECK-SAME:             scope: ![[MOD]],
36// CHECK-SAME:             flags: DIFlagFwdDecl)
37