1 // RUN: %clang_cc1 -verify -fopenmp -triple x86_64-apple-darwin10.6.0 -ast-print %s | FileCheck %s
2 // RUN: %clang_cc1 -fopenmp -triple x86_64-apple-darwin10.6.0 -x c++ -std=c++11 -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp -triple x86_64-apple-darwin10.6.0 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print
4 // RUN: %clang_cc1 -verify -fopenmp -triple x86_64-unknown-linux-gnu -ast-print %s | FileCheck %s
5 // RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -triple x86_64-unknown-linux-gnu -x c++ -std=c++11 -emit-pch -o %t %s
6 // RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -triple x86_64-unknown-linux-gnu -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print
7 
8 // RUN: %clang_cc1 -verify -fopenmp-simd -triple x86_64-apple-darwin10.6.0 -ast-print %s | FileCheck %s
9 // RUN: %clang_cc1 -fopenmp-simd -triple x86_64-apple-darwin10.6.0 -x c++ -std=c++11 -emit-pch -o %t %s
10 // RUN: %clang_cc1 -fopenmp-simd -triple x86_64-apple-darwin10.6.0 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print
11 // RUN: %clang_cc1 -verify -fopenmp-simd -triple x86_64-unknown-linux-gnu -ast-print %s | FileCheck %s
12 // RUN: %clang_cc1 -fopenmp-simd -fnoopenmp-use-tls -triple x86_64-unknown-linux-gnu -x c++ -std=c++11 -emit-pch -o %t %s
13 // RUN: %clang_cc1 -fopenmp-simd -fnoopenmp-use-tls -triple x86_64-unknown-linux-gnu -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print
14 // expected-no-diagnostics
15 
16 #ifndef HEADER
17 #define HEADER
18 
19 struct St{
20  int a;
21 };
22 
23 struct St1{
24  int a;
25  static int b;
26 // CHECK: static int b;
27 #pragma omp allocate(b)
28 // CHECK-NEXT: #pragma omp allocate(St1::b){{$}}
29 } d;
30 
31 int a, b;
32 // CHECK: int a;
33 // CHECK: int b;
34 #pragma omp allocate(a)
35 #pragma omp allocate(a)
36 // CHECK-NEXT: #pragma omp allocate(a)
37 // CHECK-NEXT: #pragma omp allocate(a)
38 #pragma omp allocate(d, b)
39 // CHECK-NEXT: #pragma omp allocate(d,b)
40 
41 template <class T>
42 struct ST {
43   static T m;
44   #pragma omp allocate(m)
45 };
46 
foo()47 template <class T> T foo() {
48   T v;
49   #pragma omp allocate(v)
50   v = ST<T>::m;
51   return v;
52 }
53 //CHECK: template <class T> T foo() {
54 //CHECK-NEXT: T v;
55 //CHECK-NEXT: #pragma omp allocate(v)
56 //CHECK: template<> int foo<int>() {
57 //CHECK-NEXT: int v;
58 //CHECK-NEXT: #pragma omp allocate(v)
59 
60 namespace ns{
61   int a;
62 }
63 // CHECK: namespace ns {
64 // CHECK-NEXT: int a;
65 // CHECK-NEXT: }
66 #pragma omp allocate(ns::a)
67 // CHECK-NEXT: #pragma omp allocate(ns::a)
68 
main()69 int main () {
70   static int a;
71 // CHECK: static int a;
72 #pragma omp allocate(a)
73 // CHECK-NEXT: #pragma omp allocate(a)
74   a=2;
75   return (foo<int>());
76 }
77 
78 extern template int ST<int>::m;
79 #endif
80