blob: b0cf7ffd227cb9f7fb988fc7a61e0c6e91c3eb69 [file] [log] [blame]
Justin Bogner95e0a702014-03-26 22:03:06 +00001// 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
Justin Bogner95e0a702014-03-26 22:03:06 +00006
7// RUN: rm -rf %t
8// RUN: mkdir %t
9// RUN: cd %t
10// RUN: cp %s %p/Inputs/copy_block_helper.gc* .
11
Justin Bogner5a07bb82015-03-24 23:34:36 +000012// RUN: llvm-cov gcov copy_block_helper.m | FileCheck %s --check-prefix=STDOUT
Justin Bogner95e0a702014-03-26 22:03:06 +000013// 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); }
Justin Bognerdddfc292014-03-26 22:51:39 +000030
31// llvm-cov doesn't work on big endian yet
Hubert Tong55662a82018-01-09 20:09:23 +000032// XFAIL: powerpc-, powerpc64-, s390x, mips-, mips64-, sparc