| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
#include <stdio.h> |
| 7 |
template<typename T> |
| 8 |
void unused(T x) { |
| 9 |
return; |
| 10 |
} |
| 11 |
|
| 12 |
template<typename T> |
| 13 |
int func(T x) { |
| 14 |
if(x) // BRCOV: | Branch ([[@LINE]]:6): [True: 0, False: 1] |
| 15 |
return 0; // BRCOV: | Branch ([[@LINE-1]]:6): [True: 1, False: 0] |
| 16 |
else // BRCOV: | Branch ([[@LINE-2]]:6): [True: 0, False: 1] |
| 17 |
return 1; |
| 18 |
int j = 1; |
| 19 |
} |
| 20 |
|
| 21 |
// CHECK-LABEL: _Z4funcIiEiT_: |
| 22 |
// BRCOV: | | Branch ([[@LINE-8]]:6): [True: 0, False: 1] |
| 23 |
// CHECK-LABEL: _Z4funcIbEiT_: |
| 24 |
// BRCOV: | | Branch ([[@LINE-10]]:6): [True: 1, False: 0] |
| 25 |
// CHECK-LABEL: _Z4funcIfEiT_: |
| 26 |
// BRCOV: | | Branch ([[@LINE-12]]:6): [True: 0, False: 1] |
| 27 |
|
| 28 |
|
| 29 |
int main() { |
| 30 |
if (func<int>(0)) // BRCOV: | Branch ([[@LINE]]:7): [True: 1, False: 0] |
| 31 |
printf("case1\n"); |
| 32 |
if (func<bool>(true)) // BRCOV: | Branch ([[@LINE]]:7): [True: 0, False: 1] |
| 33 |
printf("case2\n"); |
| 34 |
if (func<float>(0.0)) // BRCOV: | Branch ([[@LINE]]:7): [True: 1, False: 0] |
| 35 |
printf("case3\n"); |
| 36 |
(void)0; |
| 37 |
return 0; |
| 38 |
} |