blob: 72bf6f4077eb902781ed7a47f164868280f991a4 [file] [log] [blame]
Alexey Bataeva769e072013-03-22 06:34:35 +00001// RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s
Alp Toker3364fe12013-11-05 13:27:19 +00002// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s
Alexey Bataev5ec3eb12013-07-19 03:13:43 +00003// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print
Alexey Bataeva769e072013-03-22 06:34:35 +00004// expected-no-diagnostics
Alp Toker3364fe12013-11-05 13:27:19 +00005// FIXME: This test has been crashing since r186647.
6// REQUIRES: disabled
Alexey Bataeva769e072013-03-22 06:34:35 +00007
Alexey Bataev5ec3eb12013-07-19 03:13:43 +00008#ifndef HEADER
9#define HEADER
10
Alexey Bataeva769e072013-03-22 06:34:35 +000011struct St{
12 int a;
13};
14
15struct St1{
16 int a;
17 static int b;
18// CHECK: static int b;
19#pragma omp threadprivate(b)
Alexey Bataev7d2960b2013-09-26 03:24:06 +000020// CHECK-NEXT: #pragma omp threadprivate(St1::b)
Alexey Bataeva769e072013-03-22 06:34:35 +000021} d;
22
23int 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
31template <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 Bataev7d2960b2013-09-26 03:24:06 +000043namespace 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 Bataeva769e072013-03-22 06:34:35 +000052int 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 Bataev5ec3eb12013-07-19 03:13:43 +000060
61#endif