aboutsummaryrefslogtreecommitdiff
path: root/clang/test/SemaOpenACC
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaOpenACC')
-rw-r--r--clang/test/SemaOpenACC/combined-construct-num_workers-ast.cpp2
-rw-r--r--clang/test/SemaOpenACC/combined-construct-reduction-clause.cpp25
-rw-r--r--clang/test/SemaOpenACC/compute-construct-intexpr-clause-ast.cpp2
-rw-r--r--clang/test/SemaOpenACC/compute-construct-reduction-clause.c10
-rw-r--r--clang/test/SemaOpenACC/compute-construct-reduction-clause.cpp63
-rw-r--r--clang/test/SemaOpenACC/compute-construct-varlist-ast.cpp4
-rw-r--r--clang/test/SemaOpenACC/gh154008.cpp5
-rw-r--r--clang/test/SemaOpenACC/init-construct.cpp6
-rw-r--r--clang/test/SemaOpenACC/loop-construct-reduction-clause.cpp30
-rw-r--r--clang/test/SemaOpenACC/shutdown-construct.cpp6
10 files changed, 136 insertions, 17 deletions
diff --git a/clang/test/SemaOpenACC/combined-construct-num_workers-ast.cpp b/clang/test/SemaOpenACC/combined-construct-num_workers-ast.cpp
index a04fcdd..cdd6bc7 100644
--- a/clang/test/SemaOpenACC/combined-construct-num_workers-ast.cpp
+++ b/clang/test/SemaOpenACC/combined-construct-num_workers-ast.cpp
@@ -66,7 +66,7 @@ void NormalUses() {
// CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <UserDefinedConversion>
// CHECK-NEXT: CXXMemberCallExpr{{.*}}'int'
// CHECK-NEXT: MemberExpr{{.*}} '<bound member function type>' .operator int
- // CHECK-NEXT: DeclRefExpr{{.*}} 'struct CorrectConvert':'CorrectConvert' lvalue Var
+ // CHECK-NEXT: DeclRefExpr{{.*}} 'struct CorrectConvert' lvalue Var
// CHECK-NEXT: ForStmt
// CHECK: NullStmt
}
diff --git a/clang/test/SemaOpenACC/combined-construct-reduction-clause.cpp b/clang/test/SemaOpenACC/combined-construct-reduction-clause.cpp
index 7b1a61e..1a54907 100644
--- a/clang/test/SemaOpenACC/combined-construct-reduction-clause.cpp
+++ b/clang/test/SemaOpenACC/combined-construct-reduction-clause.cpp
@@ -39,8 +39,9 @@ void uses(unsigned Parm) {
#pragma acc kernels loop reduction(min: CoS, Array[I], Array[0:I])
for(int i = 0; i < 5; ++i);
- // expected-error@+2{{OpenACC 'reduction' composite variable must not have non-scalar field}}
- // expected-note@#COS_FIELD{{invalid field is here}}
+ // expected-error@+3{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
+ // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}}
+ // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}}
#pragma acc parallel loop reduction(&: ChC)
for(int i = 0; i < 5; ++i);
@@ -166,4 +167,24 @@ void uses(unsigned Parm) {
#pragma acc parallel loop reduction(&:I)
for(int i = 0; i < 5; ++i);
}
+
+ CompositeHasComposite CoCArr[5];
+ // expected-error@+4{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
+ // expected-note@+3{{used as element type of array type 'CompositeHasComposite'}}
+ // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}}
+ // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}}
+#pragma acc parallel loop reduction(+:CoCArr)
+ for(int i = 0; i < 5; ++i);
+ // expected-error@+4{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
+ // expected-note@+3{{used as element type of array type 'CompositeHasComposite[5]'}}
+ // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}}
+ // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}}
+#pragma acc parallel loop reduction(+:CoCArr[3])
+ for(int i = 0; i < 5; ++i);
+ // expected-error@+4{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
+ // expected-note@+3{{used as element type of sub-array type 'CompositeHasComposite'}}
+ // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}}
+ // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}}
+#pragma acc parallel loop reduction(+:CoCArr[1:1])
+ for(int i = 0; i < 5; ++i);
}
diff --git a/clang/test/SemaOpenACC/compute-construct-intexpr-clause-ast.cpp b/clang/test/SemaOpenACC/compute-construct-intexpr-clause-ast.cpp
index 58476df..63c5cde 100644
--- a/clang/test/SemaOpenACC/compute-construct-intexpr-clause-ast.cpp
+++ b/clang/test/SemaOpenACC/compute-construct-intexpr-clause-ast.cpp
@@ -73,7 +73,7 @@ void NormalUses() {
// CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <UserDefinedConversion>
// CHECK-NEXT: CXXMemberCallExpr{{.*}}'int'
// CHECK-NEXT: MemberExpr{{.*}} '<bound member function type>' .operator int
- // CHECK-NEXT: DeclRefExpr{{.*}} 'struct CorrectConvert':'CorrectConvert' lvalue Var
+ // CHECK-NEXT: DeclRefExpr{{.*}} 'struct CorrectConvert' lvalue Var
// CHECK-NEXT: WhileStmt
// CHECK-NEXT: CXXBoolLiteralExpr
// CHECK-NEXT: CompoundStmt
diff --git a/clang/test/SemaOpenACC/compute-construct-reduction-clause.c b/clang/test/SemaOpenACC/compute-construct-reduction-clause.c
index 995b6d3..ebced2b 100644
--- a/clang/test/SemaOpenACC/compute-construct-reduction-clause.c
+++ b/clang/test/SemaOpenACC/compute-construct-reduction-clause.c
@@ -63,8 +63,9 @@ void uses(unsigned Parm) {
// Vars in a reduction must be a scalar or a composite of scalars.
#pragma acc parallel reduction(&: CoS, I, F)
while (1);
- // expected-error@+2{{OpenACC 'reduction' composite variable must not have non-scalar field}}
- // expected-note@#COS_FIELD{{invalid field is here}}
+ // expected-error@+3{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
+ // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}}
+ // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}}
#pragma acc parallel reduction(&: ChC)
while (1);
@@ -75,7 +76,10 @@ void uses(unsigned Parm) {
while (1);
struct CompositeHasComposite ChCArray[5];
- // expected-error@+1{{OpenACC 'reduction' variable must be of scalar type, aggregate, sub-array, or a composite of scalar types; sub-array base type is 'struct CompositeHasComposite'}}
+ // expected-error@+4{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
+ // expected-note@+3{{used as element type of sub-array type 'struct CompositeHasComposite'}}
+ // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}}
+ // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}}
#pragma acc parallel reduction(&: CoS, Array[I], ChCArray[0:I])
while (1);
diff --git a/clang/test/SemaOpenACC/compute-construct-reduction-clause.cpp b/clang/test/SemaOpenACC/compute-construct-reduction-clause.cpp
index b40268c..2e1f180 100644
--- a/clang/test/SemaOpenACC/compute-construct-reduction-clause.cpp
+++ b/clang/test/SemaOpenACC/compute-construct-reduction-clause.cpp
@@ -66,8 +66,9 @@ void uses(unsigned Parm) {
// Vars in a reduction must be a scalar or a composite of scalars.
#pragma acc parallel reduction(&: CoS, I, F)
while (1);
- // expected-error@+2{{OpenACC 'reduction' composite variable must not have non-scalar field}}
- // expected-note@#COS_FIELD{{invalid field is here}}
+ // expected-error@+3{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
+ // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}}
+ // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}}
#pragma acc parallel reduction(&: ChC)
while (1);
#pragma acc parallel reduction(&: Array)
@@ -91,6 +92,59 @@ void uses(unsigned Parm) {
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, or composite variable member}}
#pragma acc parallel reduction(&: ChCPtr->COS)
while (1);
+
+ CompositeHasComposite CoCArr[5];
+ // expected-error@+4{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
+ // expected-note@+3{{used as element type of array type 'CompositeHasComposite'}}
+ // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}}
+ // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}}
+#pragma acc parallel reduction(+:CoCArr)
+ while (1);
+ // expected-error@+4{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
+ // expected-note@+3{{used as element type of array type 'CompositeHasComposite[5]'}}
+ // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}}
+ // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}}
+#pragma acc parallel reduction(+:CoCArr[3])
+ while (1);
+ // expected-error@+4{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
+ // expected-note@+3{{used as element type of sub-array type 'CompositeHasComposite'}}
+ // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}}
+ // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}}
+#pragma acc parallel reduction(+:CoCArr[1:1])
+ while (1);
+
+ int *IPtr;
+ // expected-error@+2{{invalid type 'int *' used in OpenACC 'reduction' variable reference; type is not a scalar value, or array of scalars, or composite of scalars}}
+ // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}}
+#pragma acc parallel reduction(+:IPtr)
+ while (1);
+#pragma acc parallel reduction(+:IPtr[1])
+ while (1);
+#pragma acc parallel reduction(+:IPtr[1:1])
+ while (1);
+
+ int *IPtrArr[5];
+ // expected-error@+3{{invalid type 'int *' used in OpenACC 'reduction' variable reference; type is not a scalar value, or array of scalars, or composite of scalars}}
+ // expected-note@+2{{used as element type of array type 'int *'}}
+ // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}}
+#pragma acc parallel reduction(+:IPtrArr)
+ while (1);
+
+ struct HasPtr { int *I; }; // #HASPTR
+ HasPtr HP;
+ // expected-error@+3{{invalid type 'int *' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
+ // expected-note@#HASPTR{{used as field 'I' of composite 'HasPtr'}}
+ // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}}
+#pragma acc parallel reduction(+:HP)
+ while (1);
+
+ HasPtr HPArr[5];
+ // expected-error@+4{{invalid type 'int *' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
+ // expected-note@+3{{used as element type of array type 'HasPtr'}}
+ // expected-note@#HASPTR{{used as field 'I' of composite 'HasPtr'}}
+ // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}}
+#pragma acc parallel reduction(+:HPArr)
+ while (1);
}
template<typename T, typename U, typename V>
@@ -135,8 +189,9 @@ void TemplUses(T Parm, U CoS, V ChC) {
// Vars in a reduction must be a scalar or a composite of scalars.
#pragma acc parallel reduction(&: CoS, Var, Parm)
while (1);
- // expected-error@+2{{OpenACC 'reduction' composite variable must not have non-scalar field}}
- // expected-note@#COS_FIELD{{invalid field is here}}
+ // expected-error@+3{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
+ // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}}
+ // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}}
#pragma acc parallel reduction(&: ChC)
while (1);
#pragma acc parallel reduction(&: Array)
diff --git a/clang/test/SemaOpenACC/compute-construct-varlist-ast.cpp b/clang/test/SemaOpenACC/compute-construct-varlist-ast.cpp
index e3c4184..2d2b20f 100644
--- a/clang/test/SemaOpenACC/compute-construct-varlist-ast.cpp
+++ b/clang/test/SemaOpenACC/compute-construct-varlist-ast.cpp
@@ -102,7 +102,7 @@ void NormalUses(float *PointerParam) {
#pragma acc parallel copy(GlobalArray) pcopy(always: PointerParam[Global]) present_or_copy(alwaysin, alwaysout: Global)
while(true);
// CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
- // CHECK-NEXT: copy clause
+ // CHECK-NEXT: copy clause
// CHECK-NEXT: DeclRefExpr{{.*}}'short[5]' lvalue Var{{.*}}'GlobalArray' 'short[5]'
// CHECK-NEXT: pcopy clause modifiers: always
// CHECK-NEXT: ArraySubscriptExpr{{.*}}'float' lvalue
@@ -649,7 +649,7 @@ void TemplUses(T t, U u, T*PointerParam) {
struct S {
// CHECK-NEXT: CXXRecordDecl{{.*}} struct S definition
- // CHECK: CXXRecordDecl{{.*}} implicit struct S
+ // CHECK: CXXRecordDecl{{.*}} implicit {{.*}}struct S{{$}}
int ThisMember;
// CHECK-NEXT: FieldDecl{{.*}} ThisMember 'int'
int *ThisMemberPtr;
diff --git a/clang/test/SemaOpenACC/gh154008.cpp b/clang/test/SemaOpenACC/gh154008.cpp
new file mode 100644
index 0000000..1ec114c
--- /dev/null
+++ b/clang/test/SemaOpenACC/gh154008.cpp
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 %s -fopenacc -verify
+
+// expected-error@+2{{expected ';'}}
+// expected-error@+1{{blocks support disabled}}
+void *a = ^ { static int b };
diff --git a/clang/test/SemaOpenACC/init-construct.cpp b/clang/test/SemaOpenACC/init-construct.cpp
index abc7f74..d553589 100644
--- a/clang/test/SemaOpenACC/init-construct.cpp
+++ b/clang/test/SemaOpenACC/init-construct.cpp
@@ -34,6 +34,12 @@ void uses() {
// expected-error@+2{{OpenACC integer expression requires explicit conversion from 'struct ExplicitConvertOnly' to 'int'}}
// expected-note@#EXPL_CONV{{conversion to integral type 'int'}}
#pragma acc init device_num(Explicit)
+
+ // expected-error@+1{{OpenACC 'device_type' clause on a 'init' construct only permits one architecture}}
+#pragma acc init device_type(nvidia, radeon)
+
+ // expected-error@+1{{OpenACC 'device_type' clause on a 'init' construct only permits one architecture}}
+#pragma acc init device_type(nonsense, nvidia, radeon)
}
template<typename T>
diff --git a/clang/test/SemaOpenACC/loop-construct-reduction-clause.cpp b/clang/test/SemaOpenACC/loop-construct-reduction-clause.cpp
index 00bcd74..4e88516 100644
--- a/clang/test/SemaOpenACC/loop-construct-reduction-clause.cpp
+++ b/clang/test/SemaOpenACC/loop-construct-reduction-clause.cpp
@@ -42,8 +42,9 @@ void uses() {
#pragma acc serial
{
- // expected-error@+2{{OpenACC 'reduction' composite variable must not have non-scalar field}}
- // expected-note@#COS_FIELD{{invalid field is here}}
+ // expected-error@+3{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
+ // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}}
+ // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}}
#pragma acc loop reduction(+:ChC)
for(int i = 0; i < 5; ++i){}
}
@@ -153,6 +154,26 @@ void uses() {
for(int i = 0; i < 5; ++i) {
}
}
+
+ CompositeHasComposite CoCArr[5];
+ // expected-error@+4{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
+ // expected-note@+3{{used as element type of array type 'CompositeHasComposite'}}
+ // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}}
+ // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}}
+#pragma acc loop reduction(+:CoCArr)
+ for(int i = 0; i < 5; ++i);
+ // expected-error@+4{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
+ // expected-note@+3{{used as element type of array type 'CompositeHasComposite[5]'}}
+ // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}}
+ // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}}
+#pragma acc loop reduction(+:CoCArr[3])
+ for(int i = 0; i < 5; ++i);
+ // expected-error@+4{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
+ // expected-note@+3{{used as element type of sub-array type 'CompositeHasComposite'}}
+ // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}}
+ // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}}
+#pragma acc loop reduction(+:CoCArr[1:1])
+ for(int i = 0; i < 5; ++i);
}
template<typename IntTy, typename CoSTy, typename ChCTy, unsigned One,
@@ -177,8 +198,9 @@ void templ_uses() {
#pragma acc serial
{
- // expected-error@+2{{OpenACC 'reduction' composite variable must not have non-scalar field}}
- // expected-note@#COS_FIELD{{invalid field is here}}
+ // expected-error@+3{{invalid type 'struct CompositeOfScalars' used in OpenACC 'reduction' variable reference; type is not a scalar value}}
+ // expected-note@#COS_FIELD{{used as field 'COS' of composite 'CompositeHasComposite'}}
+ // expected-note@+1{{OpenACC 'reduction' variable reference must be a scalar variable or a composite of scalars, or an array, sub-array, or element of scalar types}}
#pragma acc loop reduction(+:ChC)
for(int i = 0; i < 5; ++i){}
}
diff --git a/clang/test/SemaOpenACC/shutdown-construct.cpp b/clang/test/SemaOpenACC/shutdown-construct.cpp
index 95cea90..e08a968 100644
--- a/clang/test/SemaOpenACC/shutdown-construct.cpp
+++ b/clang/test/SemaOpenACC/shutdown-construct.cpp
@@ -34,6 +34,12 @@ void uses() {
// expected-error@+2{{OpenACC integer expression requires explicit conversion from 'struct ExplicitConvertOnly' to 'int'}}
// expected-note@#EXPL_CONV{{conversion to integral type 'int'}}
#pragma acc shutdown device_num(Explicit)
+
+ // expected-error@+1{{OpenACC 'device_type' clause on a 'shutdown' construct only permits one architecture}}
+#pragma acc shutdown device_type(nvidia, radeon)
+
+ // expected-error@+1{{OpenACC 'device_type' clause on a 'shutdown' construct only permits one architecture}}
+#pragma acc shutdown device_type(nonsense, nvidia, radeon)
}
template<typename T>