summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOpenMP.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2019-04-04 17:28:22 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2019-04-04 17:28:22 +0000
commit0923266be59b04dd1af61b6d52ab32e5ced6a800 (patch)
tree3b9d5aaac64e07b96918c5e580ebe070502e8c14 /clang/lib/Sema/SemaOpenMP.cpp
parentf7461b8c5f65ac5a5ffc7c710afc21367ad74e92 (diff)
downloadbcm5719-llvm-0923266be59b04dd1af61b6d52ab32e5ced6a800.tar.gz
bcm5719-llvm-0923266be59b04dd1af61b6d52ab32e5ced6a800.zip
[OPENMP]Fix lookup of the user-defined reductions in C.
Fixed the regression of the lookup of user-defined reductions for C. llvm-svn: 357708
Diffstat (limited to 'clang/lib/Sema/SemaOpenMP.cpp')
-rw-r--r--clang/lib/Sema/SemaOpenMP.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 9a9bdfaaf5d..1ab0e0117f7 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -11269,17 +11269,18 @@ buildDeclareReductionRef(Sema &SemaRef, SourceLocation Loc, SourceRange Range,
}
}
// Perform ADL.
- if (SemaRef.getLangOpts().CPlusPlus) {
+ if (SemaRef.getLangOpts().CPlusPlus)
argumentDependentLookup(SemaRef, ReductionId, Loc, Ty, Lookups);
- if (auto *VD = filterLookupForUDReductionAndMapper<ValueDecl *>(
- Lookups, [&SemaRef, Ty](ValueDecl *D) -> ValueDecl * {
- if (!D->isInvalidDecl() &&
- SemaRef.Context.hasSameType(D->getType(), Ty))
- return D;
- return nullptr;
- }))
- return SemaRef.BuildDeclRefExpr(VD, VD->getType().getNonReferenceType(),
- VK_LValue, Loc);
+ if (auto *VD = filterLookupForUDReductionAndMapper<ValueDecl *>(
+ Lookups, [&SemaRef, Ty](ValueDecl *D) -> ValueDecl * {
+ if (!D->isInvalidDecl() &&
+ SemaRef.Context.hasSameType(D->getType(), Ty))
+ return D;
+ return nullptr;
+ }))
+ return SemaRef.BuildDeclRefExpr(VD, VD->getType().getNonReferenceType(),
+ VK_LValue, Loc);
+ if (SemaRef.getLangOpts().CPlusPlus) {
if (auto *VD = filterLookupForUDReductionAndMapper<ValueDecl *>(
Lookups, [&SemaRef, Ty, Loc](ValueDecl *D) -> ValueDecl * {
if (!D->isInvalidDecl() &&
@@ -11893,7 +11894,8 @@ static bool actOnOMPReductionKindClause(
S.ActOnUninitializedDecl(RHSVD);
if (RHSVD->isInvalidDecl())
continue;
- if (!RHSVD->hasInit() && DeclareReductionRef.isUnset()) {
+ if (!RHSVD->hasInit() &&
+ (DeclareReductionRef.isUnset() || !S.LangOpts.CPlusPlus)) {
S.Diag(ELoc, diag::err_omp_reduction_id_not_compatible)
<< Type << ReductionIdRange;
bool IsDecl = !VD || VD->isThisDeclarationADefinition(Context) ==
OpenPOWER on IntegriCloud