1 // RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -triple %itanium_abi_triple -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name classtemplate.cpp %s > %tmapping
2 // RUN: FileCheck -input-file %tmapping %s --check-prefix=CHECK-CONSTRUCTOR
3 // RUN: FileCheck -input-file %tmapping %s --check-prefix=CHECK-GETTER
4 // RUN: FileCheck -input-file %tmapping %s --check-prefix=CHECK-SETTER
5 // RUN: FileCheck -input-file %tmapping %s --check-prefix=CHECK-INIT-LIST
13 const static int BaseCount
= 4;
14 double bases
[BaseCount
];
16 // CHECK-CONSTRUCTOR: _ZN4TestIjEC
17 Test() { } // CHECK-CONSTRUCTOR: File 0, [[@LINE]]:10 -> [[@LINE]]:13 = #0
19 // FIXME: It would be nice to emit no-coverage for get, but trying to do this
20 // runs afoul of cases like Test3::unmangleable below.
21 // FIXME-GETTER: _ZNK4TestIjE3get
22 double get(TT position
) const { // FIXME-GETTER: File 0, [[@LINE]]:33 -> [[@LINE+2]]:4 = 0
23 return bases
[position
];
25 // CHECK-SETTER: _ZN4TestIjE3set
26 void set(TT position
, double value
) { // CHECK-SETTER: File 0, [[@LINE]]:39 -> [[@LINE+2]]:4 = #0
27 bases
[position
] = value
;
32 // CHECK-CONSTRUCTOR: _ZN5Test2C
33 Test2() { } // CHECK-CONSTRUCTOR: File 0, [[@LINE]]:11 -> [[@LINE]]:14 = 0
34 // CHECK-GETTER: _ZNK5Test23get
35 double get(unsigned position
) const { // CHECK-GETTER: File 0, [[@LINE]]:39 -> [[@LINE+2]]:4 = 0
40 // Test3::unmangleable can't be mangled, since there isn't a complete type for
41 // the __is_final type trait expression. This would cause errors if we try to
42 // emit a no-coverage mapping for the method.
43 template <class T
, bool = __is_final(T
)> class UninstantiatedClassWithTraits
{};
44 template <class T
> class Test3
{
45 void unmangleable(UninstantiatedClassWithTraits
<T
> x
) {}
48 void abort() __attribute__((noreturn
));
51 typedef decltype(sizeof(int)) size_t;
53 template <typename E
> struct initializer_list
{
56 initializer_list(const E
*p
, size_t n
) : p(p
), n(n
) {}
59 template <typename F
, typename S
> struct pair
{
62 pair(const F
&f
, const S
&s
) : f(f
), s(s
) {}
68 string(const char *S
) : str(S
) {}
69 ~string() { abort(); }
72 template<typename K
, typename V
>
75 map(initializer_list
<T
> i
, const string
&s
= string()) {}
81 // CHECK-INIT-LIST-LABEL: _Z5Test4v:
82 std::map
<int, int> Test4() { // CHECK-INIT-LIST: File 0, [[@LINE]]:28 -> [[@LINE+3]]:2 = #0
83 abort(); // CHECK-INIT-LIST-NEXT: Gap,File 0, [[@LINE]]:11 -> [[@LINE+1]]:3 = 0
84 return std::map
<int, int>{{0, 0}}; // CHECK-INIT-LIST-NEXT: [[@LINE]]:3 -> [[@LINE]]:36 = 0
89 t
.set(Test
<unsigned>::A
, 5.5);
90 t
.set(Test
<unsigned>::T
, 5.6);
91 t
.set(Test
<unsigned>::G
, 5.7);
92 t
.set(Test
<unsigned>::C
, 5.8);