1 // RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp -fnoopenmp-use-tls -ferror-limit 100 -o - %s 2 3 #pragma omp end declare target // expected-error {{unexpected OpenMP directive '#pragma omp end declare target'}} 4 5 int a, b; // expected-warning {{declaration is not declared in any declare target region}} 6 __thread int t; // expected-note {{defined as threadprivate or thread local}} 7 #pragma omp declare target private(a) // expected-warning {{extra tokens at the end of '#pragma omp declare target' are ignored}} 8 void f(); 9 #pragma omp end declare target shared(a) // expected-warning {{extra tokens at the end of '#pragma omp end declare target' are ignored}} 10 void c(); // expected-warning {{declaration is not declared in any declare target region}} 11 12 extern int b; 13 14 struct NonT { 15 int a; 16 }; 17 18 typedef int sint; 19 20 #pragma omp declare target // expected-note {{to match this '#pragma omp declare target'}} 21 #pragma omp threadprivate(a) // expected-note {{defined as threadprivate or thread local}} 22 extern int b; 23 int g; 24 25 struct T { // expected-note {{mappable type cannot be polymorphic}} 26 int a; 27 virtual int method(); 28 }; 29 30 class VC { // expected-note {{mappable type cannot be polymorphic}} 31 T member; 32 NonT member1; 33 public: 34 virtual int method() { T a; return 0; } // expected-error {{type 'T' is not mappable to target}} 35 }; 36 37 struct C { 38 NonT a; 39 sint b; 40 int method(); 41 int method1(); 42 }; 43 44 int C::method1() { 45 return 0; 46 } 47 48 void foo() { 49 a = 0; // expected-error {{threadprivate variables cannot be used in target constructs}} 50 b = 0; // expected-note {{used here}} 51 t = 1; // expected-error {{threadprivate variables cannot be used in target constructs}} 52 C object; 53 VC object1; // expected-error {{type 'VC' is not mappable to target}} 54 g = object.method(); 55 g += object.method1(); 56 g += object1.method(); 57 f(); 58 c(); // expected-note {{used here}} 59 } 60 #pragma omp declare target // expected-error {{expected '#pragma omp end declare target'}} 61 void foo1() {} 62 #pragma omp end declare target 63 #pragma omp end declare target // expected-error {{unexpected OpenMP directive '#pragma omp end declare target'}} 64 65 int C::method() { 66 return 0; 67 } 68 69 struct S { 70 #pragma omp declare target // expected-error {{directive must be at file or namespace scope}} 71 int v; 72 #pragma omp end declare target // expected-error {{unexpected OpenMP directive '#pragma omp end declare target'}} 73 }; 74 75 int main (int argc, char **argv) { 76 #pragma omp declare target // expected-error {{unexpected OpenMP directive '#pragma omp declare target'}} 77 int v; 78 #pragma omp end declare target // expected-error {{unexpected OpenMP directive '#pragma omp end declare target'}} 79 foo(); 80 return (0); 81 } 82 83 namespace { 84 #pragma omp declare target // expected-note {{to match this '#pragma omp declare target'}} 85 int x; 86 } // expected-error {{expected '#pragma omp end declare target'}} 87 #pragma omp end declare target // expected-error {{unexpected OpenMP directive '#pragma omp end declare target'}} 88 89 #pragma omp declare target // expected-error {{expected '#pragma omp end declare target'}} expected-note {{to match this '#pragma omp declare target'}} 90