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