CGF.ConvertTypeForMem(C.getPointerType(SrcExprs[I]->getType())));
auto *VD = cast<DeclRefExpr>(CopyprivateVars[I])->getDecl();
QualType Type = VD->getType();
- if (auto *PVD = dyn_cast<ParmVarDecl>(VD)) {
- Type = PVD->getOriginalType();
- }
CGF.EmitOMPCopy(CGF, Type, DestAddr, SrcAddr,
cast<VarDecl>(cast<DeclRefExpr>(DestExprs[I])->getDecl()),
cast<VarDecl>(cast<DeclRefExpr>(SrcExprs[I])->getDecl()),
RD->startDefinition();
for (auto &&Pair : Privates) {
auto Type = Pair.second.Original->getType();
- if (auto *PVD = dyn_cast<ParmVarDecl>(Pair.second.Original)) {
- Type = PVD->getOriginalType();
- }
Type = Type.getNonReferenceType();
addFieldToRecordDecl(C, RD, Type);
}
auto SharedRefLValue =
CGF.EmitLValueForField(SharedsBase, SharedField);
QualType Type = OriginalVD->getType();
- if (auto *PVD = dyn_cast<ParmVarDecl>(OriginalVD)) {
- Type = PVD->getOriginalType();
- }
if (Type->isArrayType()) {
// Initialize firstprivate array.
if (!isa<CXXConstructExpr>(Init) ||
(*IRef)->getType(), VK_LValue, (*IRef)->getExprLoc());
auto *OriginalAddr = EmitLValue(&DRE).getAddress();
QualType Type = OrigVD->getType();
- if (auto *PVD = dyn_cast<ParmVarDecl>(OrigVD)) {
- Type = PVD->getOriginalType();
- }
if (Type->isArrayType()) {
// Emit VarDecl with copy init for arrays.
// Get the address of the original variable captured in current
for (auto *AssignOp : C->assignment_ops()) {
auto *VD = cast<VarDecl>(cast<DeclRefExpr>(*IRef)->getDecl());
QualType Type = VD->getType();
- if (auto *PVD = dyn_cast<ParmVarDecl>(VD)) {
- Type = PVD->getOriginalType();
- }
if (CopiedVars.insert(VD->getCanonicalDecl()).second) {
// Get the address of the master variable.
auto *MasterAddr = VD->isStaticLocal()
for (auto *AssignOp : C->assignment_ops()) {
auto *PrivateVD = cast<VarDecl>(cast<DeclRefExpr>(*IRef)->getDecl());
QualType Type = PrivateVD->getType();
- if (auto *PVD = dyn_cast<ParmVarDecl>(PrivateVD)) {
- Type = PVD->getOriginalType();
- }
auto *CanonicalVD = PrivateVD->getCanonicalDecl();
if (AlreadyEmittedVars.insert(CanonicalVD).second) {
// If lastprivate variable is a loop control variable for loop-based
}
QualType Type = D->getType().getNonReferenceType().getCanonicalType();
- if (auto *PVD = dyn_cast<ParmVarDecl>(D)) {
- Type = PVD->getOriginalType().getNonReferenceType().getCanonicalType();
- }
bool IsConstant = Type.isConstant(SemaRef.getASTContext());
Type = SemaRef.getASTContext().getBaseElementType(Type);
// OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
}
auto *VD = cast<VarDecl>(cast<DeclRefExpr>(DE)->getDecl());
QualType Type = VD->getType();
- if (auto *PVD = dyn_cast<ParmVarDecl>(VD)) {
- Type = PVD->getOriginalType();
- }
auto DVar = DSAStack->getTopDSA(VD, false);
if (DVar.CKind == OMPC_lastprivate) {
// Generate helper private variable and initialize it with the
VarDecl *VD = cast<VarDecl>(D);
QualType Type = VD->getType();
- if (auto *PVD = dyn_cast<ParmVarDecl>(VD)) {
- Type = PVD->getOriginalType();
- }
if (Type->isDependentType() || Type->isInstantiationDependentType()) {
// It will be analyzed later.
Vars.push_back(DE);
}
// Variably modified types are not supported for tasks.
- if (Type->isVariablyModifiedType() &&
+ if (!Type->isAnyPointerType() && Type->isVariablyModifiedType() &&
DSAStack->getCurrentDirective() == OMPD_task) {
Diag(ELoc, diag::err_omp_variably_modified_type_not_supported)
<< getOpenMPClauseName(OMPC_private) << Type
VarDecl *VD = cast<VarDecl>(D);
QualType Type = VD->getType();
- if (auto *PVD = dyn_cast<ParmVarDecl>(VD)) {
- Type = PVD->getOriginalType();
- }
if (Type->isDependentType() || Type->isInstantiationDependentType()) {
// It will be analyzed later.
Vars.push_back(DE);
}
// Variably modified types are not supported for tasks.
- if (Type->isVariablyModifiedType() &&
+ if (!Type->isAnyPointerType() && Type->isVariablyModifiedType() &&
DSAStack->getCurrentDirective() == OMPD_task) {
Diag(ELoc, diag::err_omp_variably_modified_type_not_supported)
<< getOpenMPClauseName(OMPC_firstprivate) << Type
VarDecl *VD = cast<VarDecl>(D);
QualType Type = VD->getType();
- if (auto *PVD = dyn_cast<ParmVarDecl>(VD)) {
- Type = PVD->getOriginalType();
- }
if (Type->isDependentType() || Type->isInstantiationDependentType()) {
// It will be analyzed later.
Vars.push_back(DE);
VarDecl *VD = cast<VarDecl>(D);
QualType Type = VD->getType();
- if (auto *PVD = dyn_cast<ParmVarDecl>(VD)) {
- Type = PVD->getOriginalType();
- }
if (Type->isDependentType() || Type->isInstantiationDependentType()) {
// It will be analyzed later.
Vars.push_back(DE);
auto D = DE->getDecl();
auto VD = cast<VarDecl>(D);
auto Type = VD->getType();
- if (auto *PVD = dyn_cast<ParmVarDecl>(VD)) {
- Type = PVD->getOriginalType();
- }
// OpenMP [2.9.3.3, Restrictions, C/C++, p.3]
// A variable that appears in a private clause must not have an incomplete
// type or a reference type.
}
QualType QType = VD->getType();
- if (auto *PVD = dyn_cast<ParmVarDecl>(VD)) {
- QType = PVD->getOriginalType();
- }
if (QType->isDependentType() || QType->isInstantiationDependentType()) {
// It will be analyzed later.
Vars.push_back(DE);
// The type of list items appearing in the aligned clause must be
// array, pointer, reference to array, or reference to pointer.
QualType QType = VD->getType();
- if (auto *PVD = dyn_cast<ParmVarDecl>(VD)) {
- QType = PVD->getOriginalType();
- }
QType = QType.getNonReferenceType().getUnqualifiedType().getCanonicalType();
const Type *Ty = QType.getTypePtrOrNull();
if (!Ty || (!Ty->isDependentType() && !Ty->isArrayType() &&
VarDecl *VD = cast<VarDecl>(D);
QualType Type = VD->getType();
- if (auto *PVD = dyn_cast<ParmVarDecl>(VD)) {
- Type = PVD->getOriginalType();
- }
if (Type->isDependentType() || Type->isInstantiationDependentType()) {
// It will be analyzed later.
Vars.push_back(DE);
VarDecl *VD = cast<VarDecl>(D);
QualType Type = VD->getType();
- if (auto *PVD = dyn_cast<ParmVarDecl>(VD)) {
- Type = PVD->getOriginalType();
- }
if (Type->isDependentType() || Type->isInstantiationDependentType()) {
// It will be analyzed later.
Vars.push_back(DE);
}
// Variably modified types are not supported.
- if (Type->isVariablyModifiedType()) {
+ if (!Type->isAnyPointerType() && Type->isVariablyModifiedType()) {
Diag(ELoc, diag::err_omp_variably_modified_type_not_supported)
<< getOpenMPClauseName(OMPC_copyprivate) << Type
<< getOpenMPDirectiveName(DSAStack->getCurrentDirective());
class S4 {
int a;
S4();
- S4(const S4 &s4); // expected-note 3 {{implicitly declared private here}}
+ S4(const S4 &s4); // expected-note 2 {{implicitly declared private here}}
public:
S4(int v) : a(v) {}
void bar(S4 a[2]) {
#pragma omp parallel
-#pragma omp for firstprivate(a) // expected-error {{calling a private constructor of class 'S4'}}
+#pragma omp for firstprivate(a)
for (int i = 0; i < 2; ++i)
foo();
}
extern const int f; // expected-note {{global variable is predetermined as shared}}
class S4 {
int a;
- S4(); // expected-note 4 {{implicitly declared private here}}
+ S4(); // expected-note 3 {{implicitly declared private here}}
S4(const S4 &s4);
public:
void bar(S4 a[2]) {
#pragma omp parallel
-#pragma omp for lastprivate(a) // expected-error {{calling a private constructor of class 'S4'}}
+#pragma omp for lastprivate(a)
for (int i = 0; i < 2; ++i)
foo();
}
const S3 ca[5];
class S4 {
int a;
- S4(); // expected-note 2 {{implicitly declared private here}}
+ S4(); // expected-note {{implicitly declared private here}}
public:
S4(int v) : a(v) {}
void bar(S4 a[2]) {
#pragma omp parallel
-#pragma omp for private(a) // expected-error {{calling a private constructor of class 'S4'}}
+#pragma omp for private(a)
for (int i = 0; i < 2; ++i)
foo();
}
~St() {}
};
-void array_func(int a[3], St s[2], int n, long double vla1[n]) {
+void array_func(float a[3], St s[2], int n, long double vla1[n]) {
double vla2[n];
// ARRAY: @__kmpc_fork_call(
-// ARRAY: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %{{.+}}, i8* %{{.+}}, i64 12, i32 4, i1 false)
-// ARRAY: call void @_ZN2StC1ERKS_(%struct.St* %{{.+}}, %struct.St* dereferenceable(8) %{{.+}}
+// ARRAY: [[PRIV_A:%.+]] = alloca float*
+// ARRAY: [[PRIV_S:%.+]] = alloca %struct.St*
+// ARRAY: [[PRIV_VLA1:%.+]] = alloca x86_fp80*
+// ARRAY: store float* %{{.+}}, float** [[PRIV_A]],
+// ARRAY: store %struct.St* %{{.+}}, %struct.St** [[PRIV_S]],
+// ARRAY: store x86_fp80* %{{.+}}, x86_fp80** [[PRIV_VLA1]],
// ARRAY: call i8* @llvm.stacksave()
-// ARRAY: [[SIZE:%.+]] = mul nuw i64 %{{.+}}, 16
-// ARRAY: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %{{.+}}, i8* %{{.+}}, i64 [[SIZE]], i32 16, i1 false)
// ARRAY: [[SIZE:%.+]] = mul nuw i64 %{{.+}}, 8
// ARRAY: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %{{.+}}, i8* %{{.+}}, i64 [[SIZE]], i32 8, i1 false)
// ARRAY: call void @llvm.stackrestore(i8*
-// ARRAY: call void @_ZN2StD1Ev(%struct.St* %{{.+}})
-// ARRAY: br i1
#pragma omp parallel firstprivate(a, s, vla1, vla2)
;
}
~St() {}
};
-void array_func(int a[3], St s[2]) {
+void array_func(int n, int a[n], St s[2]) {
// ARRAY: call void @__kmpc_copyprivate(%ident_t* @{{.+}}, i32 %{{.+}}, i64 16, i8* %{{.+}}, void (i8*, i8*)* [[CPY:@.+]], i32 %{{.+}})
#pragma omp single copyprivate(a, s)
;
}
// ARRAY: define internal void [[CPY]]
-// ARRAY: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %{{.+}}, i8* %{{.+}}, i64 12, i32 4, i1 false)
-// ARRAY: call dereferenceable(8) %struct.St* @_ZN2StaSERKS_(%struct.St* %{{.+}}, %struct.St* dereferenceable(8) %{{.+}})
+// ARRAY: store i32* %{{.+}}, i32** %{{.+}},
+// ARRAY: store %struct.St* %{{.+}}, %struct.St** %{{.+}},
#endif
class S4 {
int a;
S4();
- S4 &operator=(const S4 &s4); // expected-note 4 {{implicitly declared private here}}
+ S4 &operator=(const S4 &s4); // expected-note 3 {{implicitly declared private here}}
public:
S4(int v) : a(v) {}
return T();
}
-void bar(S4 a[2], int n, int b[n]) { // expected-note {{'b' defined here}}
-#pragma omp single copyprivate(a, b) // expected-error {{'operator=' is a private member of 'S4'}} expected-error {{arguments of OpenMP clause 'copyprivate' in '#pragma omp single' directive cannot be of variably-modified type 'int [n]'}}
+void bar(S4 a[2], int n, int b[n]) {
+#pragma omp single copyprivate(a, b)
foo();
}
~St() {}
};
-void array_func(int a[3], St s[2]) {
+void array_func(int n, float a[n], St s[2]) {
// ARRAY: call i8* @__kmpc_omp_task_alloc(
-// ARRAY: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %{{.+}}, i8* %{{.+}}, i64 12, i32 4, i1 false)
-// ARRAY: call void @_ZN2StC1ERKS_(%struct.St* %{{.+}}, %struct.St* dereferenceable(8) %{{.+}})
-// ARRAY: store i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[DESTRUCTORS:@.+]] to i32 (i32, i8*)*), i32 (i32, i8*)** %{{.+}},
+// ARRAY: store float** %{{.+}}, float*** %{{.+}},
+// ARRAY: store %struct.St** %{{.+}}, %struct.St*** %{{.+}},
// ARRAY: call i32 @__kmpc_omp_task(
-// ARRAY: define internal i32 [[DESTRUCTORS]](i32,
-// ARRAY: call void @_ZN2StD1Ev(%struct.St* %{{.+}})
-// ARRAY: br i1
#pragma omp task firstprivate(a, s)
;
}
S3 h;
#pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}}
-void bar(int n, int b[n]) { // expected-note {{'b' defined here}}
-#pragma omp task firstprivate(b) // expected-error {{arguments of OpenMP clause 'firstprivate' in '#pragma omp task' directive cannot be of variably-modified type 'int [n]'}}
+void bar(int n, int b[n]) {
+#pragma omp task firstprivate(b)
foo();
}
~St() {}
};
-void array_func(int a[2], St s[2]) {
+void array_func(int n, float a[n], St s[2]) {
// ARRAY: call i8* @__kmpc_omp_task_alloc(
-// ARRAY-NOT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %{{.+}}, i8* %{{.+}}, i64 12, i32 4, i1 false)
-// ARRAY: call void @_ZN2StC1Ev(%struct.St* %{{.+}})
-// ARRAY: store i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[DESTRUCTORS:@.+]] to i32 (i32, i8*)*), i32 (i32, i8*)** %{{.+}},
+// ARRAY: store float** %{{.+}}, float*** %{{.+}},
+// ARRAY: store %struct.St** %{{.+}}, %struct.St*** %{{.+}},
// ARRAY: call i32 @__kmpc_omp_task(
-// ARRAY: define internal i32 [[DESTRUCTORS]](i32,
-// ARRAY: call void @_ZN2StD1Ev(%struct.St* %{{.+}})
-// ARRAY: br i1
#pragma omp task private(a, s)
;
}
int threadvar;
#pragma omp threadprivate(threadvar) // expected-note {{defined as threadprivate or thread local}}
-void bar(int n, int b[n]) { // expected-note {{'b' defined here}}
-#pragma omp task private(b) // expected-error {{arguments of OpenMP clause 'private' in '#pragma omp task' directive cannot be of variably-modified type 'int [n]'}}
+void bar(int n, int b[n]) {
+#pragma omp task private(b)
foo();
}