96 lines · cpp
1// RUN: %clang_cc1 -verify -fopenmp -triple x86_64-apple-darwin10.6.0 -ast-print %s -o - | FileCheck %s2// RUN: %clang_cc1 -fopenmp -triple x86_64-apple-darwin10.6.0 -x c++ -std=c++11 -emit-pch -o %t %s3// RUN: %clang_cc1 -fopenmp -triple x86_64-apple-darwin10.6.0 -std=c++11 -include-pch %t -verify %s -ast-print | FileCheck %s4// RUN: %clang_cc1 -verify -fopenmp -triple x86_64-unknown-linux-gnu -ast-print %s -o - | FileCheck %s5// RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -triple x86_64-unknown-linux-gnu -x c++ -std=c++11 -emit-pch -o %t %s6// RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -triple x86_64-unknown-linux-gnu -std=c++11 -include-pch %t -verify %s -ast-print -o - | FileCheck %s7 8// RUN: %clang_cc1 -verify -fopenmp-simd -triple x86_64-apple-darwin10.6.0 -ast-print %s -o - | FileCheck %s9// RUN: %clang_cc1 -fopenmp-simd -triple x86_64-apple-darwin10.6.0 -x c++ -std=c++11 -emit-pch -o %t %s10// RUN: %clang_cc1 -fopenmp-simd -triple x86_64-apple-darwin10.6.0 -std=c++11 -include-pch %t -verify %s -ast-print | FileCheck %s11// RUN: %clang_cc1 -verify -fopenmp-simd -triple x86_64-unknown-linux-gnu -ast-print %s -o - | FileCheck %s12// RUN: %clang_cc1 -fopenmp-simd -fnoopenmp-use-tls -triple x86_64-unknown-linux-gnu -x c++ -std=c++11 -emit-pch -o %t %s13// RUN: %clang_cc1 -fopenmp-simd -fnoopenmp-use-tls -triple x86_64-unknown-linux-gnu -std=c++11 -include-pch %t -verify %s -ast-print -o - | FileCheck %s14// expected-no-diagnostics15 16#ifndef HEADER17#define HEADER18 19typedef void **omp_allocator_handle_t;20extern const omp_allocator_handle_t omp_null_allocator;21extern const omp_allocator_handle_t omp_default_mem_alloc;22extern const omp_allocator_handle_t omp_large_cap_mem_alloc;23extern const omp_allocator_handle_t omp_const_mem_alloc;24extern const omp_allocator_handle_t omp_high_bw_mem_alloc;25extern const omp_allocator_handle_t omp_low_lat_mem_alloc;26extern const omp_allocator_handle_t omp_cgroup_mem_alloc;27extern const omp_allocator_handle_t omp_pteam_mem_alloc;28extern const omp_allocator_handle_t omp_thread_mem_alloc;29 30struct St{31 int a;32};33 34struct St1{35 int a;36 static int b;37// CHECK: static int b;38#pragma omp allocate(b) allocator(omp_default_mem_alloc)39// CHECK-NEXT: #pragma omp allocate(St1::b) allocator(omp_default_mem_alloc){{$}}40} d;41 42int a, b, c;43// CHECK: int a;44// CHECK: int b;45// CHECK: int c;46#pragma omp allocate(a) allocator(omp_large_cap_mem_alloc)47#pragma omp allocate(b) allocator(omp_const_mem_alloc)48// CHECK-NEXT: #pragma omp allocate(a) allocator(omp_large_cap_mem_alloc)49// CHECK-NEXT: #pragma omp allocate(b) allocator(omp_const_mem_alloc)50#pragma omp allocate(c, d) allocator(omp_high_bw_mem_alloc)51// CHECK-NEXT: #pragma omp allocate(c,d) allocator(omp_high_bw_mem_alloc)52 53template <class T>54struct ST {55 static T m;56 #pragma omp allocate(m) allocator(omp_low_lat_mem_alloc)57};58 59template <class T> T foo() {60 T v;61 #pragma omp allocate(v) allocator(omp_cgroup_mem_alloc)62 v = ST<T>::m;63 return v;64}65//CHECK: template <class T> T foo() {66//CHECK-NEXT: T v;67//CHECK-NEXT: #pragma omp allocate(v) allocator(omp_cgroup_mem_alloc)68//CHECK: template<> int foo<int>() {69//CHECK-NEXT: int v;70//CHECK-NEXT: #pragma omp allocate(v) allocator(omp_cgroup_mem_alloc)71 72namespace ns{73 int a;74}75// CHECK: namespace ns {76// CHECK-NEXT: int a;77// CHECK-NEXT: }78#pragma omp allocate(ns::a) allocator(omp_pteam_mem_alloc)79// CHECK-NEXT: #pragma omp allocate(ns::a) allocator(omp_pteam_mem_alloc)80 81int main () {82 static int a;83// CHECK: static int a;84#pragma omp allocate(a) allocator(omp_thread_mem_alloc)85// CHECK-NEXT: #pragma omp allocate(a) allocator(omp_thread_mem_alloc)86 a=2;87 int b = 3;88// CHECK: int b = 3;89#pragma omp allocate(b)90// CHECK-NEXT: #pragma omp allocate(b)91 return (foo<int>());92}93 94extern template int ST<int>::m;95#endif96