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: |
| 5 | // RUN: %clang_cc1 -x objective-c++ -std=c++11 -g -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 c++ -std=c++11 -fmodule-format=obj -emit-pch -I%S/Inputs \ |
| 12 | // RUN: -o %t.pch %S/Inputs/DebugCXX.h |
| 13 | // RUN: %clang_cc1 -std=c++11 -g -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 DebugCXX; |
| 19 | #endif |
| 20 | |
| 21 | using DebugCXX::Struct; |
| 22 | |
| 23 | Struct s; |
| 24 | DebugCXX::Enum e; |
| 25 | DebugCXX::Template<long> implicitTemplate; |
| 26 | DebugCXX::Template<int> explicitTemplate; |
| 27 | DebugCXX::FloatInstatiation typedefTemplate; |
| 28 | int Struct::static_member = -1; |
| 29 | enum { |
| 30 | e3 = -1 |
| 31 | } conflicting_uid = e3; |
| 32 | auto anon_enum = DebugCXX::e2; |
| 33 | char _anchor = anon_enum + conflicting_uid; |
| 34 | |
| 35 | // CHECK: ![[NS:.*]] = !DINamespace(name: "DebugCXX", scope: ![[MOD:[0-9]+]], |
| 36 | // CHECK: ![[MOD]] = !DIModule(scope: null, name: {{.*}}DebugCXX |
| 37 | |
| 38 | // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Struct", |
| 39 | // CHECK-SAME: scope: ![[NS]], |
| 40 | // CHECK-SAME: flags: DIFlagFwdDecl, |
| 41 | // CHECK-SAME: identifier: "_ZTSN8DebugCXX6StructE") |
| 42 | |
| 43 | // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "Enum", |
| 44 | // CHECK-SAME: scope: ![[NS]], |
| 45 | // CHECK-SAME: flags: DIFlagFwdDecl, |
| 46 | // CHECK-SAME: identifier: "_ZTSN8DebugCXX4EnumE") |
| 47 | |
| 48 | // CHECK: !DICompositeType(tag: DW_TAG_class_type, |
| 49 | |
| 50 | // CHECK: !DICompositeType(tag: DW_TAG_class_type, |
| 51 | // CHECK-SAME: name: "Template<int, DebugCXX::traits<int> >", |
| 52 | // CHECK-SAME: scope: ![[NS]], |
| 53 | // CHECK-SAME: flags: DIFlagFwdDecl, |
| 54 | // CHECK-SAME: identifier: "_ZTSN8DebugCXX8TemplateIiNS_6traitsIiEEEE") |
| 55 | |
| 56 | // CHECK: !DICompositeType(tag: DW_TAG_class_type, |
| 57 | // CHECK-SAME: name: "Template<float, DebugCXX::traits<float> >", |
| 58 | // CHECK-SAME: scope: ![[NS]], |
| 59 | // CHECK-SAME: flags: DIFlagFwdDecl, |
| 60 | // CHECK-SAME: identifier: "_ZTSN8DebugCXX8TemplateIfNS_6traitsIfEEEE") |
| 61 | |
| 62 | // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "static_member", |
| 63 | // CHECK-SAME: scope: !"_ZTSN8DebugCXX6StructE" |
| 64 | |
| 65 | // CHECK: !DIGlobalVariable(name: "anon_enum", {{.*}}, type: ![[ANON_ENUM:[0-9]+]] |
| 66 | // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, scope: ![[NS]], |
| 67 | // CHECK-SAME: line: 16 |
| 68 | |
| 69 | // CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !0, entity: !"_ZTSN8DebugCXX6StructE", line: 21) |