summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2015-09-30 09:22:36 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2015-09-30 09:22:36 +0000
commita176421da504153dcf7eec3cca9cefe10464ef49 (patch)
tree4b84b8686312a8f224cb79fa168a40533cf5e836 /clang/lib/Sema/SemaExpr.cpp
parent76e924d31be5783e370103c4afebb23153581df9 (diff)
downloadbcm5719-llvm-a176421da504153dcf7eec3cca9cefe10464ef49.tar.gz
bcm5719-llvm-a176421da504153dcf7eec3cca9cefe10464ef49.zip
[OPENMP 4.1] Sema analysis for array sections in 'reduction' clause.
OpenMP 4.1 allows to use array sections|subscript expressions in 'reduction' clauses. Added sema analysis, updated tests. llvm-svn: 248880
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp24
1 files changed, 1 insertions, 23 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 06b96aa0aca..90f3c7c16a5 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -3987,28 +3987,6 @@ Sema::ActOnArraySubscriptExpr(Scope *S, Expr *base, SourceLocation lbLoc,
return CreateBuiltinArraySubscriptExpr(base, lbLoc, idx, rbLoc);
}
-static QualType getNonOMPArraySectionType(Expr *Base) {
- unsigned ArraySectionCount = 0;
- while (auto *OASE = dyn_cast<OMPArraySectionExpr>(Base->IgnoreParens())) {
- Base = OASE->getBase();
- ++ArraySectionCount;
- }
- auto OriginalTy = Base->getType();
- if (auto *DRE = dyn_cast<DeclRefExpr>(Base))
- if (auto *PVD = dyn_cast<ParmVarDecl>(DRE->getDecl()))
- OriginalTy = PVD->getOriginalType().getNonReferenceType();
-
- for (unsigned Cnt = 0; Cnt < ArraySectionCount; ++Cnt) {
- if (OriginalTy->isAnyPointerType())
- OriginalTy = OriginalTy->getPointeeType();
- else {
- assert (OriginalTy->isArrayType());
- OriginalTy = OriginalTy->castAsArrayTypeUnsafe()->getElementType();
- }
- }
- return OriginalTy;
-}
-
ExprResult Sema::ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc,
Expr *LowerBound,
SourceLocation ColonLoc, Expr *Length,
@@ -4045,7 +4023,7 @@ ExprResult Sema::ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc,
}
// Perform default conversions.
- QualType OriginalTy = getNonOMPArraySectionType(Base);
+ QualType OriginalTy = OMPArraySectionExpr::getBaseOriginalType(Base);
QualType ResultTy;
if (OriginalTy->isAnyPointerType()) {
ResultTy = OriginalTy->getPointeeType();
OpenPOWER on IntegriCloud