summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/StmtPrinter.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2016-02-29 05:54:20 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2016-02-29 05:54:20 +0000
commit60da77e4388c09f22e5dd0d56b9049c5ac5d5bf3 (patch)
tree92a52091fac47bd1c9cf6de3df8dbe89e6eac185 /clang/lib/AST/StmtPrinter.cpp
parentcd5855e3549eebbf2a22d31b37f36d223c4c7b62 (diff)
downloadbcm5719-llvm-60da77e4388c09f22e5dd0d56b9049c5ac5d5bf3.tar.gz
bcm5719-llvm-60da77e4388c09f22e5dd0d56b9049c5ac5d5bf3.zip
[OPENMP 4.5] Initial support for data members in 'reduction' clauses.
OpenMP 4.5 allows to privatize non-static data members of current class in non-static member functions. Patch adds initial parsing/semantic analysis for data members support in 'reduction' clauses. llvm-svn: 262199
Diffstat (limited to 'clang/lib/AST/StmtPrinter.cpp')
-rw-r--r--clang/lib/AST/StmtPrinter.cpp26
1 files changed, 8 insertions, 18 deletions
diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp
index 5013fa620eb..6938aef57ea 100644
--- a/clang/lib/AST/StmtPrinter.cpp
+++ b/clang/lib/AST/StmtPrinter.cpp
@@ -666,14 +666,7 @@ void OMPClausePrinter::VisitOMPScheduleClause(OMPScheduleClause *Node) {
OS << getOpenMPSimpleClauseTypeName(OMPC_schedule, Node->getScheduleKind());
if (auto *E = Node->getChunkSize()) {
OS << ", ";
- if (Node->getPreInitStmt()) {
- cast<OMPCapturedExprDecl>(
- cast<DeclRefExpr>(E->IgnoreImpCasts())->getDecl())
- ->getInit()
- ->IgnoreImpCasts()
- ->printPretty(OS, nullptr, Policy);
- } else
- E->printPretty(OS, nullptr, Policy);
+ E->printPretty(OS, nullptr, Policy);
}
OS << ")";
}
@@ -775,8 +768,8 @@ void OMPClausePrinter::VisitOMPClauseList(T *Node, char StartSym) {
assert(*I && "Expected non-null Stmt");
OS << (I == Node->varlist_begin() ? StartSym : ',');
if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(*I)) {
- if (auto *CED = dyn_cast<OMPCapturedExprDecl>(DRE->getDecl()))
- CED->getInit()->IgnoreImpCasts()->printPretty(OS, nullptr, Policy, 0);
+ if (isa<OMPCapturedExprDecl>(DRE->getDecl()))
+ DRE->printPretty(OS, nullptr, Policy, 0);
else
DRE->getDecl()->printQualifiedName(OS);
} else
@@ -924,14 +917,7 @@ void OMPClausePrinter::VisitOMPDistScheduleClause(OMPDistScheduleClause *Node) {
OMPC_dist_schedule, Node->getDistScheduleKind());
if (auto *E = Node->getChunkSize()) {
OS << ", ";
- if (Node->getPreInitStmt()) {
- cast<OMPCapturedExprDecl>(
- cast<DeclRefExpr>(E->IgnoreImpCasts())->getDecl())
- ->getInit()
- ->IgnoreImpCasts()
- ->printPretty(OS, nullptr, Policy);
- } else
- E->printPretty(OS, nullptr, Policy);
+ E->printPretty(OS, nullptr, Policy);
}
OS << ")";
}
@@ -1150,6 +1136,10 @@ void StmtPrinter::VisitOMPDistributeDirective(OMPDistributeDirective *Node) {
//===----------------------------------------------------------------------===//
void StmtPrinter::VisitDeclRefExpr(DeclRefExpr *Node) {
+ if (auto *OCED = dyn_cast<OMPCapturedExprDecl>(Node->getDecl())) {
+ OCED->getInit()->IgnoreImpCasts()->printPretty(OS, nullptr, Policy);
+ return;
+ }
if (NestedNameSpecifier *Qualifier = Node->getQualifier())
Qualifier->print(OS, Policy);
if (Node->hasTemplateKeyword())
OpenPOWER on IntegriCloud