| 1 |
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fopenmp -verify -ast-dump %s | FileCheck %s |
| 2 |
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fopenmp -verify -ast-dump %s -x c++| FileCheck %s |
| 3 |
// expected-no-diagnostics |
| 4 |
// FIXME: We have to improve the warnings here as nothing is impacted by the declare variant. |
| 5 |
int also_before(void) { |
| 6 |
return 0; |
| 7 |
} |
| 8 |
|
| 9 |
#pragma omp begin declare variant match(device={kind(cpu)}) |
| 10 |
int also_before(void); |
| 11 |
#pragma omp end declare variant |
| 12 |
#pragma omp begin declare variant match(implementation={vendor(score(100):llvm)}) |
| 13 |
int also_after(void); |
| 14 |
#pragma omp end declare variant |
| 15 |
#pragma omp begin declare variant match(implementation={vendor(score(0):llvm)}) |
| 16 |
int also_before(void); |
| 17 |
#pragma omp end declare variant |
| 18 |
|
| 19 |
int also_after(void) { |
| 20 |
return 0; |
| 21 |
} |
| 22 |
|
| 23 |
int test(void) { |
| 24 |
// Should return 0. |
| 25 |
return also_after() + also_before(); |
| 26 |
} |
| 27 |
|
| 28 |
// Make sure: |
| 29 |
// - we do see the ast nodes for the cpu kind |
| 30 |
// - we do see the ast nodes for the llvm vendor |
| 31 |
// - we pick the right callees |
| 32 |
|
| 33 |
// CHECK: |-FunctionDecl [[ADDR_0:0x[a-z0-9]*]] <{{.*}}, line:7:1> line:5:5 used also_before 'int ({{.*}})' |
| 34 |
// CHECK-NEXT: | `-CompoundStmt [[ADDR_1:0x[a-z0-9]*]] <col:23, line:7:1> |
| 35 |
// CHECK-NEXT: | `-ReturnStmt [[ADDR_2:0x[a-z0-9]*]] <line:6:3, col:10> |
| 36 |
// CHECK-NEXT: | `-IntegerLiteral [[ADDR_3:0x[a-z0-9]*]] <col:10> 'int' 0 |
| 37 |
// CHECK-NEXT: |-FunctionDecl [[ADDR_4:0x[a-z0-9]*]] prev [[ADDR_0]] <line:10:1, col:21> col:5 used also_before 'int ({{.*}})' |
| 38 |
// CHECK-NEXT: |-FunctionDecl [[ADDR_5:0x[a-z0-9]*]] <line:13:1, col:20> col:5 used also_after 'int ({{.*}})' |
| 39 |
// CHECK-NEXT: |-FunctionDecl [[ADDR_6:0x[a-z0-9]*]] prev [[ADDR_4]] <line:16:1, col:21> col:5 used also_before 'int ({{.*}})' |
| 40 |
// CHECK-NEXT: |-FunctionDecl [[ADDR_7:0x[a-z0-9]*]] prev [[ADDR_5]] <line:19:1, line:21:1> line:19:5 used also_after 'int ({{.*}})' |
| 41 |
// CHECK-NEXT: | `-CompoundStmt [[ADDR_8:0x[a-z0-9]*]] <col:22, line:21:1> |
| 42 |
// CHECK-NEXT: | `-ReturnStmt [[ADDR_9:0x[a-z0-9]*]] <line:20:3, col:10> |
| 43 |
// CHECK-NEXT: | `-IntegerLiteral [[ADDR_10:0x[a-z0-9]*]] <col:10> 'int' 0 |
| 44 |
// CHECK-NEXT: `-FunctionDecl [[ADDR_11:0x[a-z0-9]*]] <line:23:1, line:26:1> line:23:5 test 'int ({{.*}})' |
| 45 |
// CHECK-NEXT: `-CompoundStmt [[ADDR_12:0x[a-z0-9]*]] <col:16, line:26:1> |
| 46 |
// CHECK-NEXT: `-ReturnStmt [[ADDR_13:0x[a-z0-9]*]] <line:25:3, col:37> |
| 47 |
// CHECK-NEXT: `-BinaryOperator [[ADDR_14:0x[a-z0-9]*]] <col:10, col:37> 'int' '+' |
| 48 |
// CHECK-NEXT: |-CallExpr [[ADDR_15:0x[a-z0-9]*]] <col:10, col:21> 'int' |
| 49 |
// CHECK-NEXT: | `-ImplicitCastExpr [[ADDR_16:0x[a-z0-9]*]] <col:10> 'int (*)({{.*}})' <FunctionToPointerDecay> |
| 50 |
// CHECK-NEXT: | `-DeclRefExpr [[ADDR_17:0x[a-z0-9]*]] <col:10> 'int ({{.*}})' {{.*}}Function [[ADDR_7]] 'also_after' 'int ({{.*}})' |
| 51 |
// CHECK-NEXT: `-CallExpr [[ADDR_18:0x[a-z0-9]*]] <col:25, col:37> 'int' |
| 52 |
// CHECK-NEXT: `-ImplicitCastExpr [[ADDR_19:0x[a-z0-9]*]] <col:25> 'int (*)({{.*}})' <FunctionToPointerDecay> |
| 53 |
// CHECK-NEXT: `-DeclRefExpr [[ADDR_20:0x[a-z0-9]*]] <col:25> 'int ({{.*}})' {{.*}}Function [[ADDR_6]] 'also_before' 'int ({{.*}})' |