summaryrefslogtreecommitdiffstats
path: root/lib/Sema/SemaOpenMP.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2014-07-17 07:32:53 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2014-07-17 07:32:53 +0000
commitff45f6913bdc201f4e36d54f38538672070c9eb3 (patch)
tree17e2ac5d93dc2048f0a1ec461fa552e4ad07f1df /lib/Sema/SemaOpenMP.cpp
parent01ee2dcc3034eca657a14a7af725026e1a7de939 (diff)
[OPENMP] Initial parsing and sema analysis for 'final' clause.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213232 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaOpenMP.cpp')
-rw-r--r--lib/Sema/SemaOpenMP.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/Sema/SemaOpenMP.cpp b/lib/Sema/SemaOpenMP.cpp
index 0dfec26692..58f9bbed6f 100644
--- a/lib/Sema/SemaOpenMP.cpp
+++ b/lib/Sema/SemaOpenMP.cpp
@@ -1992,6 +1992,9 @@ OMPClause *Sema::ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind, Expr *Expr,
case OMPC_if:
Res = ActOnOpenMPIfClause(Expr, StartLoc, LParenLoc, EndLoc);
break;
+ case OMPC_final:
+ Res = ActOnOpenMPFinalClause(Expr, StartLoc, LParenLoc, EndLoc);
+ break;
case OMPC_num_threads:
Res = ActOnOpenMPNumThreadsClause(Expr, StartLoc, LParenLoc, EndLoc);
break;
@@ -2040,6 +2043,25 @@ OMPClause *Sema::ActOnOpenMPIfClause(Expr *Condition, SourceLocation StartLoc,
return new (Context) OMPIfClause(ValExpr, StartLoc, LParenLoc, EndLoc);
}
+OMPClause *Sema::ActOnOpenMPFinalClause(Expr *Condition,
+ SourceLocation StartLoc,
+ SourceLocation LParenLoc,
+ SourceLocation EndLoc) {
+ Expr *ValExpr = Condition;
+ if (!Condition->isValueDependent() && !Condition->isTypeDependent() &&
+ !Condition->isInstantiationDependent() &&
+ !Condition->containsUnexpandedParameterPack()) {
+ ExprResult Val = ActOnBooleanCondition(DSAStack->getCurScope(),
+ Condition->getExprLoc(), Condition);
+ if (Val.isInvalid())
+ return nullptr;
+
+ ValExpr = Val.get();
+ }
+
+ return new (Context) OMPFinalClause(ValExpr, StartLoc, LParenLoc, EndLoc);
+}
+
ExprResult Sema::PerformOpenMPImplicitIntegerConversion(SourceLocation Loc,
Expr *Op) {
if (!Op)
@@ -2180,6 +2202,7 @@ OMPClause *Sema::ActOnOpenMPSimpleClause(
LParenLoc, EndLoc);
break;
case OMPC_if:
+ case OMPC_final:
case OMPC_num_threads:
case OMPC_safelen:
case OMPC_collapse:
@@ -2290,6 +2313,7 @@ OMPClause *Sema::ActOnOpenMPSingleExprWithArgClause(
LParenLoc, ArgumentLoc, CommaLoc, EndLoc);
break;
case OMPC_if:
+ case OMPC_final:
case OMPC_num_threads:
case OMPC_safelen:
case OMPC_collapse:
@@ -2381,6 +2405,7 @@ OMPClause *Sema::ActOnOpenMPClause(OpenMPClauseKind Kind,
Res = ActOnOpenMPNowaitClause(StartLoc, EndLoc);
break;
case OMPC_if:
+ case OMPC_final:
case OMPC_num_threads:
case OMPC_safelen:
case OMPC_collapse:
@@ -2451,6 +2476,7 @@ OMPClause *Sema::ActOnOpenMPVarListClause(
Res = ActOnOpenMPCopyprivateClause(VarList, StartLoc, LParenLoc, EndLoc);
break;
case OMPC_if:
+ case OMPC_final:
case OMPC_num_threads:
case OMPC_safelen:
case OMPC_collapse: