summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Expr.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/AST/Expr.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/AST/Expr.cpp')
-rw-r--r--clang/lib/AST/Expr.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 14f55434776..ccaeeab6159 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -3977,3 +3977,26 @@ unsigned AtomicExpr::getNumSubExprs(AtomicOp Op) {
}
llvm_unreachable("unknown atomic op");
}
+
+QualType OMPArraySectionExpr::getBaseOriginalType(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;
+}
+
OpenPOWER on IntegriCloud