| 1 |
// Test that branch regions are generated for conditions in function template |
| 2 |
// instantiations. |
| 3 |
|
| 4 |
// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++11 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name branch-templates.cpp %s | FileCheck %s |
| 5 |
// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++11 -fcoverage-mcdc -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name branch-templates.cpp %s | FileCheck %s |
| 6 |
|
| 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) |
| 15 |
return 0; |
| 16 |
else |
| 17 |
return 1; |
| 18 |
int j = 1; |
| 19 |
} |
| 20 |
|
| 21 |
int main() { |
| 22 |
func<int>(0); |
| 23 |
func<bool>(true); |
| 24 |
func<float>(0.0); |
| 25 |
return 0; |
| 26 |
} |
| 27 |
|
| 28 |
// CHECK-LABEL: _Z4funcIiEiT_: |
| 29 |
// CHECK: Branch,File 0, [[@LINE-15]]:6 -> [[@LINE-15]]:7 = #1, (#0 - #1) |
| 30 |
// CHECK-LABEL: _Z4funcIbEiT_: |
| 31 |
// CHECK: Branch,File 0, [[@LINE-17]]:6 -> [[@LINE-17]]:7 = #1, (#0 - #1) |
| 32 |
// CHECK-LABEL: _Z4funcIfEiT_: |
| 33 |
// CHECK: Branch,File 0, [[@LINE-19]]:6 -> [[@LINE-19]]:7 = #1, (#0 - #1) |