1 // RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s
2 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -verify %s -ast-print | FileCheck %s
5 // RUN: %clang_cc1 -verify -fopenmp-simd -ast-print %s | FileCheck %s
6 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s
7 // RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -verify %s -ast-print | FileCheck %s
8 // expected-no-diagnostics
10 // It is unclear if we want to annotate the template instantiations, e.g., S<int>::foo, or not in the two
11 // situations shown below. Since it is always fair to drop assumptions, we do that for now.
19 // CHECK: template <typename T> struct S {
20 // CHECK{LITERAL}: void foo() [[omp::assume("ompx_global_assumption")]] {
27 // CHECK: template<> struct S<int> {
28 // CHECK{LITERAL}: void foo() [[omp::assume("ompx_global_assumption")]] {
30 #pragma omp begin assumes no_openmp
31 // CHECK{LITERAL}: [[omp::assume("omp_no_openmp")]] void S_with_assumes_no_call() [[omp::assume("ompx_global_assumption")]] {
32 void S_with_assumes_no_call() {
36 // CHECK{LITERAL}: [[omp::assume("omp_no_openmp")]] void S_with_assumes_call() [[omp::assume("ompx_global_assumption")]] {
37 void S_with_assumes_call() {
40 // If this is executed we have UB!
43 #pragma omp end assumes
45 // CHECK{LITERAL}: void S_without_assumes() [[omp::assume("ompx_global_assumption")]] {
46 void S_without_assumes() {
51 #pragma omp assumes ext_global_assumption
53 // Same as the struct S above but the order in which we instantiate P is different, first outside of an assumes.
56 // CHECK: template <typename T> struct P {
57 // CHECK{LITERAL}: [[omp::assume("ompx_global_assumption")]] void foo() {
65 // TODO: Avoid the duplication here:
67 // CHECK: template<> struct P<int> {
68 // CHECK{LITERAL}: [[omp::assume("ompx_global_assumption")]] [[omp::assume("ompx_global_assumption")]] void foo() {
70 // CHECK{LITERAL}: [[omp::assume("ompx_global_assumption")]] void P_without_assumes() {
71 void P_without_assumes() {
76 #pragma omp begin assumes no_openmp
77 // CHECK{LITERAL}: [[omp::assume("omp_no_openmp")]] [[omp::assume("ompx_global_assumption")]] void P_with_assumes_no_call() {
78 void P_with_assumes_no_call() {
82 // CHECK{LITERAL}: [[omp::assume("omp_no_openmp")]] [[omp::assume("ompx_global_assumption")]] void P_with_assumes_call() {
83 void P_with_assumes_call() {
86 // If this is executed we have UB!
89 #pragma omp end assumes