]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/OpenMP/threadprivate_ast_print.cpp
Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3):
[FreeBSD/FreeBSD.git] / test / OpenMP / threadprivate_ast_print.cpp
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 %s
3 // RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print
4 // expected-no-diagnostics
5 // FIXME: This test has been crashing since r186647.
6 // REQUIRES: disabled
7
8 #ifndef HEADER
9 #define HEADER
10
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)
20 // CHECK-NEXT: #pragma omp threadprivate(St1::b)
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
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
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 }
60
61 #endif