Skip to content

Commit

Permalink
In this release label is ignored and reduction throws an error
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaoP committed Jun 18, 2020
1 parent 09b1d65 commit 0edf7f0
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
2 changes: 2 additions & 0 deletions clang/include/clang/Basic/DiagnosticParseKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,8 @@ def err_openclcxx_virtual_function : Error<
"virtual functions are not supported in C++ for OpenCL">;

// OmpSs support.
def warn_oss_ignoring_clause : Warning<
"unsupported OmpSs-2 clause '%0' in directive '#pragma oss %1' - ignoring">;
def warn_pragma_oss_ignored : Warning<
"unexpected '#pragma oss ...' in program">, InGroup<SourceUsesOmpSs>, DefaultIgnore;
def err_oss_unexpected_directive : Error<
Expand Down
4 changes: 2 additions & 2 deletions clang/include/clang/Basic/OmpSsKinds.def
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ OMPSS_TASK_CLAUSE(private)
OMPSS_TASK_CLAUSE(firstprivate)
OMPSS_TASK_CLAUSE(shared)
OMPSS_TASK_CLAUSE(depend)
OMPSS_TASK_CLAUSE(reduction)
// OMPSS_TASK_CLAUSE(reduction)
OMPSS_TASK_CLAUSE(in)
OMPSS_TASK_CLAUSE(out)
OMPSS_TASK_CLAUSE(inout)
Expand All @@ -110,7 +110,7 @@ OMPSS_TASK_CLAUSE(weakin)
OMPSS_TASK_CLAUSE(weakout)
OMPSS_TASK_CLAUSE(weakinout)
OMPSS_TASK_CLAUSE(weakcommutative)
OMPSS_TASK_CLAUSE(weakreduction)
// OMPSS_TASK_CLAUSE(weakreduction)

// Clauses allowed for OmpSs directive 'taskwait'.
OMPSS_TASKWAIT_CLAUSE(depend)
Expand Down
1 change: 1 addition & 0 deletions clang/include/clang/Parse/Parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ class Parser : public CodeCompletionHandler {
const TargetInfo &getTargetInfo() const { return PP.getTargetInfo(); }
Preprocessor &getPreprocessor() const { return PP; }
Sema &getActions() const { return Actions; }
DiagnosticsEngine &getDiags() const { return Diags; }
AttributeFactory &getAttrFactory() { return AttrFactory; }

const Token &getCurToken() const { return Tok; }
Expand Down
23 changes: 19 additions & 4 deletions clang/lib/Parse/ParseOmpSs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,12 @@ static bool parseDeclareTaskClauses(
case OSSC_priority:
case OSSC_label: {
P.ConsumeToken();
if (FirstClauses[CKind]) {
bool IsLabel = CKind == OSSC_label;
if (IsLabel) {
P.Diag(Tok, diag::warn_oss_ignoring_clause)
<< getOmpSsClauseName(CKind) << getOmpSsDirectiveName(OSSD_declare_task);
}
if (FirstClauses[CKind] && !IsLabel) {
P.Diag(Tok, diag::err_oss_more_one_clause)
<< getOmpSsDirectiveName(OSSD_declare_task) << getOmpSsClauseName(CKind) << 0;
IsError = true;
Expand All @@ -282,9 +287,11 @@ static bool parseDeclareTaskClauses(
SingleClause = getSingleClause(CKind, IfRes, FinalRes,
CostRes, PriorityRes,
LabelRes);
P.getDiags().setSuppressAllDiagnostics(IsLabel);
*SingleClause = P.ParseOmpSsParensExpr(getOmpSsClauseName(CKind), RLoc);
P.getDiags().setSuppressAllDiagnostics(false);

if (SingleClause->isInvalid())
if (SingleClause->isInvalid() && !IsLabel)
IsError = true;

FirstClauses[CKind] = true;
Expand Down Expand Up @@ -714,14 +721,22 @@ OSSClause *Parser::ParseOmpSsClause(OmpSsDirectiveKind DKind,
case OSSC_final:
case OSSC_cost:
case OSSC_priority:
case OSSC_label:
if (!FirstClause) {
case OSSC_label: {
bool IsLabel = CKind == OSSC_label;
if (IsLabel) {
Diag(Tok, diag::warn_oss_ignoring_clause)
<< getOmpSsClauseName(CKind) << getOmpSsDirectiveName(OSSD_task);
}
if (!FirstClause && !IsLabel) {
Diag(Tok, diag::err_oss_more_one_clause)
<< getOmpSsDirectiveName(DKind) << getOmpSsClauseName(CKind) << 0;
ErrorFound = true;
}
Diags.setSuppressAllDiagnostics(IsLabel);
Clause = ParseOmpSsSingleExprClause(CKind, WrongDirective);
Diags.setSuppressAllDiagnostics(false);
break;
}
case OSSC_wait:
if (!FirstClause) {
Diag(Tok, diag::err_oss_more_one_clause)
Expand Down

0 comments on commit 0edf7f0

Please sign in to comment.