summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CGOpenMPRuntime.cpp9
-rw-r--r--clang/lib/CodeGen/CGStmtOpenMP.cpp9
-rw-r--r--clang/lib/Sema/SemaOpenMP.cpp39
3 files changed, 3 insertions, 54 deletions
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index a8665254545..789302c8855 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -1289,9 +1289,6 @@ static llvm::Value *emitCopyprivateCopyFunction(
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()),
@@ -1671,9 +1668,6 @@ createPrivatesRecordDecl(CodeGenModule &CGM,
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);
}
@@ -1960,9 +1954,6 @@ void CGOpenMPRuntime::emitTaskCall(
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) ||
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index 4a4c06f7e1c..78412e47345 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -133,9 +133,6 @@ bool CodeGenFunction::EmitOMPFirstprivateClause(const OMPExecutableDirective &D,
(*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
@@ -229,9 +226,6 @@ bool CodeGenFunction::EmitOMPCopyinClause(const OMPExecutableDirective &D) {
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()
@@ -355,9 +349,6 @@ void CodeGenFunction::EmitOMPLastprivateClauseFinal(
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
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index c7d0c148ba0..ee6bdb21e55 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -505,9 +505,6 @@ DSAStackTy::DSAVarData DSAStackTy::getTopDSA(VarDecl *D, bool FromParent) {
}
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
@@ -664,9 +661,6 @@ void Sema::EndOpenMPDSABlock(Stmt *CurDirective) {
}
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
@@ -4761,9 +4755,6 @@ OMPClause *Sema::ActOnOpenMPPrivateClause(ArrayRef<Expr *> VarList,
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);
@@ -4805,7 +4796,7 @@ OMPClause *Sema::ActOnOpenMPPrivateClause(ArrayRef<Expr *> VarList,
}
// 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
@@ -4907,9 +4898,6 @@ OMPClause *Sema::ActOnOpenMPFirstprivateClause(ArrayRef<Expr *> VarList,
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);
@@ -5036,7 +5024,7 @@ OMPClause *Sema::ActOnOpenMPFirstprivateClause(ArrayRef<Expr *> VarList,
}
// 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
@@ -5143,9 +5131,6 @@ OMPClause *Sema::ActOnOpenMPLastprivateClause(ArrayRef<Expr *> VarList,
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);
@@ -5280,9 +5265,6 @@ OMPClause *Sema::ActOnOpenMPSharedClause(ArrayRef<Expr *> VarList,
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);
@@ -5492,9 +5474,6 @@ OMPClause *Sema::ActOnOpenMPReductionClause(
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.
@@ -5825,9 +5804,6 @@ OMPClause *Sema::ActOnOpenMPLinearClause(ArrayRef<Expr *> VarList, Expr *Step,
}
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);
@@ -6008,9 +5984,6 @@ OMPClause *Sema::ActOnOpenMPAlignedClause(
// 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() &&
@@ -6090,9 +6063,6 @@ OMPClause *Sema::ActOnOpenMPCopyinClause(ArrayRef<Expr *> VarList,
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);
@@ -6183,9 +6153,6 @@ OMPClause *Sema::ActOnOpenMPCopyprivateClause(ArrayRef<Expr *> VarList,
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);
@@ -6225,7 +6192,7 @@ OMPClause *Sema::ActOnOpenMPCopyprivateClause(ArrayRef<Expr *> VarList,
}
// 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());
OpenPOWER on IntegriCloud