1 // Make sure that compiler-added local variables (whose line number is zero)
2 // don't 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/range_based_for.gc* .
11
12 // RUN: llvm-cov gcov range_based_for.cpp | FileCheck %s --check-prefix=STDOUT
13 // STDOUT: File 'range_based_for.cpp'
14 // STDOUT: Lines executed:100.00% of 5
15 // STDOUT: range_based_for.cpp:creating 'range_based_for.cpp.gcov'
16
17 // RUN: FileCheck %s --check-prefix=GCOV < %t/range_based_for.cpp.gcov
18 // GCOV: -: 0:Runs:1
19 // GCOV: -: 0:Programs:1
20
main(int argc,const char * argv[])21 int main(int argc, const char *argv[]) { // GCOV: 1: [[@LINE]]:int main(
22 int V[] = {1, 2}; // GCOV: 1: [[@LINE]]: int V[]
23 for (int &I : V) { // GCOV: 10: [[@LINE]]: for (
24 } // GCOV: 2: [[@LINE]]: }
25 return 0; // GCOV: 1: [[@LINE]]: return
26 } // GCOV: -: [[@LINE]]:}
27
28 // llvm-cov doesn't work on big endian yet
29 // XFAIL: powerpc64-, s390x, mips-, mips64-, sparc
30