[OPENMP5.1] Initial support for message clause.
This commit is contained in:
parent
96c037ef9c
commit
9d90cf2fca
|
@ -1722,6 +1722,72 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
/// This represents 'message' clause in the '#pragma omp error' directive
|
||||
///
|
||||
/// \code
|
||||
/// #pragma omp error message("GNU compiler required.")
|
||||
/// \endcode
|
||||
/// In this example directive '#pragma omp error' has simple
|
||||
/// 'message' clause with user error message of "GNU compiler required.".
|
||||
class OMPMessageClause final : public OMPClause {
|
||||
friend class OMPClauseReader;
|
||||
|
||||
/// Location of '('
|
||||
SourceLocation LParenLoc;
|
||||
|
||||
// Expression of the 'message' clause.
|
||||
Stmt *MessageString = nullptr;
|
||||
|
||||
/// Set message string of the clause.
|
||||
void setMessageString(Expr *MS) { MessageString = MS; }
|
||||
|
||||
/// Sets the location of '('.
|
||||
void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
|
||||
|
||||
public:
|
||||
/// Build 'message' clause with message string argument
|
||||
///
|
||||
/// \param A Argument of the clause (message string).
|
||||
/// \param StartLoc Starting location of the clause.
|
||||
/// \param LParenLoc Location of '('.
|
||||
/// \param EndLoc Ending location of the clause.
|
||||
OMPMessageClause(Expr *MS, SourceLocation StartLoc, SourceLocation LParenLoc,
|
||||
SourceLocation EndLoc)
|
||||
: OMPClause(llvm::omp::OMPC_message, StartLoc, EndLoc),
|
||||
LParenLoc(LParenLoc), MessageString(MS) {}
|
||||
|
||||
/// Build an empty clause.
|
||||
OMPMessageClause()
|
||||
: OMPClause(llvm::omp::OMPC_message, SourceLocation(), SourceLocation()) {
|
||||
}
|
||||
|
||||
/// Returns the locaiton of '('.
|
||||
SourceLocation getLParenLoc() const { return LParenLoc; }
|
||||
|
||||
/// Returns message string of the clause.
|
||||
Expr *getMessageString() const { return cast_or_null<Expr>(MessageString); }
|
||||
|
||||
child_range children() {
|
||||
return child_range(&MessageString, &MessageString + 1);
|
||||
}
|
||||
|
||||
const_child_range children() const {
|
||||
return const_child_range(&MessageString, &MessageString + 1);
|
||||
}
|
||||
|
||||
child_range used_children() {
|
||||
return child_range(child_iterator(), child_iterator());
|
||||
}
|
||||
|
||||
const_child_range used_children() const {
|
||||
return const_child_range(const_child_iterator(), const_child_iterator());
|
||||
}
|
||||
|
||||
static bool classof(const OMPClause *T) {
|
||||
return T->getClauseKind() == llvm::omp::OMPC_message;
|
||||
}
|
||||
};
|
||||
|
||||
/// This represents 'schedule' clause in the '#pragma omp ...' directive.
|
||||
///
|
||||
/// \code
|
||||
|
|
|
@ -3320,6 +3320,12 @@ bool RecursiveASTVisitor<Derived>::VisitOMPSeverityClause(OMPSeverityClause *) {
|
|||
return true;
|
||||
}
|
||||
|
||||
template <typename Derived>
|
||||
bool RecursiveASTVisitor<Derived>::VisitOMPMessageClause(OMPMessageClause *C) {
|
||||
TRY_TO(TraverseStmt(C->getMessageString()));
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename Derived>
|
||||
bool
|
||||
RecursiveASTVisitor<Derived>::VisitOMPScheduleClause(OMPScheduleClause *C) {
|
||||
|
|
|
@ -1342,6 +1342,8 @@ def err_omp_unexpected_directive : Error<
|
|||
"unexpected OpenMP directive %select{|'#pragma omp %1'}0">;
|
||||
def err_omp_expected_punc : Error<
|
||||
"expected ',' or ')' in '%0' %select{clause|directive}1">;
|
||||
def warn_clause_expected_string : Warning<
|
||||
"expected string literal in 'clause %0' - ignoring">, InGroup<IgnoredPragmas>;
|
||||
def err_omp_unexpected_clause : Error<
|
||||
"unexpected OpenMP clause '%0' in directive '#pragma omp %1'">;
|
||||
def err_omp_immediate_directive : Error<
|
||||
|
|
|
@ -11862,6 +11862,12 @@ public:
|
|||
SourceLocation LParenLoc,
|
||||
SourceLocation EndLoc);
|
||||
|
||||
/// Called on well-formed 'message' clause.
|
||||
/// passing string for message.
|
||||
OMPClause *ActOnOpenMPMessageClause(Expr *MS, SourceLocation StartLoc,
|
||||
SourceLocation LParenLoc,
|
||||
SourceLocation EndLoc);
|
||||
|
||||
/// Data used for processing a list of variables in OpenMP clauses.
|
||||
struct OpenMPVarListDataTy final {
|
||||
Expr *DepModOrTailExpr = nullptr;
|
||||
|
|
|
@ -154,6 +154,7 @@ const OMPClauseWithPreInit *OMPClauseWithPreInit::get(const OMPClause *C) {
|
|||
case OMPC_atomic_default_mem_order:
|
||||
case OMPC_at:
|
||||
case OMPC_severity:
|
||||
case OMPC_message:
|
||||
case OMPC_device_type:
|
||||
case OMPC_match:
|
||||
case OMPC_nontemporal:
|
||||
|
@ -255,6 +256,7 @@ const OMPClauseWithPostUpdate *OMPClauseWithPostUpdate::get(const OMPClause *C)
|
|||
case OMPC_atomic_default_mem_order:
|
||||
case OMPC_at:
|
||||
case OMPC_severity:
|
||||
case OMPC_message:
|
||||
case OMPC_device_type:
|
||||
case OMPC_match:
|
||||
case OMPC_nontemporal:
|
||||
|
@ -1796,6 +1798,11 @@ void OMPClausePrinter::VisitOMPSeverityClause(OMPSeverityClause *Node) {
|
|||
<< ")";
|
||||
}
|
||||
|
||||
void OMPClausePrinter::VisitOMPMessageClause(OMPMessageClause *Node) {
|
||||
OS << "message(\""
|
||||
<< cast<StringLiteral>(Node->getMessageString())->getString() << "\")";
|
||||
}
|
||||
|
||||
void OMPClausePrinter::VisitOMPScheduleClause(OMPScheduleClause *Node) {
|
||||
OS << "schedule(";
|
||||
if (Node->getFirstScheduleModifier() != OMPC_SCHEDULE_MODIFIER_unknown) {
|
||||
|
|
|
@ -534,6 +534,11 @@ void OMPClauseProfiler::VisitOMPAtClause(const OMPAtClause *C) {}
|
|||
|
||||
void OMPClauseProfiler::VisitOMPSeverityClause(const OMPSeverityClause *C) {}
|
||||
|
||||
void OMPClauseProfiler::VisitOMPMessageClause(const OMPMessageClause *C) {
|
||||
if (C->getMessageString())
|
||||
Profiler->VisitStmt(C->getMessageString());
|
||||
}
|
||||
|
||||
void OMPClauseProfiler::VisitOMPScheduleClause(const OMPScheduleClause *C) {
|
||||
VistOMPClauseWithPreInit(C);
|
||||
if (auto *S = C->getChunkSize())
|
||||
|
|
|
@ -6514,6 +6514,7 @@ static void emitOMPAtomicExpr(CodeGenFunction &CGF, OpenMPClauseKind Kind,
|
|||
case OMPC_atomic_default_mem_order:
|
||||
case OMPC_at:
|
||||
case OMPC_severity:
|
||||
case OMPC_message:
|
||||
case OMPC_device_type:
|
||||
case OMPC_match:
|
||||
case OMPC_nontemporal:
|
||||
|
|
|
@ -3192,6 +3192,7 @@ OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind DKind,
|
|||
case OMPC_filter:
|
||||
case OMPC_partial:
|
||||
case OMPC_align:
|
||||
case OMPC_message:
|
||||
// OpenMP [2.5, Restrictions]
|
||||
// At most one num_threads clause can appear on the directive.
|
||||
// OpenMP [2.8.1, simd construct, Restrictions]
|
||||
|
@ -3217,6 +3218,8 @@ OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind DKind,
|
|||
// OpenMP 5.1, 2.3.6 dispatch Construct, Restrictions.
|
||||
// At most one novariants clause can appear on a dispatch directive.
|
||||
// At most one nocontext clause can appear on a dispatch directive.
|
||||
// OpenMP [5.1, error directive, Restrictions]
|
||||
// At most one message clause can appear on the directive
|
||||
if (!FirstClause) {
|
||||
Diag(Tok, diag::err_omp_more_one_clause)
|
||||
<< getOpenMPDirectiveName(DKind) << getOpenMPClauseName(CKind) << 0;
|
||||
|
|
|
@ -6721,6 +6721,7 @@ StmtResult Sema::ActOnOpenMPExecutableDirective(
|
|||
case OMPC_when:
|
||||
case OMPC_at:
|
||||
case OMPC_severity:
|
||||
case OMPC_message:
|
||||
default:
|
||||
llvm_unreachable("Unexpected clause");
|
||||
}
|
||||
|
@ -11032,25 +11033,27 @@ StmtResult Sema::ActOnOpenMPErrorDirective(ArrayRef<OMPClause *> Clauses,
|
|||
SourceLocation StartLoc,
|
||||
SourceLocation EndLoc,
|
||||
bool InExContext) {
|
||||
auto AtClauses =
|
||||
OMPExecutableDirective::getClausesOfKind<OMPAtClause>(Clauses);
|
||||
const OMPAtClause *AtC = AtClauses.empty() ? nullptr : (*AtClauses.begin());
|
||||
const OMPAtClause *AtC =
|
||||
OMPExecutableDirective::getSingleClause<OMPAtClause>(Clauses);
|
||||
|
||||
if (AtC && !InExContext && AtC->getAtKind() == OMPC_AT_execution) {
|
||||
Diag(AtC->getAtKindKwLoc(), diag::err_omp_unexpected_execution_modifier);
|
||||
return StmtError();
|
||||
}
|
||||
auto SeverityClauses =
|
||||
OMPExecutableDirective::getClausesOfKind<OMPSeverityClause>(Clauses);
|
||||
|
||||
const OMPSeverityClause *SeverityC =
|
||||
SeverityClauses.empty() ? nullptr : (*SeverityClauses.begin());
|
||||
OMPExecutableDirective::getSingleClause<OMPSeverityClause>(Clauses);
|
||||
const OMPMessageClause *MessageC =
|
||||
OMPExecutableDirective::getSingleClause<OMPMessageClause>(Clauses);
|
||||
Expr *ME = MessageC ? MessageC->getMessageString() : nullptr;
|
||||
|
||||
if (!AtC || AtC->getAtKind() == OMPC_AT_compilation) {
|
||||
if (SeverityC && SeverityC->getSeverityKind() == OMPC_SEVERITY_warning)
|
||||
Diag(SeverityC->getSeverityKindKwLoc(), diag::warn_diagnose_if_succeeded)
|
||||
<< "WARNING";
|
||||
<< (ME ? cast<StringLiteral>(ME)->getString() : "WARNING");
|
||||
else
|
||||
Diag(StartLoc, diag::err_diagnose_if_succeeded) << "ERROR";
|
||||
Diag(StartLoc, diag::err_diagnose_if_succeeded)
|
||||
<< (ME ? cast<StringLiteral>(ME)->getString() : "ERROR");
|
||||
if (!SeverityC || SeverityC->getSeverityKind() != OMPC_SEVERITY_warning)
|
||||
return StmtError();
|
||||
}
|
||||
|
@ -15131,6 +15134,9 @@ OMPClause *Sema::ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind, Expr *Expr,
|
|||
case OMPC_partial:
|
||||
Res = ActOnOpenMPPartialClause(Expr, StartLoc, LParenLoc, EndLoc);
|
||||
break;
|
||||
case OMPC_message:
|
||||
Res = ActOnOpenMPMessageClause(Expr, StartLoc, LParenLoc, EndLoc);
|
||||
break;
|
||||
case OMPC_align:
|
||||
Res = ActOnOpenMPAlignClause(Expr, StartLoc, LParenLoc, EndLoc);
|
||||
break;
|
||||
|
@ -16121,6 +16127,7 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause(
|
|||
case OMPC_order:
|
||||
case OMPC_at:
|
||||
case OMPC_severity:
|
||||
case OMPC_message:
|
||||
case OMPC_destroy:
|
||||
case OMPC_detach:
|
||||
case OMPC_inclusive:
|
||||
|
@ -16607,6 +16614,7 @@ OMPClause *Sema::ActOnOpenMPSimpleClause(
|
|||
case OMPC_uses_allocators:
|
||||
case OMPC_affinity:
|
||||
case OMPC_when:
|
||||
case OMPC_message:
|
||||
default:
|
||||
llvm_unreachable("Clause is not allowed.");
|
||||
}
|
||||
|
@ -16742,6 +16750,18 @@ OMPClause *Sema::ActOnOpenMPSeverityClause(OpenMPSeverityClauseKind Kind,
|
|||
OMPSeverityClause(Kind, KindKwLoc, StartLoc, LParenLoc, EndLoc);
|
||||
}
|
||||
|
||||
OMPClause *Sema::ActOnOpenMPMessageClause(Expr *ME, SourceLocation StartLoc,
|
||||
SourceLocation LParenLoc,
|
||||
SourceLocation EndLoc) {
|
||||
assert(ME && "NULL expr in Message clause");
|
||||
if (!isa<StringLiteral>(ME)) {
|
||||
Diag(ME->getBeginLoc(), diag::warn_clause_expected_string)
|
||||
<< getOpenMPClauseName(OMPC_message);
|
||||
return nullptr;
|
||||
}
|
||||
return new (Context) OMPMessageClause(ME, StartLoc, LParenLoc, EndLoc);
|
||||
}
|
||||
|
||||
OMPClause *Sema::ActOnOpenMPOrderClause(OpenMPOrderClauseKind Kind,
|
||||
SourceLocation KindKwLoc,
|
||||
SourceLocation StartLoc,
|
||||
|
@ -16955,6 +16975,7 @@ OMPClause *Sema::ActOnOpenMPSingleExprWithArgClause(
|
|||
case OMPC_order:
|
||||
case OMPC_at:
|
||||
case OMPC_severity:
|
||||
case OMPC_message:
|
||||
case OMPC_destroy:
|
||||
case OMPC_novariants:
|
||||
case OMPC_nocontext:
|
||||
|
@ -17213,6 +17234,7 @@ OMPClause *Sema::ActOnOpenMPClause(OpenMPClauseKind Kind,
|
|||
case OMPC_order:
|
||||
case OMPC_at:
|
||||
case OMPC_severity:
|
||||
case OMPC_message:
|
||||
case OMPC_novariants:
|
||||
case OMPC_nocontext:
|
||||
case OMPC_detach:
|
||||
|
@ -17769,6 +17791,7 @@ OMPClause *Sema::ActOnOpenMPVarListClause(OpenMPClauseKind Kind,
|
|||
case OMPC_order:
|
||||
case OMPC_at:
|
||||
case OMPC_severity:
|
||||
case OMPC_message:
|
||||
case OMPC_destroy:
|
||||
case OMPC_novariants:
|
||||
case OMPC_nocontext:
|
||||
|
|
|
@ -2380,6 +2380,16 @@ public:
|
|||
EndLoc);
|
||||
}
|
||||
|
||||
/// Build a new OpenMP 'message' clause.
|
||||
///
|
||||
/// By default, performs semantic analysis to build the new OpenMP clause.
|
||||
/// Subclasses may override this routine to provide different behavior.
|
||||
OMPClause *RebuildOMPMessageClause(Expr *MS, SourceLocation StartLoc,
|
||||
SourceLocation LParenLoc,
|
||||
SourceLocation EndLoc) {
|
||||
return getSema().ActOnOpenMPMessageClause(MS, StartLoc, LParenLoc, EndLoc);
|
||||
}
|
||||
|
||||
/// Rebuild the operand to an Objective-C \@synchronized statement.
|
||||
///
|
||||
/// By default, performs semantic analysis to build the new statement.
|
||||
|
@ -9899,6 +9909,17 @@ TreeTransform<Derived>::TransformOMPSeverityClause(OMPSeverityClause *C) {
|
|||
C->getLParenLoc(), C->getEndLoc());
|
||||
}
|
||||
|
||||
template <typename Derived>
|
||||
OMPClause *
|
||||
TreeTransform<Derived>::TransformOMPMessageClause(OMPMessageClause *C) {
|
||||
ExprResult E = getDerived().TransformExpr(C->getMessageString());
|
||||
if (E.isInvalid())
|
||||
return nullptr;
|
||||
return getDerived().RebuildOMPMessageClause(
|
||||
C->getMessageString(), C->getBeginLoc(), C->getLParenLoc(),
|
||||
C->getEndLoc());
|
||||
}
|
||||
|
||||
template <typename Derived>
|
||||
OMPClause *
|
||||
TreeTransform<Derived>::TransformOMPPrivateClause(OMPPrivateClause *C) {
|
||||
|
|
|
@ -9955,6 +9955,9 @@ OMPClause *OMPClauseReader::readClause() {
|
|||
case llvm::omp::OMPC_severity:
|
||||
C = new (Context) OMPSeverityClause();
|
||||
break;
|
||||
case llvm::omp::OMPC_message:
|
||||
C = new (Context) OMPMessageClause();
|
||||
break;
|
||||
case llvm::omp::OMPC_private:
|
||||
C = OMPPrivateClause::CreateEmpty(Context, Record.readInt());
|
||||
break;
|
||||
|
@ -10369,6 +10372,11 @@ void OMPClauseReader::VisitOMPSeverityClause(OMPSeverityClause *C) {
|
|||
C->setSeverityKindKwLoc(Record.readSourceLocation());
|
||||
}
|
||||
|
||||
void OMPClauseReader::VisitOMPMessageClause(OMPMessageClause *C) {
|
||||
C->setMessageString(Record.readSubExpr());
|
||||
C->setLParenLoc(Record.readSourceLocation());
|
||||
}
|
||||
|
||||
void OMPClauseReader::VisitOMPPrivateClause(OMPPrivateClause *C) {
|
||||
C->setLParenLoc(Record.readSourceLocation());
|
||||
unsigned NumVars = C->varlist_size();
|
||||
|
|
|
@ -7000,6 +7000,11 @@ void OMPClauseWriter::VisitOMPSeverityClause(OMPSeverityClause *C) {
|
|||
Record.AddSourceLocation(C->getSeverityKindKwLoc());
|
||||
}
|
||||
|
||||
void OMPClauseWriter::VisitOMPMessageClause(OMPMessageClause *C) {
|
||||
Record.AddStmt(C->getMessageString());
|
||||
Record.AddSourceLocation(C->getLParenLoc());
|
||||
}
|
||||
|
||||
void OMPClauseWriter::VisitOMPNontemporalClause(OMPNontemporalClause *C) {
|
||||
Record.push_back(C->varlist_size());
|
||||
Record.AddSourceLocation(C->getLParenLoc());
|
||||
|
|
|
@ -13,16 +13,16 @@
|
|||
void foo() {}
|
||||
// CHECK: template <typename T, int N> int tmain(T argc, char **argv)
|
||||
// CHECK: static int a;
|
||||
// CHECK-NEXT: #pragma omp error at(execution) severity(fatal)
|
||||
// CHECK-NEXT: #pragma omp error at(execution) severity(fatal) message("GNU compiler required.")
|
||||
// CHECK-NEXT: a = argv[0][0];
|
||||
// CHECK-NEXT: ++a;
|
||||
// CHECK-NEXT: #pragma omp error at(execution) severity(warning)
|
||||
// CHECK-NEXT: #pragma omp error at(execution) severity(warning) message("Notice: add for loop.")
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: int b = 10;
|
||||
// CHECK-NEXT: T c = 100;
|
||||
// CHECK-NEXT: a = b + c;
|
||||
// CHECK-NEXT: }
|
||||
// CHECK-NEXT: #pragma omp error at(execution) severity(fatal)
|
||||
// CHECK-NEXT: #pragma omp error at(execution) severity(fatal) message("GPU compiler required.")
|
||||
// CHECK-NEXT: foo();
|
||||
// CHECK-NEXT: return N;
|
||||
|
||||
|
@ -30,16 +30,16 @@ template <typename T, int N>
|
|||
int tmain(T argc, char **argv) {
|
||||
T b = argc, c, d, e, f, g;
|
||||
static int a;
|
||||
#pragma omp error at(execution) severity(fatal)
|
||||
#pragma omp error at(execution) severity(fatal) message("GNU compiler required.")
|
||||
a = argv[0][0];
|
||||
++a;
|
||||
#pragma omp error at(execution) severity(warning)
|
||||
#pragma omp error at(execution) severity(warning) message("Notice: add for loop.")
|
||||
{
|
||||
int b = 10;
|
||||
T c = 100;
|
||||
a = b + c;
|
||||
}
|
||||
#pragma omp error at(execution) severity(fatal)
|
||||
#pragma omp error at(execution) severity(fatal) message("GPU compiler required.")
|
||||
foo();
|
||||
return N;
|
||||
}
|
||||
|
@ -47,16 +47,16 @@ return N;
|
|||
// CHECK: int main(int argc, char **argv)
|
||||
// CHECK-NEXT: int b = argc, c, d, e, f, g;
|
||||
// CHECK-NEXT: static int a;
|
||||
// CHECK-NEXT: #pragma omp error at(execution) severity(fatal)
|
||||
// CHECK-NEXT: #pragma omp error at(execution) severity(fatal) message("GPU compiler required.")
|
||||
// CHECK-NEXT: a = 2;
|
||||
// CHECK-NEXT: #pragma omp error at(execution) severity(warning)
|
||||
// CHECK-NEXT: #pragma omp error at(execution) severity(warning) message("Note this is functioncall.")
|
||||
// CHECK-NEXT: foo();
|
||||
int main (int argc, char **argv) {
|
||||
int b = argc, c, d, e, f, g;
|
||||
static int a;
|
||||
#pragma omp error at(execution) severity(fatal)
|
||||
#pragma omp error at(execution) severity(fatal) message("GPU compiler required.")
|
||||
a=2;
|
||||
#pragma omp error at(execution) severity(warning)
|
||||
#pragma omp error at(execution) severity(warning) message("Note this is functioncall.")
|
||||
foo();
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -94,6 +94,26 @@ if (1)
|
|||
#pragma omp error at(execution) severity(warning) // no error, diagnosic at runtime
|
||||
#pragma omp error at(compilation) severity(fatal) // expected-error {{ERROR}}
|
||||
#pragma omp error at(execution) severity(fatal) // no error, error at runtime
|
||||
|
||||
#pragma omp error message("GPU compiler is needed.") // expected-error {{GPU compiler is needed}}
|
||||
#pragma omp error at(compilation) message("GPU compiler is needed.") // expected-error {{GPU compiler is needed}}
|
||||
#pragma omp error at(execution) message("GPU compiler is needed.") // no error
|
||||
// expected-warning@+1 {{GPU compiler is needed.}}
|
||||
#pragma omp error severity(warning) message("GPU compiler is needed.") // expected-warning {{GPU compiler is needed.}}
|
||||
#pragma omp error severity(fatal) message("GPU compiler is needed.") // expected-error {{GPU compiler is needed}}
|
||||
// expected-warning@+1 {{GPU compiler is needed.}}
|
||||
#pragma omp error at(compilation) severity(warning) message("GPU compiler is needed.") // expected-warning {{GPU compiler is needed.}}
|
||||
#pragma omp error at(compilation) severity(fatal) message("GPU compiler is needed.") // expected-error {{GPU compiler is needed.}}
|
||||
#pragma omp error at(execution) severity(warning) message("GPU compiler is needed.") // no warning warning will emit at runtime.
|
||||
#pragma omp error at(execution) severity(fatal) message("GPU compiler is needed.") // no warning warning will emit at runtime.
|
||||
|
||||
// expected-error@+1 {{GPU compiler is needed.}}
|
||||
#pragma omp error message("GPU compiler is needed.") message("GPU compiler is needed.") // expected-error {{directive '#pragma omp error' cannot contain more than one 'message' clause}}
|
||||
int a;
|
||||
// expected-warning@+1 {{expected string literal in 'clause message' - ignoring}}
|
||||
#pragma omp error message(a) // expected-error {{ERROR}}
|
||||
// expected-error@+1 {{ERROR}}
|
||||
#pragma omp error message() // expected-error {{expected expression}}
|
||||
return T();
|
||||
}
|
||||
|
||||
|
|
|
@ -2447,6 +2447,8 @@ void OMPClauseEnqueue::VisitOMPAtClause(const OMPAtClause *) {}
|
|||
|
||||
void OMPClauseEnqueue::VisitOMPSeverityClause(const OMPSeverityClause *) {}
|
||||
|
||||
void OMPClauseEnqueue::VisitOMPMessageClause(const OMPMessageClause *) {}
|
||||
|
||||
void OMPClauseEnqueue::VisitOMPDeviceClause(const OMPDeviceClause *C) {
|
||||
Visitor->AddStmt(C->getDevice());
|
||||
}
|
||||
|
|
|
@ -1870,6 +1870,7 @@ CHECK_SIMPLE_CLAUSE(Novariants, OMPC_novariants)
|
|||
CHECK_SIMPLE_CLAUSE(Nocontext, OMPC_nocontext)
|
||||
CHECK_SIMPLE_CLAUSE(At, OMPC_at)
|
||||
CHECK_SIMPLE_CLAUSE(Severity, OMPC_severity)
|
||||
CHECK_SIMPLE_CLAUSE(Message, OMPC_message)
|
||||
CHECK_SIMPLE_CLAUSE(Filter, OMPC_filter)
|
||||
CHECK_SIMPLE_CLAUSE(When, OMPC_when)
|
||||
CHECK_SIMPLE_CLAUSE(AdjustArgs, OMPC_adjust_args)
|
||||
|
|
|
@ -325,6 +325,9 @@ def OMPC_At : Clause<"at"> {
|
|||
def OMPC_Severity : Clause<"severity"> {
|
||||
let clangClass = "OMPSeverityClause";
|
||||
}
|
||||
def OMPC_Message : Clause<"message"> {
|
||||
let clangClass = "OMPMessageClause";
|
||||
}
|
||||
def OMPC_Allocate : Clause<"allocate"> {
|
||||
let clangClass = "OMPAllocateClause";
|
||||
let flangClass = "OmpAllocateClause";
|
||||
|
@ -554,7 +557,8 @@ def OMP_Barrier : Directive<"barrier"> {}
|
|||
def OMP_Error : Directive<"error"> {
|
||||
let allowedClauses = [
|
||||
VersionedClause<OMPC_At, 51>,
|
||||
VersionedClause<OMPC_Severity, 51>
|
||||
VersionedClause<OMPC_Severity, 51>,
|
||||
VersionedClause<OMPC_Message, 51>
|
||||
];
|
||||
}
|
||||
def OMP_TaskWait : Directive<"taskwait"> {
|
||||
|
|
Loading…
Reference in New Issue