[OPENMP] Allow all classes as mappable types.

According to upcoming OpenMP 5.0 all classes/structs are now considered
as mappable, even polymorphic and with static members.

llvm-svn: 313141
This commit is contained in:
Alexey Bataev 2017-09-13 11:12:35 +00:00
parent 67b042c207
commit ed94bd9223
15 changed files with 80 additions and 130 deletions

View File

@ -8837,16 +8837,10 @@ def err_omp_expected_base_var_name : Error<
"expected variable name as a base of the array %select{subscript|section}0">;
def err_omp_map_shared_storage : Error<
"variable already marked as mapped in current construct">;
def err_omp_not_mappable_type : Error<
"type %0 is not mappable to target">;
def err_omp_invalid_map_type_for_directive : Error<
"%select{map type '%1' is not allowed|map type must be specified}0 for '#pragma omp %2'">;
def err_omp_no_clause_for_directive : Error<
"expected at least one %0 clause for '#pragma omp %1'">;
def note_omp_polymorphic_in_target : Note<
"mappable type cannot be polymorphic">;
def note_omp_static_member_in_target : Note<
"mappable type cannot contain static members">;
def err_omp_threadprivate_in_clause : Error<
"threadprivate variables are not allowed in '%0' clause">;
def err_omp_wrong_ordered_loop_count : Error<

View File

@ -10574,56 +10574,12 @@ OMPClause *Sema::ActOnOpenMPDeviceClause(Expr *Device, SourceLocation StartLoc,
return new (Context) OMPDeviceClause(ValExpr, StartLoc, LParenLoc, EndLoc);
}
static bool IsCXXRecordForMappable(Sema &SemaRef, SourceLocation Loc,
DSAStackTy *Stack, CXXRecordDecl *RD) {
if (!RD || RD->isInvalidDecl())
return true;
auto QTy = SemaRef.Context.getRecordType(RD);
if (RD->isDynamicClass()) {
SemaRef.Diag(Loc, diag::err_omp_not_mappable_type) << QTy;
SemaRef.Diag(RD->getLocation(), diag::note_omp_polymorphic_in_target);
return false;
}
auto *DC = RD;
bool IsCorrect = true;
for (auto *I : DC->decls()) {
if (I) {
if (auto *MD = dyn_cast<CXXMethodDecl>(I)) {
if (MD->isStatic()) {
SemaRef.Diag(Loc, diag::err_omp_not_mappable_type) << QTy;
SemaRef.Diag(MD->getLocation(),
diag::note_omp_static_member_in_target);
IsCorrect = false;
}
} else if (auto *VD = dyn_cast<VarDecl>(I)) {
if (VD->isStaticDataMember()) {
SemaRef.Diag(Loc, diag::err_omp_not_mappable_type) << QTy;
SemaRef.Diag(VD->getLocation(),
diag::note_omp_static_member_in_target);
IsCorrect = false;
}
}
}
}
for (auto &I : RD->bases()) {
if (!IsCXXRecordForMappable(SemaRef, I.getLocStart(), Stack,
I.getType()->getAsCXXRecordDecl()))
IsCorrect = false;
}
return IsCorrect;
}
static bool CheckTypeMappable(SourceLocation SL, SourceRange SR, Sema &SemaRef,
DSAStackTy *Stack, QualType QTy) {
NamedDecl *ND;
if (QTy->isIncompleteType(&ND)) {
SemaRef.Diag(SL, diag::err_incomplete_type) << QTy << SR;
return false;
} else if (CXXRecordDecl *RD = dyn_cast_or_null<CXXRecordDecl>(ND)) {
if (!RD->isInvalidDecl() && !IsCXXRecordForMappable(SemaRef, SL, Stack, RD))
return false;
}
return true;
}

View File

@ -28,16 +28,16 @@ typedef int sint;
extern int b;
int g;
struct T { // expected-note {{mappable type cannot be polymorphic}}
struct T {
int a;
virtual int method();
};
class VC { // expected-note {{mappable type cannot be polymorphic}}
class VC {
T member;
NonT member1;
public:
virtual int method() { T a; return 0; } // expected-error {{type 'T' is not mappable to target}}
virtual int method() { T a; return 0; }
};
struct C {
@ -56,7 +56,7 @@ void foo() {
b = 0; // expected-note {{used here}}
t = 1; // expected-error {{threadprivate variables cannot be used in target constructs}}
C object;
VC object1; // expected-error {{type 'VC' is not mappable to target}}
VC object1;
g = object.method();
g += object.method1();
g += object1.method();

View File

@ -319,8 +319,8 @@ class S2 {
public:
S2():a(0) { }
S2(S2 &s2):a(s2.a) { }
static float S2s; // expected-note 4 {{mappable type cannot contain static members}}
static const float S2sc; // expected-note 4 {{mappable type cannot contain static members}}
static float S2s;
static const float S2sc;
};
const float S2::S2sc = 0;
const S2 b;
@ -353,7 +353,7 @@ template <class T>
struct S6;
template<>
struct S6<int> // expected-note {{mappable type cannot be polymorphic}}
struct S6<int>
{
virtual void foo();
};
@ -420,8 +420,8 @@ T tmain(T argc) {
#pragma omp target data map(tofrom: argc > 0 ? x : y) // expected-error 2 {{expected expression containing only member accesses and/or array sections based on named variables}}
#pragma omp target data map(argc)
#pragma omp target data map(S1) // expected-error {{'S1' does not refer to a value}}
#pragma omp target data map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target data map(ba) // expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target data map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
#pragma omp target data map(ba)
#pragma omp target data map(ca)
#pragma omp target data map(da)
#pragma omp target data map(S2::S2s)
@ -489,9 +489,9 @@ int main(int argc, char **argv) {
#pragma omp target data map(tofrom: argc > 0 ? argv[1] : argv[2]) // expected-error {{xpected expression containing only member accesses and/or array sections based on named variables}}
#pragma omp target data map(argc)
#pragma omp target data map(S1) // expected-error {{'S1' does not refer to a value}}
#pragma omp target data map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target data map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
#pragma omp target data map(argv[1])
#pragma omp target data map(ba) // expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target data map(ba)
#pragma omp target data map(ca)
#pragma omp target data map(da)
#pragma omp target data map(S2::S2s)
@ -525,7 +525,7 @@ int main(int argc, char **argv) {
{}
#pragma omp target firstprivate(j) map(j) // expected-error {{firstprivate variable cannot be in a map clause in '#pragma omp target' directive}} expected-note {{defined as firstprivate}}
{}
#pragma omp target map(m) // expected-error {{type 'S6<int>' is not mappable to target}}
#pragma omp target map(m)
{}
return tmain<int, 3>(argc)+tmain<from, 4>(argc); // expected-note {{in instantiation of function template specialization 'tmain<int, 3>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<int, 4>' requested here}}
}

View File

@ -14,8 +14,8 @@ class S2 {
public:
S2():a(0) { }
S2(S2 &s2):a(s2.a) { }
static float S2s; // expected-note 4 {{mappable type cannot contain static members}}
static const float S2sc; // expected-note 4 {{mappable type cannot contain static members}}
static float S2s;
static const float S2sc;
};
const float S2::S2sc = 0;
const S2 b;
@ -116,9 +116,9 @@ T tmain(T argc) {
for (i = 0; i < argc; ++i) foo();
#pragma omp target parallel for map(S1) // expected-error {{'S1' does not refer to a value}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target parallel for map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target parallel for map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target parallel for map(ba) // expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target parallel for map(ba)
for (i = 0; i < argc; ++i) foo();
#pragma omp target parallel for map(ca)
for (i = 0; i < argc; ++i) foo();
@ -222,11 +222,11 @@ int main(int argc, char **argv) {
for (i = 0; i < argc; ++i) foo();
#pragma omp target parallel for map(S1) // expected-error {{'S1' does not refer to a value}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target parallel for map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target parallel for map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target parallel for map(argv[1])
for (i = 0; i < argc; ++i) foo();
#pragma omp target parallel for map(ba) // expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target parallel for map(ba)
for (i = 0; i < argc; ++i) foo();
#pragma omp target parallel for map(ca)
for (i = 0; i < argc; ++i) foo();

View File

@ -14,8 +14,8 @@ class S2 {
public:
S2():a(0) { }
S2(S2 &s2):a(s2.a) { }
static float S2s; // expected-note 4 {{mappable type cannot contain static members}}
static const float S2sc; // expected-note 4 {{mappable type cannot contain static members}}
static float S2s;
static const float S2sc;
};
const float S2::S2sc = 0;
const S2 b;
@ -116,9 +116,9 @@ T tmain(T argc) {
for (i = 0; i < argc; ++i) foo();
#pragma omp target parallel for simd map(S1) // expected-error {{'S1' does not refer to a value}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target parallel for simd map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target parallel for simd map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target parallel for simd map(ba) // expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target parallel for simd map(ba)
for (i = 0; i < argc; ++i) foo();
#pragma omp target parallel for simd map(ca)
for (i = 0; i < argc; ++i) foo();
@ -222,11 +222,11 @@ int main(int argc, char **argv) {
for (i = 0; i < argc; ++i) foo();
#pragma omp target parallel for simd map(S1) // expected-error {{'S1' does not refer to a value}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target parallel for simd map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target parallel for simd map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target parallel for simd map(argv[1])
for (i = 0; i < argc; ++i) foo();
#pragma omp target parallel for simd map(ba) // expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target parallel for simd map(ba)
for (i = 0; i < argc; ++i) foo();
#pragma omp target parallel for simd map(ca)
for (i = 0; i < argc; ++i) foo();

View File

@ -14,8 +14,8 @@ class S2 {
public:
S2():a(0) { }
S2(S2 &s2):a(s2.a) { }
static float S2s; // expected-note 4 {{mappable type cannot contain static members}}
static const float S2sc; // expected-note 4 {{mappable type cannot contain static members}}
static float S2s;
static const float S2sc;
};
const float S2::S2sc = 0;
const S2 b;
@ -116,9 +116,9 @@ T tmain(T argc) {
foo();
#pragma omp target parallel map(S1) // expected-error {{'S1' does not refer to a value}}
foo();
#pragma omp target parallel map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target parallel map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
foo();
#pragma omp target parallel map(ba) // expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target parallel map(ba)
foo();
#pragma omp target parallel map(ca)
foo();
@ -221,11 +221,11 @@ int main(int argc, char **argv) {
foo();
#pragma omp target parallel map(S1) // expected-error {{'S1' does not refer to a value}}
foo();
#pragma omp target parallel map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target parallel map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
foo();
#pragma omp target parallel map(argv[1])
foo();
#pragma omp target parallel map(ba) // expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target parallel map(ba)
foo();
#pragma omp target parallel map(ca)
foo();

View File

@ -14,8 +14,8 @@ class S2 {
public:
S2():a(0) { }
S2(S2 &s2):a(s2.a) { }
static float S2s; // expected-note 4 {{mappable type cannot contain static members}}
static const float S2sc; // expected-note 4 {{mappable type cannot contain static members}}
static float S2s;
static const float S2sc;
};
const float S2::S2sc = 0;
const S2 b;
@ -112,9 +112,9 @@ T tmain(T argc) {
for (i = 0; i < argc; ++i) foo();
#pragma omp target simd map(S1) // expected-error {{'S1' does not refer to a value}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target simd map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target simd map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target simd map(ba) // expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target simd map(ba)
for (i = 0; i < argc; ++i) foo();
#pragma omp target simd map(ca)
for (i = 0; i < argc; ++i) foo();
@ -214,11 +214,11 @@ int main(int argc, char **argv) {
for (i = 0; i < argc; ++i) foo();
#pragma omp target simd map(S1) // expected-error {{'S1' does not refer to a value}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target simd map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target simd map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target simd map(argv[1])
for (i = 0; i < argc; ++i) foo();
#pragma omp target simd map(ba) // expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target simd map(ba)
for (i = 0; i < argc; ++i) foo();
#pragma omp target simd map(ca)
for (i = 0; i < argc; ++i) foo();

View File

@ -14,8 +14,8 @@ class S2 {
public:
S2():a(0) { }
S2(S2 &s2):a(s2.a) { }
static float S2s; // expected-note 4 {{mappable type cannot contain static members}}
static const float S2sc; // expected-note 4 {{mappable type cannot contain static members}}
static float S2s;
static const float S2sc;
};
const float S2::S2sc = 0;
const S2 b;
@ -116,9 +116,9 @@ T tmain(T argc) {
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute map(S1) // expected-error {{'S1' does not refer to a value}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target teams distribute map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute map(ba) // expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target teams distribute map(ba)
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute map(ca)
for (i = 0; i < argc; ++i) foo();
@ -222,11 +222,11 @@ int main(int argc, char **argv) {
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute map(S1) // expected-error {{'S1' does not refer to a value}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target teams distribute map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute map(argv[1])
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute map(ba) // expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target teams distribute map(ba)
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute map(ca)
for (i = 0; i < argc; ++i) foo();

View File

@ -14,8 +14,8 @@ class S2 {
public:
S2():a(0) { }
S2(S2 &s2):a(s2.a) { }
static float S2s; // expected-note 4 {{mappable type cannot contain static members}}
static const float S2sc; // expected-note 4 {{mappable type cannot contain static members}}
static float S2s;
static const float S2sc;
};
const float S2::S2sc = 0;
const S2 b;
@ -116,9 +116,9 @@ T tmain(T argc) {
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute parallel for map(S1) // expected-error {{'S1' does not refer to a value}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute parallel for map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target teams distribute parallel for map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute parallel for map(ba) // expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target teams distribute parallel for map(ba)
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute parallel for map(ca)
for (i = 0; i < argc; ++i) foo();
@ -222,11 +222,11 @@ int main(int argc, char **argv) {
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute parallel for map(S1) // expected-error {{'S1' does not refer to a value}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute parallel for map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target teams distribute parallel for map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute parallel for map(argv[1])
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute parallel for map(ba) // expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target teams distribute parallel for map(ba)
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute parallel for map(ca)
for (i = 0; i < argc; ++i) foo();

View File

@ -14,8 +14,8 @@ class S2 {
public:
S2():a(0) { }
S2(S2 &s2):a(s2.a) { }
static float S2s; // expected-note 4 {{mappable type cannot contain static members}}
static const float S2sc; // expected-note 4 {{mappable type cannot contain static members}}
static float S2s;
static const float S2sc;
};
const float S2::S2sc = 0;
const S2 b;
@ -116,9 +116,9 @@ T tmain(T argc) {
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute parallel for simd map(S1) // expected-error {{'S1' does not refer to a value}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute parallel for simd map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target teams distribute parallel for simd map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute parallel for simd map(ba) // expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target teams distribute parallel for simd map(ba)
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute parallel for simd map(ca)
for (i = 0; i < argc; ++i) foo();
@ -222,11 +222,11 @@ int main(int argc, char **argv) {
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute parallel for simd map(S1) // expected-error {{'S1' does not refer to a value}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute parallel for simd map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target teams distribute parallel for simd map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute parallel for simd map(argv[1])
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute parallel for simd map(ba) // expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target teams distribute parallel for simd map(ba)
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute parallel for simd map(ca)
for (i = 0; i < argc; ++i) foo();

View File

@ -14,8 +14,8 @@ class S2 {
public:
S2():a(0) { }
S2(S2 &s2):a(s2.a) { }
static float S2s; // expected-note 4 {{mappable type cannot contain static members}}
static const float S2sc; // expected-note 4 {{mappable type cannot contain static members}}
static float S2s;
static const float S2sc;
};
const float S2::S2sc = 0;
const S2 b;
@ -116,9 +116,9 @@ T tmain(T argc) {
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute simd map(S1) // expected-error {{'S1' does not refer to a value}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute simd map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target teams distribute simd map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute simd map(ba) // expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target teams distribute simd map(ba)
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute simd map(ca)
for (i = 0; i < argc; ++i) foo();
@ -222,11 +222,11 @@ int main(int argc, char **argv) {
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute simd map(S1) // expected-error {{'S1' does not refer to a value}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute simd map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target teams distribute simd map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute simd map(argv[1])
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute simd map(ba) // expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target teams distribute simd map(ba)
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute simd map(ca)
for (i = 0; i < argc; ++i) foo();

View File

@ -312,8 +312,8 @@ class S2 {
public:
S2():a(0) { }
S2(S2 &s2):a(s2.a) { }
static float S2s; // expected-note 4 {{mappable type cannot contain static members}}
static const float S2sc; // expected-note 4 {{mappable type cannot contain static members}}
static float S2s;
static const float S2sc;
};
const float S2::S2sc = 0;
const S2 b;
@ -346,7 +346,7 @@ template <class T>
struct S6;
template<>
struct S6<int> // expected-note {{mappable type cannot be polymorphic}}
struct S6<int>
{
virtual void foo();
};
@ -414,8 +414,8 @@ T tmain(T argc) {
#pragma omp target data map(tofrom: argc > 0 ? x : y) // expected-error 2 {{expected expression containing only member accesses and/or array sections based on named variables}}
#pragma omp target data map(argc)
#pragma omp target data map(S1) // expected-error {{'S1' does not refer to a value}}
#pragma omp target data map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target data map(ba) // expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target data map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
#pragma omp target data map(ba)
#pragma omp target data map(ca)
#pragma omp target data map(da)
#pragma omp target data map(S2::S2s)
@ -488,9 +488,9 @@ int main(int argc, char **argv) {
#pragma omp target data map(tofrom: argc > 0 ? argv[1] : argv[2]) // expected-error {{xpected expression containing only member accesses and/or array sections based on named variables}}
#pragma omp target data map(argc)
#pragma omp target data map(S1) // expected-error {{'S1' does not refer to a value}}
#pragma omp target data map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target data map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
#pragma omp target data map(argv[1])
#pragma omp target data map(ba) // expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target data map(ba)
#pragma omp target data map(ca)
#pragma omp target data map(da)
#pragma omp target data map(S2::S2s)
@ -530,7 +530,7 @@ int main(int argc, char **argv) {
#pragma omp target teams firstprivate(j) map(j) // expected-error {{firstprivate variable cannot be in a map clause in '#pragma omp target teams' directive}} expected-note {{defined as firstprivate}}
{}
#pragma omp target teams map(m) // expected-error {{type 'S6<int>' is not mappable to target}}
#pragma omp target teams map(m)
{}
return tmain<int, 3>(argc)+tmain<from, 4>(argc); // expected-note {{in instantiation of function template specialization 'tmain<int, 3>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<int, 4>' requested here}}

View File

@ -14,8 +14,8 @@ class S2 {
public:
S2():a(0) { }
S2(S2 &s2):a(s2.a) { }
static float S2s; // expected-note 4 {{mappable type cannot contain static members}}
static const float S2sc; // expected-note 4 {{mappable type cannot contain static members}}
static float S2s;
static const float S2sc;
};
const float S2::S2sc = 0;
const S2 b;
@ -94,8 +94,8 @@ T tmain(T argc) {
#pragma omp target update from(y x) // expected-error {{expected ',' or ')' in 'from' clause}}
#pragma omp target update from(argc > 0 ? x : y) // expected-error 2 {{expected expression containing only member accesses and/or array sections based on named variables}}
#pragma omp target update from(S1) // expected-error {{'S1' does not refer to a value}}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target update from(ba) // expected-error 2 {{type 'S2' is not mappable to target}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
#pragma omp target update from(ba)
#pragma omp target update from(h) // expected-error {{threadprivate variables are not allowed in 'from' clause}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from(k), to(k) // expected-error 2 {{variable can appear only once in OpenMP 'target update' construct}} expected-note 2 {{used here}}
#pragma omp target update from(t), from(t[:5]) // expected-error 2 {{variable can appear only once in OpenMP 'target update' construct}} expected-note 2 {{used here}}
@ -148,8 +148,8 @@ int main(int argc, char **argv) {
#pragma omp target update from(y x) // expected-error {{expected ',' or ')' in 'from' clause}}
#pragma omp target update from(argc > 0 ? x : y) // expected-error {{expected expression containing only member accesses and/or array sections based on named variables}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from(S1) // expected-error {{'S1' does not refer to a value}}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target update from(ba) // expected-error 2 {{type 'S2' is not mappable to target}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
#pragma omp target update from(ba)
#pragma omp target update from(h) // expected-error {{threadprivate variables are not allowed in 'from' clause}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from(k), to(k) // expected-error {{variable can appear only once in OpenMP 'target update' construct}} expected-note {{used here}}
#pragma omp target update from(t), from(t[:5]) // expected-error {{variable can appear only once in OpenMP 'target update' construct}} expected-note {{used here}}

View File

@ -14,8 +14,8 @@ class S2 {
public:
S2():a(0) { }
S2(S2 &s2):a(s2.a) { }
static float S2s; // expected-note 4 {{mappable type cannot contain static members}}
static const float S2sc; // expected-note 4 {{mappable type cannot contain static members}}
static float S2s;
static const float S2sc;
};
const float S2::S2sc = 0;
const S2 b;
@ -94,8 +94,8 @@ T tmain(T argc) {
#pragma omp target update to(y x) // expected-error {{expected ',' or ')' in 'to' clause}}
#pragma omp target update to(argc > 0 ? x : y) // expected-error 2 {{expected expression containing only member accesses and/or array sections based on named variables}}
#pragma omp target update to(S1) // expected-error {{'S1' does not refer to a value}}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update to(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target update to(ba) // expected-error 2 {{type 'S2' is not mappable to target}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update to(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
#pragma omp target update to(ba)
#pragma omp target update to(h) // expected-error {{threadprivate variables are not allowed in 'to' clause}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update to(k), from(k) // expected-error 2 {{variable can appear only once in OpenMP 'target update' construct}} expected-note 2 {{used here}}
#pragma omp target update to(t), to(t[:5]) // expected-error 2 {{variable can appear only once in OpenMP 'target update' construct}} expected-note 2 {{used here}}
@ -147,8 +147,8 @@ int main(int argc, char **argv) {
#pragma omp target update to(y x) // expected-error {{expected ',' or ')' in 'to' clause}}
#pragma omp target update to(argc > 0 ? x : y) // expected-error {{expected expression containing only member accesses and/or array sections based on named variables}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update to(S1) // expected-error {{'S1' does not refer to a value}}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update to(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target update to(ba) // expected-error 2 {{type 'S2' is not mappable to target}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update to(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}}
#pragma omp target update to(ba)
#pragma omp target update to(h) // expected-error {{threadprivate variables are not allowed in 'to' clause}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update to(k), from(k) // expected-error {{variable can appear only once in OpenMP 'target update' construct}} expected-note {{used here}}
#pragma omp target update to(t), to(t[:5]) // expected-error {{variable can appear only once in OpenMP 'target update' construct}} expected-note {{used here}}