1// Make sure that compiler-added functions (whose line number is zero) don't
2// crash llvm-cov.
3
4// We need shell for cd
5// REQUIRES: shell
6
7// RUN: rm -rf %t
8// RUN: mkdir %t
9// RUN: cd %t
10// RUN: cp %s %p/Inputs/copy_block_helper.gc* .
11
12// RUN: llvm-cov gcov copy_block_helper.m | FileCheck %s --check-prefix=STDOUT
13// STDOUT: File 'copy_block_helper.m'
14// STDOUT: Lines executed:100.00% of 5
15// STDOUT: copy_block_helper.m:creating 'copy_block_helper.m.gcov'
16
17// RUN: FileCheck %s --check-prefix=GCOV < %t/copy_block_helper.m.gcov
18// GCOV: -:    0:Runs:1
19// GCOV: -:    0:Programs:1
20
21id test_helper(id (^foo)(void)) { return foo(); } // GCOV: 1:    [[@LINE]]:id
22void test(id x) { // GCOV: -:    [[@LINE]]:void test
23  test_helper(^{  // GCOV: 2:    [[@LINE]]:  test_helper
24    return x;     // GCOV: 1:    [[@LINE]]:    return
25  });             // GCOV: -:    [[@LINE]]:
26}                 // GCOV: 1:    [[@LINE]]:}
27
28// GCOV: 1:    [[@LINE+1]]:int main
29int main(int argc, const char *argv[]) { test(0); }
30
31// llvm-cov doesn't work on big endian yet
32// XFAIL: powerpc64-, s390x, mips-, mips64-, sparc
33