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