Adrian Prantl | 5c8bd88 | 2015-09-11 17:23:08 +0000 | [diff] [blame] | 1 | // RUN: rm -rf %t |
| 2 | // Test that only forward declarations are emitted for types dfined in modules. |
| 3 | |
| 4 | // Modules: |
Douglas Katzman | 3459ce2 | 2015-10-08 04:24:12 +0000 | [diff] [blame] | 5 | // RUN: %clang_cc1 -x objective-c++ -std=c++11 -debug-info-kind=limited -dwarf-ext-refs -fmodules \ |
Adrian Prantl | 5c8bd88 | 2015-09-11 17:23:08 +0000 | [diff] [blame] | 6 | // RUN: -fmodule-format=obj -fimplicit-module-maps -DMODULES \ |
Reid Kleckner | 854a2b7 | 2015-09-11 17:50:14 +0000 | [diff] [blame] | 7 | // RUN: -triple %itanium_abi_triple \ |
Adrian Prantl | 5c8bd88 | 2015-09-11 17:23:08 +0000 | [diff] [blame] | 8 | // RUN: -fmodules-cache-path=%t %s -I %S/Inputs -I %t -emit-llvm -o %t-mod.ll |
| 9 | // RUN: cat %t-mod.ll | FileCheck %s |
| 10 | |
| 11 | // PCH: |
| 12 | // RUN: %clang_cc1 -x c++ -std=c++11 -fmodule-format=obj -emit-pch -I%S/Inputs \ |
Reid Kleckner | 854a2b7 | 2015-09-11 17:50:14 +0000 | [diff] [blame] | 13 | // RUN: -triple %itanium_abi_triple \ |
Adrian Prantl | 5c8bd88 | 2015-09-11 17:23:08 +0000 | [diff] [blame] | 14 | // RUN: -o %t.pch %S/Inputs/DebugCXX.h |
Douglas Katzman | 3459ce2 | 2015-10-08 04:24:12 +0000 | [diff] [blame] | 15 | // RUN: %clang_cc1 -std=c++11 -debug-info-kind=limited -dwarf-ext-refs -fmodule-format=obj \ |
Reid Kleckner | 854a2b7 | 2015-09-11 17:50:14 +0000 | [diff] [blame] | 16 | // RUN: -triple %itanium_abi_triple \ |
Adrian Prantl | 5c8bd88 | 2015-09-11 17:23:08 +0000 | [diff] [blame] | 17 | // RUN: -include-pch %t.pch %s -emit-llvm -o %t-pch.ll %s |
| 18 | // RUN: cat %t-pch.ll | FileCheck %s |
| 19 | |
| 20 | #ifdef MODULES |
| 21 | @import DebugCXX; |
| 22 | #endif |
| 23 | |
| 24 | using DebugCXX::Struct; |
| 25 | |
| 26 | Struct s; |
| 27 | DebugCXX::Enum e; |
| 28 | DebugCXX::Template<long> implicitTemplate; |
| 29 | DebugCXX::Template<int> explicitTemplate; |
| 30 | DebugCXX::FloatInstatiation typedefTemplate; |
| 31 | int Struct::static_member = -1; |
| 32 | enum { |
| 33 | e3 = -1 |
| 34 | } conflicting_uid = e3; |
| 35 | auto anon_enum = DebugCXX::e2; |
| 36 | char _anchor = anon_enum + conflicting_uid; |
| 37 | |
Adrian Prantl | e5238d2 | 2016-01-19 18:02:47 +0000 | [diff] [blame] | 38 | TypedefUnion tdu; |
| 39 | TypedefEnum tde; |
| 40 | TypedefStruct tds; |
| 41 | |
Adrian Prantl | cd97501 | 2016-01-19 23:42:44 +0000 | [diff] [blame] | 42 | void foo() { |
| 43 | GlobalStruct.i = GlobalUnion.i = GlobalEnum; |
| 44 | } |
| 45 | |
Adrian Prantl | 5c8bd88 | 2015-09-11 17:23:08 +0000 | [diff] [blame] | 46 | // CHECK: ![[NS:.*]] = !DINamespace(name: "DebugCXX", scope: ![[MOD:[0-9]+]], |
| 47 | // CHECK: ![[MOD]] = !DIModule(scope: null, name: {{.*}}DebugCXX |
| 48 | |
| 49 | // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Struct", |
| 50 | // CHECK-SAME: scope: ![[NS]], |
| 51 | // CHECK-SAME: flags: DIFlagFwdDecl, |
| 52 | // CHECK-SAME: identifier: "_ZTSN8DebugCXX6StructE") |
| 53 | |
| 54 | // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "Enum", |
| 55 | // CHECK-SAME: scope: ![[NS]], |
| 56 | // CHECK-SAME: flags: DIFlagFwdDecl, |
| 57 | // CHECK-SAME: identifier: "_ZTSN8DebugCXX4EnumE") |
| 58 | |
| 59 | // CHECK: !DICompositeType(tag: DW_TAG_class_type, |
| 60 | |
| 61 | // CHECK: !DICompositeType(tag: DW_TAG_class_type, |
| 62 | // CHECK-SAME: name: "Template<int, DebugCXX::traits<int> >", |
| 63 | // CHECK-SAME: scope: ![[NS]], |
| 64 | // CHECK-SAME: flags: DIFlagFwdDecl, |
| 65 | // CHECK-SAME: identifier: "_ZTSN8DebugCXX8TemplateIiNS_6traitsIiEEEE") |
| 66 | |
| 67 | // CHECK: !DICompositeType(tag: DW_TAG_class_type, |
| 68 | // CHECK-SAME: name: "Template<float, DebugCXX::traits<float> >", |
| 69 | // CHECK-SAME: scope: ![[NS]], |
| 70 | // CHECK-SAME: flags: DIFlagFwdDecl, |
| 71 | // CHECK-SAME: identifier: "_ZTSN8DebugCXX8TemplateIfNS_6traitsIfEEEE") |
| 72 | |
Adrian Prantl | e5238d2 | 2016-01-19 18:02:47 +0000 | [diff] [blame] | 73 | // CHECK: !DICompositeType(tag: DW_TAG_union_type, |
| 74 | // CHECK-SAME: flags: DIFlagFwdDecl, identifier: "_ZTS12TypedefUnion") |
| 75 | // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, |
| 76 | // CHECK-SAME: flags: DIFlagFwdDecl, identifier: "_ZTS11TypedefEnum") |
| 77 | // CHECK: !DICompositeType(tag: DW_TAG_structure_type, |
| 78 | // CHECK-SAME: flags: DIFlagFwdDecl, identifier: "_ZTS13TypedefStruct") |
| 79 | |
Adrian Prantl | 5c8bd88 | 2015-09-11 17:23:08 +0000 | [diff] [blame] | 80 | // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "static_member", |
| 81 | // CHECK-SAME: scope: !"_ZTSN8DebugCXX6StructE" |
| 82 | |
| 83 | // CHECK: !DIGlobalVariable(name: "anon_enum", {{.*}}, type: ![[ANON_ENUM:[0-9]+]] |
| 84 | // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, scope: ![[NS]], |
| 85 | // CHECK-SAME: line: 16 |
| 86 | |
Adrian Prantl | 43e0081 | 2016-01-19 23:42:53 +0000 | [diff] [blame] | 87 | // CHECK: !DIGlobalVariable(name: "GlobalUnion", |
| 88 | // CHECK-SAME: type: ![[GLOBAL_UNION:[0-9]+]] |
| 89 | // CHECK: ![[GLOBAL_UNION]] = !DICompositeType(tag: DW_TAG_union_type, |
| 90 | // CHECK-SAME: elements: !{{[0-9]+}}) |
| 91 | // CHECK: !DIGlobalVariable(name: "GlobalStruct", |
| 92 | // CHECK-SAME: type: ![[GLOBAL_STRUCT:[0-9]+]] |
| 93 | // CHECK: ![[GLOBAL_STRUCT]] = !DICompositeType(tag: DW_TAG_structure_type, |
| 94 | // CHECK-SAME: elements: !{{[0-9]+}}) |
| 95 | |
Reid Kleckner | 854a2b7 | 2015-09-11 17:50:14 +0000 | [diff] [blame] | 96 | // CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !0, entity: !"_ZTSN8DebugCXX6StructE", line: 24) |