2014-08-20 01:32:30 +08:00
|
|
|
// RUN: %clang_cc1 -fprofile-instr-generate -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name label.cpp %s | FileCheck %s
|
|
|
|
|
|
|
|
// CHECK: func
|
2015-02-04 05:35:49 +08:00
|
|
|
void func() { // CHECK-NEXT: File 0, [[@LINE]]:13 -> [[@LINE+18]]:2 = #0
|
|
|
|
int i = 0; // CHECK-NEXT: File 0, [[@LINE+2]]:14 -> [[@LINE+2]]:20 = (#0 + #3)
|
|
|
|
// CHECK-NEXT: File 0, [[@LINE+1]]:22 -> [[@LINE+1]]:25 = #3
|
|
|
|
for(i = 0; i < 10; ++i) { // CHECK-NEXT: File 0, [[@LINE]]:27 -> [[@LINE+10]]:4 = #1
|
|
|
|
if(i < 5) { // CHECK-NEXT: File 0, [[@LINE]]:15 -> [[@LINE+6]]:6 = #2
|
2014-08-20 01:32:30 +08:00
|
|
|
{
|
2015-02-19 05:24:51 +08:00
|
|
|
x: // CHECK-NEXT: File 0, [[@LINE]]:9 -> [[@LINE+4]]:6 = #3
|
2014-08-20 01:32:30 +08:00
|
|
|
int j = 1;
|
|
|
|
}
|
|
|
|
int m = 2;
|
|
|
|
} else
|
2015-02-04 05:35:49 +08:00
|
|
|
goto x; // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE]]:13 = (#1 - #2)
|
2015-02-19 05:24:51 +08:00
|
|
|
int k = 3; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE+1]]:4 = #3
|
2014-08-20 01:32:30 +08:00
|
|
|
}
|
2015-02-19 05:24:51 +08:00
|
|
|
static int j = 0; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+4]]:2 = ((#0 + #3) - #1)
|
2014-08-20 01:32:30 +08:00
|
|
|
++j;
|
|
|
|
if(j == 1)
|
2015-02-04 05:35:49 +08:00
|
|
|
goto x; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:11 = #4
|
2014-08-20 01:32:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-NEXT: test1
|
2015-02-04 05:35:49 +08:00
|
|
|
void test1(int x) { // CHECK-NEXT: File 0, [[@LINE]]:19 -> [[@LINE+7]]:2 = #0
|
2014-08-20 01:32:30 +08:00
|
|
|
if(x == 0)
|
2015-02-04 05:35:49 +08:00
|
|
|
goto a; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:11 = #1
|
|
|
|
goto b; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE]]:9 = (#0 - #1)
|
2015-02-19 05:24:51 +08:00
|
|
|
a: // CHECK-NEXT: File 0, [[@LINE]]:1 -> [[@LINE+3]]:2 = #2
|
|
|
|
b: // CHECK-NEXT: File 0, [[@LINE]]:1 -> [[@LINE+2]]:2 = #3
|
2014-08-20 01:32:30 +08:00
|
|
|
x = x + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-NEXT: test2
|
2015-02-04 05:35:49 +08:00
|
|
|
void test2(int x) { // CHECK-NEXT: File 0, [[@LINE]]:19 -> [[@LINE+8]]:2 = #0
|
2014-08-20 01:32:30 +08:00
|
|
|
if(x == 0)
|
2015-02-04 05:35:49 +08:00
|
|
|
goto a; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:11 = #1
|
2015-02-19 05:24:51 +08:00
|
|
|
// CHECK-NEXT: File 0, [[@LINE+1]]:8 -> [[@LINE+1]]:25 = (#0 - #1)
|
2015-02-04 05:35:49 +08:00
|
|
|
else if(x == 1) goto b; // CHECK-NEXT: File 0, [[@LINE]]:19 -> [[@LINE]]:25 = #2
|
2015-02-19 05:24:51 +08:00
|
|
|
a: // CHECK-NEXT: File 0, [[@LINE]]:1 -> [[@LINE+3]]:2 = #3
|
|
|
|
b: // CHECK-NEXT: File 0, [[@LINE]]:1 -> [[@LINE+2]]:2 = #4
|
2014-08-20 01:32:30 +08:00
|
|
|
x = x + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-NEXT: main
|
2015-02-04 05:35:49 +08:00
|
|
|
int main() { // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+17]]:2 = #0
|
2014-08-20 01:32:30 +08:00
|
|
|
int j = 0;
|
2015-02-04 05:35:49 +08:00
|
|
|
for(int i = 0; i < 10; ++i) { // CHECK: File 0, [[@LINE]]:31 -> [[@LINE+11]]:4 = #1
|
2015-02-19 05:24:51 +08:00
|
|
|
a: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+10]]:4 = #2
|
2014-08-20 01:32:30 +08:00
|
|
|
if(i < 3)
|
2015-02-04 05:35:49 +08:00
|
|
|
goto e; // CHECK-NEXT: File 0, [[@LINE]]:7 -> [[@LINE]]:13 = #3
|
|
|
|
goto c; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:11 = (#2 - #3)
|
2015-02-19 05:24:51 +08:00
|
|
|
b: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+6]]:4 = #4
|
2014-08-20 01:32:30 +08:00
|
|
|
j = 2;
|
2015-02-19 05:24:51 +08:00
|
|
|
c: // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+4]]:4 = #5
|
2014-08-20 01:32:30 +08:00
|
|
|
j = 1;
|
2015-02-19 05:24:51 +08:00
|
|
|
// CHECK-NEXT: File 0, [[@LINE+1]]:3 -> [[@LINE+2]]:4 = #6
|
|
|
|
e: f: ; // CHECK-NEXT: File 0, [[@LINE]]:6 -> [[@LINE+1]]:4 = #7
|
2014-08-20 01:32:30 +08:00
|
|
|
}
|
2015-02-19 05:24:51 +08:00
|
|
|
func(); // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+3]]:2 = ((#0 + #7) - #1)
|
2014-08-20 01:32:30 +08:00
|
|
|
test1(0);
|
|
|
|
test2(2);
|
|
|
|
}
|