Home | History | Annotate | Download | only in OpenMP
      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
      3 // RUN: %clang_cc1 -fopenmp -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(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> T foo() {
     30   static T v;
     31   #pragma omp threadprivate(v)
     32   return v;
     33 }
     34 //CHECK: template <class T = int> int foo() {
     35 //CHECK-NEXT: static int v;
     36 //CHECK-NEXT: #pragma omp threadprivate(v)
     37 //CHECK: template <class T> T foo() {
     38 //CHECK-NEXT: static T v;
     39 //CHECK-NEXT: #pragma omp threadprivate(v)
     40 
     41 int main () {
     42   static int a;
     43 // CHECK: static int a;
     44 #pragma omp threadprivate(a)
     45 // CHECK-NEXT: #pragma omp threadprivate(a)
     46   a=2;
     47   return (foo<int>());
     48 }
     49 
     50 #endif
     51