[OpenACC] Enable 'attach' clause for combined constructs
[llvm-project.git] / clang / test / CoverageMapping / system_macro.cpp
blob38bbb2efb7075b2a838553a8303cd0a8840d7bce
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
6 // LL_CHECK: @__covrec_
7 // LL_W_SYS: [[PROFC:@.*__profc_.*SysTmpl.*]] =
8 // LL_W_SYS: @{{.*}}__profd_{{.*}}SysTmpl{{.*}} =
9 // LL_WOSYS-NOT: SysTmpl
11 // LL_CHECK: @llvm.used =
13 #ifdef IS_SYSHEADER
15 #pragma clang system_header
16 #define Func(x) if (x) {}
17 #define SomeType int
19 // LL_CHECK: define {{.*}} i1 @{{.*}}SysTmpl
20 template <bool f> bool SysTmpl() { return f; }
21 // Check SysTmpl() is instrumented or not.
22 // LL_W_SYS: load i64, ptr [[PROFC]],
23 // LL_WOSYS-NOT: load i64, ptr @__profc_
25 #else
27 #define IS_SYSHEADER
28 #include __FILE__
30 // CHECK-LABEL: doSomething
31 void doSomething(int x) { // CHECK: File 0, [[@LINE]]:25 -> {{[0-9:]+}} = #0
32 // WOSYS-NOT: Expansion,
33 // W_SYS: Expansion,File 0, [[@LINE+1]]:3 -> [[@LINE+1]]:7
34 Func(x);
35 // CHECK: Gap,File 0, [[@LINE+1]]:10
36 return;
37 // WOSYS-NOT: Expansion,
38 // W_SYS: Expansion,File 0, [[@LINE+1]]:3 -> [[@LINE+1]]:11
39 SomeType *f; // CHECK: File 0, [[@LINE]]:11 -> {{[0-9:]+}} = 0
42 // CHECK-LABEL: main
43 int main() { // CHECK: File 0, [[@LINE]]:12 -> [[@LINE+2]]:2 = #0
44 Func([] { return SysTmpl<true>(); }());
47 // W_SYS: SysTmpl
48 // WOSYS-NOT: SysTmpl
50 #endif