Alexey Bataev | a769e07 | 2013-03-22 06:34:35 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 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 |
Alexey Bataev | a769e07 | 2013-03-22 06:34:35 +0000 | [diff] [blame] | 4 | // expected-no-diagnostics |
| 5 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 6 | #ifndef HEADER |
| 7 | #define HEADER |
| 8 | |
Alexey Bataev | a769e07 | 2013-03-22 06:34:35 +0000 | [diff] [blame] | 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) |
Alexey Bataev | 7d2960b | 2013-09-26 03:24:06 +0000 | [diff] [blame^] | 18 | // CHECK-NEXT: #pragma omp threadprivate(St1::b) |
Alexey Bataev | a769e07 | 2013-03-22 06:34:35 +0000 | [diff] [blame] | 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 | |
Alexey Bataev | 7d2960b | 2013-09-26 03:24:06 +0000 | [diff] [blame^] | 41 | namespace ns{ |
| 42 | int a; |
| 43 | } |
| 44 | // CHECK: namespace ns { |
| 45 | // CHECK-NEXT: int a; |
| 46 | // CHECK-NEXT: } |
| 47 | #pragma omp threadprivate(ns::a) |
| 48 | // CHECK-NEXT: #pragma omp threadprivate(ns::a) |
| 49 | |
Alexey Bataev | a769e07 | 2013-03-22 06:34:35 +0000 | [diff] [blame] | 50 | int main () { |
| 51 | static int a; |
| 52 | // CHECK: static int a; |
| 53 | #pragma omp threadprivate(a) |
| 54 | // CHECK-NEXT: #pragma omp threadprivate(a) |
| 55 | a=2; |
| 56 | return (foo<int>()); |
| 57 | } |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 58 | |
| 59 | #endif |