2016-02-05 02:39:09 +08:00
|
|
|
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name preprocessor.c %s | FileCheck %s
|
2014-08-20 01:32:30 +08:00
|
|
|
|
|
|
|
// CHECK: func
|
2015-02-04 05:35:49 +08:00
|
|
|
void func() { // CHECK: File 0, [[@LINE]]:13 -> [[@LINE+5]]:2 = #0
|
2014-08-20 01:32:30 +08:00
|
|
|
int i = 0;
|
2015-02-04 05:35:49 +08:00
|
|
|
#ifdef MACRO // CHECK-NEXT: Skipped,File 0, [[@LINE]]:2 -> [[@LINE+2]]:2 = 0
|
2014-08-20 01:32:30 +08:00
|
|
|
int x = i;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
int g = 0;
|
|
|
|
|
|
|
|
void bar() { }
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// CHECK: main
|
2015-02-19 11:10:30 +08:00
|
|
|
int main() { // CHECK-NEXT: File 0, [[@LINE]]:12 -> {{[0-9]+}}:2 = #0
|
2014-08-20 01:32:30 +08:00
|
|
|
int i = 0;
|
2015-02-04 05:35:49 +08:00
|
|
|
#if 0 // CHECK-NEXT: Skipped,File 0, [[@LINE]]:2 -> [[@LINE+4]]:2 = 0
|
2014-08-20 01:32:30 +08:00
|
|
|
if(i == 0) {
|
|
|
|
i = 1;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if 1
|
2015-02-19 11:10:30 +08:00
|
|
|
// CHECK-NEXT: File 0, [[@LINE+1]]:6 -> [[@LINE+1]]:12 = #0
|
2015-02-04 05:35:49 +08:00
|
|
|
if(i == 0) { // CHECK-NEXT: File 0, [[@LINE]]:14 -> [[@LINE+2]]:4 = #1
|
2014-08-20 01:32:30 +08:00
|
|
|
i = 1;
|
|
|
|
}
|
2015-02-04 05:35:49 +08:00
|
|
|
#else // CHECK-NEXT: Skipped,File 0, [[@LINE]]:2 -> [[@LINE+5]]:2 = 0
|
2014-08-20 01:32:30 +08:00
|
|
|
if(i == 1) {
|
|
|
|
i = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|