llvm-project

Форк
0
/
parse-cache-construct.cpp 
113 строк · 4.2 Кб
1
// RUN: %clang_cc1 %s -verify -fopenacc
2

3
namespace NS {
4
  static char* NSArray;// expected-note{{declared here}}
5
  static int NSInt;// expected-note 2{{declared here}}
6
}
7
char *getArrayPtr();
8
template<typename T, int I>
9
void func() {
10
  char *ArrayPtr = getArrayPtr();
11
  for (int i = 0; i < 10; ++i) {
12
    // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
13
    #pragma acc cache(ArrayPtr[T::value + I:I + 5], T::array[(i + T::value, 5): 6])
14
  }
15
  for (int i = 0; i < 10; ++i) {
16
    // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
17
    #pragma acc cache(NS::NSArray[NS::NSInt])
18
  }
19

20
  for (int i = 0; i < 10; ++i) {
21
    // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
22
    #pragma acc cache(NS::NSArray[NS::NSInt : NS::NSInt])
23
  }
24

25
  for (int i = 0; i < 10; ++i) {
26
    // expected-error@+2{{use of undeclared identifier 'NSArray'; did you mean 'NS::NSArray'}}
27
    // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
28
    #pragma acc cache(NSArray[NS::NSInt : NS::NSInt])
29
  }
30

31
  for (int i = 0; i < 10; ++i) {
32
    // expected-error@+2{{use of undeclared identifier 'NSInt'; did you mean 'NS::NSInt'}}
33
    // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
34
    #pragma acc cache(NS::NSArray[NSInt : NS::NSInt])
35
  }
36

37
  for (int i = 0; i < 10; ++i) {
38
    // expected-error@+2{{use of undeclared identifier 'NSInt'; did you mean 'NS::NSInt'}}
39
    // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
40
    #pragma acc cache(NS::NSArray[NS::NSInt : NSInt])
41
  }
42
}
43

44
struct S {
45
  static constexpr int value = 5;
46
  static constexpr char array[] ={1,2,3,4,5};
47
};
48

49
struct Members {
50
  int value = 5;
51
  char array[5] ={1,2,3,4,5};
52
};
53
struct HasMembersArray {
54
  Members MemArr[4];
55
};
56

57

58
void use() {
59

60
  Members s;
61
  for (int i = 0; i < 10; ++i) {
62
    // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
63
    #pragma acc cache(s.array[s.value])
64
  }
65
  HasMembersArray Arrs;
66
  for (int i = 0; i < 10; ++i) {
67
    // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
68
    #pragma acc cache(Arrs.MemArr[3].array[4])
69
  }
70
  for (int i = 0; i < 10; ++i) {
71
    // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
72
    #pragma acc cache(Arrs.MemArr[3].array[1:4])
73
  }
74
  for (int i = 0; i < 10; ++i) {
75
    // expected-error@+2{{OpenACC sub-array is not allowed here}}
76
    // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
77
    #pragma acc cache(Arrs.MemArr[2:1].array[1:4])
78
  }
79
  for (int i = 0; i < 10; ++i) {
80
    // expected-error@+2{{OpenACC sub-array is not allowed here}}
81
    // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
82
    #pragma acc cache(Arrs.MemArr[2:1].array[4])
83
  }
84
  for (int i = 0; i < 10; ++i) {
85
    // expected-error@+3{{expected ']'}}
86
    // expected-note@+2{{to match this '['}}
87
    // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
88
    #pragma acc cache(Arrs.MemArr[3:4:].array[4])
89
  }
90
  for (int i = 0; i < 10; ++i) {
91
    // expected-error@+2{{OpenACC sub-array is not allowed here}}
92
    // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
93
    #pragma acc cache(Arrs.MemArr[:].array[4])
94
  }
95
  for (int i = 0; i < 10; ++i) {
96
    // expected-error@+2{{expected unqualified-id}}
97
    // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
98
    #pragma acc cache(Arrs.MemArr[::].array[4])
99
  }
100
  for (int i = 0; i < 10; ++i) {
101
    // expected-error@+4{{expected expression}}
102
    // expected-error@+3{{expected ']'}}
103
    // expected-note@+2{{to match this '['}}
104
    // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
105
    #pragma acc cache(Arrs.MemArr[: :].array[4])
106
  }
107
  for (int i = 0; i < 10; ++i) {
108
    // expected-error@+2{{OpenACC sub-array is not allowed here}}
109
    // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
110
    #pragma acc cache(Arrs.MemArr[3:].array[4])
111
  }
112
  func<S, 5>();
113
}
114

115

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.