Skip to content

Commit 2bceb81

Browse files
chapuniaaryanshukla
authored andcommitted
Update clang/test/system_macro.cpp for both -system-headers-coverage=true/false
Part of llvm#97952
1 parent 0920b27 commit 2bceb81

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed
Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,51 @@
1-
// RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -mllvm -system-headers-coverage -std=c++11 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name system_macro.cpp -o - %s | FileCheck %s
1+
// RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -mllvm -system-headers-coverage=true -std=c++11 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm -main-file-name system_macro.cpp -o %t.w_sys.ll %s | FileCheck %s --check-prefixes=CHECK,W_SYS
2+
// RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -mllvm -system-headers-coverage=false -std=c++11 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm -main-file-name system_macro.cpp -o %t.wosys.ll %s | FileCheck %s --check-prefixes=CHECK,WOSYS
3+
// RUN: FileCheck %s --check-prefixes=LL_CHECK,LL_W_SYS < %t.w_sys.ll
4+
// RUN: FileCheck %s --check-prefixes=LL_CHECK,LL_WOSYS < %t.wosys.ll
5+
6+
// LL_CHECK: @__covrec_
7+
// LL_W_SYS: [[PROFC:@.*__profc_.*SysTmpl.*]] =
8+
// LL_WOSYS: [[PROFC:@.*__profc_.*SysTmpl.*]] =
9+
// LL_W_SYS: @{{.*}}__profd_{{.*}}SysTmpl{{.*}} =
10+
// LL_WOSYS: @{{.*}}__profd_{{.*}}SysTmpl{{.*}} =
11+
12+
// LL_CHECK: @llvm.used =
213

314
#ifdef IS_SYSHEADER
415

516
#pragma clang system_header
617
#define Func(x) if (x) {}
718
#define SomeType int
819

20+
// LL_CHECK: define {{.*}} i1 @{{.*}}SysTmpl
21+
template <bool f> bool SysTmpl() { return f; }
22+
// Check SysTmpl() is instrumented or not.
23+
// LL_W_SYS: load i64, ptr [[PROFC]],
24+
// LL_WOSYS: load i64, ptr [[PROFC]],
25+
926
#else
1027

1128
#define IS_SYSHEADER
1229
#include __FILE__
1330

1431
// CHECK-LABEL: doSomething
1532
void doSomething(int x) { // CHECK: File 0, [[@LINE]]:25 -> {{[0-9:]+}} = #0
16-
Func(x); // CHECK: Expansion,File 0, [[@LINE]]:3 -> [[@LINE]]:7
33+
// WOSYS-NOT: Expansion,
34+
// W_SYS: Expansion,File 0, [[@LINE+1]]:3 -> [[@LINE+1]]:7
35+
Func(x);
36+
// CHECK: Gap,File 0, [[@LINE+1]]:10
1737
return;
18-
// CHECK: Expansion,File 0, [[@LINE+1]]:3 -> [[@LINE+1]]:11
38+
// WOSYS-NOT: Expansion,
39+
// W_SYS: Expansion,File 0, [[@LINE+1]]:3 -> [[@LINE+1]]:11
1940
SomeType *f; // CHECK: File 0, [[@LINE]]:11 -> {{[0-9:]+}} = 0
2041
}
2142

2243
// CHECK-LABEL: main
2344
int main() { // CHECK: File 0, [[@LINE]]:12 -> [[@LINE+2]]:2 = #0
24-
Func([] { return true; }());
45+
Func([] { return SysTmpl<true>(); }());
2546
}
2647

48+
// W_SYS: SysTmpl
49+
// WOSYS-NOT: SysTmpl
50+
2751
#endif

0 commit comments

Comments
 (0)