| 1 |
// RUN: dsymutil -f -oso-prepend-path=%p/../Inputs/modules-pruning \ |
| 2 |
// RUN: -verify \ |
| 3 |
// RUN: -y %p/dummy-debug-map.map -o - \ |
| 4 |
// RUN: | llvm-dwarfdump --name isRef -p - | FileCheck %s |
| 5 |
|
| 6 |
/* Compile with: |
| 7 |
cat >modules.modulemap <<EOF |
| 8 |
module Outer { |
| 9 |
module Template { |
| 10 |
header "template.h" |
| 11 |
export * |
| 12 |
} |
| 13 |
} |
| 14 |
EOF |
| 15 |
clang++ -D TEMPLATE_H -E -o template.h modules-pruning.cpp |
| 16 |
clang++ -c -fcxx-modules -fmodules -fmodule-map-file=modules.modulemap \ |
| 17 |
-g -gmodules -fmodules-cache-path=. \ |
| 18 |
-Xclang -fdisable-module-hash modules-pruning.cpp -o 1.o |
| 19 |
*/ |
| 20 |
|
| 21 |
// CHECK: DW_TAG_compile_unit |
| 22 |
// CHECK: DW_TAG_module |
| 23 |
// CHECK: DW_TAG_module |
| 24 |
// CHECK: DW_TAG_class |
| 25 |
// CHECK: DW_TAG_member |
| 26 |
// CHECK: DW_AT_name ("isRef") |
| 27 |
// CHECK: DW_AT_declaration (true) |
| 28 |
// CHECK: DW_AT_const_value (1) |
| 29 |
// CHECK-NOT: DW_TAG |
| 30 |
|
| 31 |
#ifdef TEMPLATE_H |
| 32 |
|
| 33 |
namespace M { |
| 34 |
struct false_type { |
| 35 |
static const bool value = false; |
| 36 |
}; |
| 37 |
struct true_type { |
| 38 |
static const bool value = true; |
| 39 |
}; |
| 40 |
|
| 41 |
template <class T> struct is_reference : false_type {}; |
| 42 |
template <class T> struct is_reference<T&> : true_type {}; |
| 43 |
|
| 44 |
template<class T> |
| 45 |
class Template { |
| 46 |
public: |
| 47 |
static const bool isRef = is_reference<T>::value; |
| 48 |
Template() {} |
| 49 |
}; |
| 50 |
} |
| 51 |
#else |
| 52 |
|
| 53 |
#include "template.h" |
| 54 |
|
| 55 |
void foo() { |
| 56 |
M::Template<bool&> TB1; |
| 57 |
TB1.isRef; |
| 58 |
} |
| 59 |
|
| 60 |
#endif |