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