Restructure some tests to split into `%.test` and Inputs/%.c*`. Add test actions with `yaml2obj` for single byte coverage. `FileCheck` lines are: - Relax to accept both counter values and single values `1`. A few line counting are greater than `1` due to `llvm-profdata merge`. They will be fixed by #110972. - Suppress matching with `--check-prefixes=CHECK,BRCOV`, since the current implementation of single byte doesn't emit any branch coverages. They will be integrated to `CHECK` finally. - Some tests are not unified but use dedicated `CHECK` lines for single byte, since old format is different (esp. "partial fold"). They will be unified when `Inputs` will be regenerated. Introduce llvm/test/tools/llvm-cov/Inputs/yaml.makefile for convenience. `%-single.yaml` and `%-single.proftext` are generated by it. It could be used to regenerate other files. https://discourse.llvm.org/t/rfc-integrating-singlebytecoverage-with-branch-coverage/82492
39 lines
1.0 KiB
C++
39 lines
1.0 KiB
C++
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
template<typename T>
|
|
void unused(T x) {
|
|
return;
|
|
}
|
|
|
|
template<typename T>
|
|
int func(T x) {
|
|
if(x) // BRCOV: | Branch ([[@LINE]]:6): [True: 0, False: 1]
|
|
return 0; // BRCOV: | Branch ([[@LINE-1]]:6): [True: 1, False: 0]
|
|
else // BRCOV: | Branch ([[@LINE-2]]:6): [True: 0, False: 1]
|
|
return 1;
|
|
int j = 1;
|
|
}
|
|
|
|
// CHECK-LABEL: _Z4funcIiEiT_:
|
|
// BRCOV: | | Branch ([[@LINE-8]]:6): [True: 0, False: 1]
|
|
// CHECK-LABEL: _Z4funcIbEiT_:
|
|
// BRCOV: | | Branch ([[@LINE-10]]:6): [True: 1, False: 0]
|
|
// CHECK-LABEL: _Z4funcIfEiT_:
|
|
// BRCOV: | | Branch ([[@LINE-12]]:6): [True: 0, False: 1]
|
|
|
|
|
|
int main() {
|
|
if (func<int>(0)) // BRCOV: | Branch ([[@LINE]]:7): [True: 1, False: 0]
|
|
printf("case1\n");
|
|
if (func<bool>(true)) // BRCOV: | Branch ([[@LINE]]:7): [True: 0, False: 1]
|
|
printf("case2\n");
|
|
if (func<float>(0.0)) // BRCOV: | Branch ([[@LINE]]:7): [True: 1, False: 0]
|
|
printf("case3\n");
|
|
(void)0;
|
|
return 0;
|
|
}
|