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 // CHECK-NEXT: #pragma omp threadprivate(a) 26 #pragma omp threadprivate(d, b) 27 // CHECK-NEXT: #pragma omp threadprivate(d,b) 28 29 template <class T> 30 struct ST { 31 static T m; 32 #pragma omp threadprivate(m) 33 }; 34 35 template <class T> T foo() { 36 static T v; 37 #pragma omp threadprivate(v) 38 v = ST<T>::m; 39 return v; 40 } 41 //CHECK: template <class T = int> int foo() { 42 //CHECK-NEXT: static int v; 43 //CHECK-NEXT: #pragma omp threadprivate(v) 44 //CHECK: template <class T> T foo() { 45 //CHECK-NEXT: static T v; 46 //CHECK-NEXT: #pragma omp threadprivate(v) 47 48 namespace ns{ 49 int a; 50 } 51 // CHECK: namespace ns { 52 // CHECK-NEXT: int a; 53 // CHECK-NEXT: } 54 #pragma omp threadprivate(ns::a) 55 // CHECK-NEXT: #pragma omp threadprivate(ns::a) 56 57 int main () { 58 static int a; 59 // CHECK: static int a; 60 #pragma omp threadprivate(a) 61 // CHECK-NEXT: #pragma omp threadprivate(a) 62 a=2; 63 return (foo<int>()); 64 } 65 66 #endif 67