mirror of https://github.com/microsoft/clang.git
[OPENMP] Analyze the type of the mapped entity instead of its base.
If the mapped entity is a data member, we erroneously checked the type of its base rather than the type of the mapped entity itself. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@331385 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d717d5a7ed
commit
8eb6a2dbe7
|
@ -12305,7 +12305,14 @@ checkMappableExpressionList(Sema &SemaRef, DSAStackTy *DSAS,
|
||||||
// OpenMP 4.5 [2.15.5.1, map Clause, Restrictions, C++, p.1]
|
// OpenMP 4.5 [2.15.5.1, map Clause, Restrictions, C++, p.1]
|
||||||
// If the type of a list item is a reference to a type T then the type will
|
// If the type of a list item is a reference to a type T then the type will
|
||||||
// be considered to be T for all purposes of this clause.
|
// be considered to be T for all purposes of this clause.
|
||||||
QualType Type = CurDeclaration->getType().getNonReferenceType();
|
auto I = llvm::find_if(
|
||||||
|
CurComponents,
|
||||||
|
[](const OMPClauseMappableExprCommon::MappableComponent &MC) {
|
||||||
|
return MC.getAssociatedDeclaration();
|
||||||
|
});
|
||||||
|
assert(I != CurComponents.end() && "Null decl on map clause.");
|
||||||
|
QualType Type =
|
||||||
|
I->getAssociatedDeclaration()->getType().getNonReferenceType();
|
||||||
|
|
||||||
// OpenMP 4.5 [2.10.5, target update Construct, Restrictions, p.4]
|
// OpenMP 4.5 [2.10.5, target update Construct, Restrictions, p.4]
|
||||||
// A list item in a to or from clause must have a mappable type.
|
// A list item in a to or from clause must have a mappable type.
|
||||||
|
|
|
@ -19,6 +19,13 @@ void foo(int arg) {
|
||||||
{}
|
{}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
struct SREF {
|
||||||
|
int &a;
|
||||||
|
int b;
|
||||||
|
SREF(int &a) : a(a) {}
|
||||||
|
};
|
||||||
|
|
||||||
template <typename T, int I>
|
template <typename T, int I>
|
||||||
struct SA {
|
struct SA {
|
||||||
static int ss;
|
static int ss;
|
||||||
|
@ -31,13 +38,14 @@ struct SA {
|
||||||
T *f;
|
T *f;
|
||||||
int bf : 20;
|
int bf : 20;
|
||||||
void func(int arg) {
|
void func(int arg) {
|
||||||
|
SREF sref(arg);
|
||||||
#pragma omp target
|
#pragma omp target
|
||||||
{
|
{
|
||||||
a = 0.0;
|
a = 0.0;
|
||||||
func(arg);
|
func(arg);
|
||||||
bf = 20;
|
bf = 20;
|
||||||
}
|
}
|
||||||
#pragma omp target map(arg,a,d)
|
#pragma omp target map(arg,a,d,sref.b)
|
||||||
{}
|
{}
|
||||||
#pragma omp target map(arg[2:2],a,d) // expected-error {{subscripted value is not an array or pointer}}
|
#pragma omp target map(arg[2:2],a,d) // expected-error {{subscripted value is not an array or pointer}}
|
||||||
{}
|
{}
|
||||||
|
|
Loading…
Reference in New Issue