Alexey Bataev | a769e07 | 2013-03-22 06:34:35 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s |
Alp Toker | 3364fe1 | 2013-11-05 13:27:19 +0000 | [diff] [blame^] | 2 | // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 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 |
Alp Toker | 3364fe1 | 2013-11-05 13:27:19 +0000 | [diff] [blame^] | 5 | // FIXME: This test has been crashing since r186647. |
| 6 | // REQUIRES: disabled |
Alexey Bataev | a769e07 | 2013-03-22 06:34:35 +0000 | [diff] [blame] | 7 | |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 8 | #ifndef HEADER |
| 9 | #define HEADER |
| 10 | |
Alexey Bataev | a769e07 | 2013-03-22 06:34:35 +0000 | [diff] [blame] | 11 | struct St{ |
| 12 | int a; |
| 13 | }; |
| 14 | |
| 15 | struct St1{ |
| 16 | int a; |
| 17 | static int b; |
| 18 | // CHECK: static int b; |
| 19 | #pragma omp threadprivate(b) |
Alexey Bataev | 7d2960b | 2013-09-26 03:24:06 +0000 | [diff] [blame] | 20 | // CHECK-NEXT: #pragma omp threadprivate(St1::b) |
Alexey Bataev | a769e07 | 2013-03-22 06:34:35 +0000 | [diff] [blame] | 21 | } d; |
| 22 | |
| 23 | int a, b; |
| 24 | // CHECK: int a; |
| 25 | // CHECK: int b; |
| 26 | #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> T foo() { |
| 32 | static T v; |
| 33 | #pragma omp threadprivate(v) |
| 34 | return v; |
| 35 | } |
| 36 | //CHECK: template <class T = int> int foo() { |
| 37 | //CHECK-NEXT: static int v; |
| 38 | //CHECK-NEXT: #pragma omp threadprivate(v) |
| 39 | //CHECK: template <class T> T foo() { |
| 40 | //CHECK-NEXT: static T v; |
| 41 | //CHECK-NEXT: #pragma omp threadprivate(v) |
| 42 | |
Alexey Bataev | 7d2960b | 2013-09-26 03:24:06 +0000 | [diff] [blame] | 43 | namespace ns{ |
| 44 | int a; |
| 45 | } |
| 46 | // CHECK: namespace ns { |
| 47 | // CHECK-NEXT: int a; |
| 48 | // CHECK-NEXT: } |
| 49 | #pragma omp threadprivate(ns::a) |
| 50 | // CHECK-NEXT: #pragma omp threadprivate(ns::a) |
| 51 | |
Alexey Bataev | a769e07 | 2013-03-22 06:34:35 +0000 | [diff] [blame] | 52 | int main () { |
| 53 | static int a; |
| 54 | // CHECK: static int a; |
| 55 | #pragma omp threadprivate(a) |
| 56 | // CHECK-NEXT: #pragma omp threadprivate(a) |
| 57 | a=2; |
| 58 | return (foo<int>()); |
| 59 | } |
Alexey Bataev | 5ec3eb1 | 2013-07-19 03:13:43 +0000 | [diff] [blame] | 60 | |
| 61 | #endif |