|
5 | 5 | // RUN: %clang_cc1 -verify -Wno-vla -fopenmp-simd -ast-print %s | FileCheck %s
|
6 | 6 | // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s
|
7 | 7 | // RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -verify -Wno-vla %s -ast-print | FileCheck %s
|
| 8 | +// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -ast-dump %s | FileCheck %s --check-prefix=DUMP |
8 | 9 | // expected-no-diagnostics
|
9 | 10 |
|
10 | 11 | #ifndef HEADER
|
@@ -208,4 +209,44 @@ int main(int argc, char **argv) {
|
208 | 209 | extern template int S<int>::TS;
|
209 | 210 | extern template long S<long>::TS;
|
210 | 211 |
|
| 212 | +// DUMP-LABEL: FunctionDecl {{.*}} implicit_firstprivate |
| 213 | +void |
| 214 | +implicit_firstprivate() { |
| 215 | + |
| 216 | +#pragma omp parallel num_threads(1) |
| 217 | + { |
| 218 | + int i = 0; |
| 219 | + // DUMP: OMPTaskDirective |
| 220 | + // DUMP-NEXT: OMPFirstprivateClause |
| 221 | + // DUMP-NOT: DeclRefExpr {{.+}} 'i' {{.+}} non_odr_use_unevaluated |
| 222 | + // DUMP: DeclRefExpr {{.+}} 'i' 'int' refers_to_enclosing_variable_or_capture |
| 223 | + // DUMP: CapturedStmt |
| 224 | + // DUMP: BinaryOperator {{.+}} 'int' lvalue '=' |
| 225 | + // DUMP-NEXT: DeclRefExpr {{.+}} 'j' 'int' |
| 226 | + // DUMP: DeclRefExpr {{.+}} 'i' {{.+}} non_odr_use_unevaluated |
| 227 | + #pragma omp task |
| 228 | + { |
| 229 | + int j = sizeof(i); |
| 230 | + j = i; |
| 231 | + } |
| 232 | + } |
| 233 | +} |
| 234 | + |
| 235 | +// DUMP-LABEL: FunctionDecl {{.*}} no_implicit_firstprivate |
| 236 | +void |
| 237 | +no_implicit_firstprivate() { |
| 238 | + |
| 239 | +#pragma omp parallel num_threads(1) |
| 240 | + { |
| 241 | + int i = 0; |
| 242 | + // DUMP: OMPTaskDirective |
| 243 | + // DUMP-NEXT: CapturedStmt |
| 244 | + // DUMP: DeclRefExpr {{.+}} 'i' {{.+}} non_odr_use_unevaluated refers_to_enclosing_variable_or_capture |
| 245 | + #pragma omp task |
| 246 | + { |
| 247 | + int j = sizeof(i); |
| 248 | + } |
| 249 | + } |
| 250 | +} |
| 251 | + |
211 | 252 | #endif
|
0 commit comments