[OPENMP50]Initial support for inclusive clause.

Added parsing/sema/serialization support for inclusive clause in scan
directive.
This commit is contained in:
Alexey Bataev 2020-03-20 09:41:22 -04:00
parent 7899fe9da8
commit 06dea73307
18 changed files with 281 additions and 54 deletions

View File

@ -6911,6 +6911,80 @@ public:
}
};
/// This represents clause 'inclusive' in the '#pragma omp scan' directive.
///
/// \code
/// #pragma omp scan inclusive(a,b)
/// \endcode
/// In this example directive '#pragma omp scan' has clause 'inclusive'
/// with the variables 'a' and 'b'.
class OMPInclusiveClause final
: public OMPVarListClause<OMPInclusiveClause>,
private llvm::TrailingObjects<OMPInclusiveClause, Expr *> {
friend class OMPClauseReader;
friend OMPVarListClause;
friend TrailingObjects;
/// Build clause with number of variables \a N.
///
/// \param StartLoc Starting location of the clause.
/// \param LParenLoc Location of '('.
/// \param EndLoc Ending location of the clause.
/// \param N Number of the variables in the clause.
OMPInclusiveClause(SourceLocation StartLoc, SourceLocation LParenLoc,
SourceLocation EndLoc, unsigned N)
: OMPVarListClause<OMPInclusiveClause>(OMPC_inclusive, StartLoc,
LParenLoc, EndLoc, N) {}
/// Build an empty clause.
///
/// \param N Number of variables.
explicit OMPInclusiveClause(unsigned N)
: OMPVarListClause<OMPInclusiveClause>(OMPC_inclusive, SourceLocation(),
SourceLocation(), SourceLocation(),
N) {}
public:
/// Creates clause with a list of variables \a VL.
///
/// \param C AST context.
/// \param StartLoc Starting location of the clause.
/// \param LParenLoc Location of '('.
/// \param EndLoc Ending location of the clause.
/// \param VL List of references to the original variables.
static OMPInclusiveClause *Create(const ASTContext &C,
SourceLocation StartLoc,
SourceLocation LParenLoc,
SourceLocation EndLoc, ArrayRef<Expr *> VL);
/// Creates an empty clause with the place for \a N variables.
///
/// \param C AST context.
/// \param N The number of variables.
static OMPInclusiveClause *CreateEmpty(const ASTContext &C, unsigned N);
child_range children() {
return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
reinterpret_cast<Stmt **>(varlist_end()));
}
const_child_range children() const {
auto Children = const_cast<OMPInclusiveClause *>(this)->children();
return const_child_range(Children.begin(), Children.end());
}
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() == OMPC_inclusive;
}
};
/// This class implements a simple visitor for OMPClause
/// subclasses.
template<class ImplClass, template <typename> class Ptr, typename RetTy>

View File

@ -3183,6 +3183,13 @@ bool RecursiveASTVisitor<Derived>::VisitOMPClauseList(T *Node) {
return true;
}
template <typename Derived>
bool RecursiveASTVisitor<Derived>::VisitOMPInclusiveClause(
OMPInclusiveClause *C) {
TRY_TO(VisitOMPClauseList(C));
return true;
}
template <typename Derived>
bool RecursiveASTVisitor<Derived>::VisitOMPPrivateClause(OMPPrivateClause *C) {
TRY_TO(VisitOMPClauseList(C));

View File

@ -10055,6 +10055,8 @@ def err_omp_depobj_expected : Error<
"expected depobj expression">;
def err_omp_depobj_single_clause_expected : Error<
"exactly one of 'depend', 'destroy', or 'update' clauses is expected">;
def err_omp_scan_single_clause_expected : Error<
"exactly one of 'inclusive' or 'exclusive' clauses is expected">;
def err_omp_expected_predefined_allocator : Error<
"expected one of the predefined allocators for the variables with the static "
"storage: 'omp_default_mem_alloc', 'omp_large_cap_mem_alloc', "

View File

@ -215,6 +215,9 @@
#ifndef OPENMP_DEVICE_MODIFIER
#define OPENMP_DEVICE_MODIFIER(Name)
#endif
#ifndef OPENMP_SCAN_CLAUSE
#define OPENMP_SCAN_CLAUSE(Name)
#endif
// OpenMP clauses.
OPENMP_CLAUSE(allocator, OMPAllocatorClause)
@ -281,6 +284,10 @@ OPENMP_CLAUSE(order, OMPOrderClause)
OPENMP_CLAUSE(depobj, OMPDepobjClause)
OPENMP_CLAUSE(destroy, OMPDestroyClause)
OPENMP_CLAUSE(detach, OMPDetachClause)
OPENMP_CLAUSE(inclusive, OMPInclusiveClause)
// Clauses allowed for OpenMP directive 'scan'.
OPENMP_SCAN_CLAUSE(inclusive)
// Clauses allowed for OpenMP directive 'parallel'.
OPENMP_PARALLEL_CLAUSE(if)
@ -1098,6 +1105,7 @@ OPENMP_DEPOBJ_CLAUSE(depend)
OPENMP_DEPOBJ_CLAUSE(destroy)
OPENMP_DEPOBJ_CLAUSE(update)
#undef OPENMP_SCAN_CLAUSE
#undef OPENMP_DEVICE_MODIFIER
#undef OPENMP_DEPOBJ_CLAUSE
#undef OPENMP_FLUSH_CLAUSE

View File

@ -10495,6 +10495,11 @@ public:
ArrayRef<OpenMPMapModifierKind> MapTypeModifiers,
ArrayRef<SourceLocation> MapTypeModifiersLoc, bool IsMapTypeImplicit,
SourceLocation DepLinMapLastLoc);
/// Called on well-formed 'inclusive' clause.
OMPClause *ActOnOpenMPInclusiveClause(ArrayRef<Expr *> VarList,
SourceLocation StartLoc,
SourceLocation LParenLoc,
SourceLocation EndLoc);
/// Called on well-formed 'allocate' clause.
OMPClause *
ActOnOpenMPAllocateClause(Expr *Allocator, ArrayRef<Expr *> VarList,

View File

@ -146,6 +146,7 @@ const OMPClauseWithPreInit *OMPClauseWithPreInit::get(const OMPClause *C) {
case OMPC_order:
case OMPC_destroy:
case OMPC_detach:
case OMPC_inclusive:
break;
}
@ -233,6 +234,7 @@ const OMPClauseWithPostUpdate *OMPClauseWithPostUpdate::get(const OMPClause *C)
case OMPC_order:
case OMPC_destroy:
case OMPC_detach:
case OMPC_inclusive:
break;
}
@ -1248,6 +1250,24 @@ void OMPNontemporalClause::setPrivateRefs(ArrayRef<Expr *> VL) {
std::copy(VL.begin(), VL.end(), varlist_end());
}
OMPInclusiveClause *OMPInclusiveClause::Create(const ASTContext &C,
SourceLocation StartLoc,
SourceLocation LParenLoc,
SourceLocation EndLoc,
ArrayRef<Expr *> VL) {
void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(VL.size()));
auto *Clause =
new (Mem) OMPInclusiveClause(StartLoc, LParenLoc, EndLoc, VL.size());
Clause->setVarRefs(VL);
return Clause;
}
OMPInclusiveClause *OMPInclusiveClause::CreateEmpty(const ASTContext &C,
unsigned N) {
void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(N));
return new (Mem) OMPInclusiveClause(N);
}
//===----------------------------------------------------------------------===//
// OpenMP clauses printing methods
//===----------------------------------------------------------------------===//
@ -1805,6 +1825,14 @@ void OMPClausePrinter::VisitOMPOrderClause(OMPOrderClause *Node) {
<< ")";
}
void OMPClausePrinter::VisitOMPInclusiveClause(OMPInclusiveClause *Node) {
if (!Node->varlist_empty()) {
OS << "inclusive";
VisitOMPClauseList(Node, '(');
OS << ")";
}
}
void OMPTraitInfo::getAsVariantMatchInfo(
ASTContext &ASTCtx, llvm::omp::VariantMatchInfo &VMI) const {
for (const OMPTraitSet &Set : Sets) {

View File

@ -795,6 +795,9 @@ void OMPClauseProfiler::VisitOMPNontemporalClause(
for (auto *E : C->private_refs())
Profiler->VisitStmt(E);
}
void OMPClauseProfiler::VisitOMPInclusiveClause(const OMPInclusiveClause *C) {
VisitOMPClauseList(C);
}
void OMPClauseProfiler::VisitOMPOrderClause(const OMPOrderClause *C) {}
} // namespace

View File

@ -212,6 +212,7 @@ unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind,
case OMPC_nontemporal:
case OMPC_destroy:
case OMPC_detach:
case OMPC_inclusive:
break;
}
llvm_unreachable("Invalid OpenMP simple clause kind");
@ -447,6 +448,7 @@ const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind,
case OMPC_nontemporal:
case OMPC_destroy:
case OMPC_detach:
case OMPC_inclusive:
break;
}
llvm_unreachable("Invalid OpenMP simple clause kind");

View File

@ -4616,6 +4616,7 @@ static void emitOMPAtomicExpr(CodeGenFunction &CGF, OpenMPClauseKind Kind,
case OMPC_order:
case OMPC_destroy:
case OMPC_detach:
case OMPC_inclusive:
llvm_unreachable("Clause is not allowed in 'omp atomic'.");
}
}

View File

@ -2344,7 +2344,7 @@ bool Parser::ParseOpenMPSimpleVarList(
/// from-clause | is_device_ptr-clause | task_reduction-clause |
/// in_reduction-clause | allocator-clause | allocate-clause |
/// acq_rel-clause | acquire-clause | release-clause | relaxed-clause |
/// depobj-clause | destroy-clause | detach-clause
/// depobj-clause | destroy-clause | detach-clause | inclusive-clause
///
OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind DKind,
OpenMPClauseKind CKind, bool FirstClause) {
@ -2513,6 +2513,7 @@ OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind DKind,
case OMPC_is_device_ptr:
case OMPC_allocate:
case OMPC_nontemporal:
case OMPC_inclusive:
Clause = ParseOpenMPVarListClause(DKind, CKind, WrongDirective);
break;
case OMPC_device_type:
@ -3237,8 +3238,8 @@ bool Parser::ParseOpenMPVarList(OpenMPDirectiveKind DKind,
}
/// Parsing of OpenMP clause 'private', 'firstprivate', 'lastprivate',
/// 'shared', 'copyin', 'copyprivate', 'flush', 'reduction', 'task_reduction' or
/// 'in_reduction'.
/// 'shared', 'copyin', 'copyprivate', 'flush', 'reduction', 'task_reduction',
/// 'in_reduction', 'nontemporal' or 'inclusive'.
///
/// private-clause:
/// 'private' '(' list ')'
@ -3278,6 +3279,10 @@ bool Parser::ParseOpenMPVarList(OpenMPDirectiveKind DKind,
/// 'is_device_ptr' '(' list ')'
/// allocate-clause:
/// 'allocate' '(' [ allocator ':' ] list ')'
/// nontemporal-clause:
/// 'nontemporal' '(' list ')'
/// inclusive-clause:
/// 'inclusive' '(' list ')'
///
/// For 'linear' clause linear-list may have the following forms:
/// list

View File

@ -5177,6 +5177,7 @@ StmtResult Sema::ActOnOpenMPExecutableDirective(
case OMPC_nontemporal:
case OMPC_order:
case OMPC_destroy:
case OMPC_inclusive:
continue;
case OMPC_allocator:
case OMPC_flush:
@ -8794,6 +8795,11 @@ StmtResult Sema::ActOnOpenMPDepobjDirective(ArrayRef<OMPClause *> Clauses,
StmtResult Sema::ActOnOpenMPScanDirective(ArrayRef<OMPClause *> Clauses,
SourceLocation StartLoc,
SourceLocation EndLoc) {
if (Clauses.size() != 1) {
Diag(Clauses.empty() ? EndLoc : Clauses[1]->getBeginLoc(),
diag::err_omp_scan_single_clause_expected);
return StmtError();
}
return OMPScanDirective::Create(Context, StartLoc, EndLoc, Clauses);
}
@ -11145,6 +11151,7 @@ OMPClause *Sema::ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind, Expr *Expr,
case OMPC_nontemporal:
case OMPC_order:
case OMPC_destroy:
case OMPC_inclusive:
llvm_unreachable("Clause is not allowed.");
}
return Res;
@ -11880,6 +11887,7 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause(
case OMPC_order:
case OMPC_destroy:
case OMPC_detach:
case OMPC_inclusive:
llvm_unreachable("Unexpected OpenMP clause.");
}
return CaptureRegion;
@ -12317,6 +12325,7 @@ OMPClause *Sema::ActOnOpenMPSimpleClause(
case OMPC_nontemporal:
case OMPC_destroy:
case OMPC_detach:
case OMPC_inclusive:
llvm_unreachable("Clause is not allowed.");
}
return Res;
@ -12540,6 +12549,7 @@ OMPClause *Sema::ActOnOpenMPSingleExprWithArgClause(
case OMPC_order:
case OMPC_destroy:
case OMPC_detach:
case OMPC_inclusive:
llvm_unreachable("Clause is not allowed.");
}
return Res;
@ -12770,6 +12780,7 @@ OMPClause *Sema::ActOnOpenMPClause(OpenMPClauseKind Kind,
case OMPC_nontemporal:
case OMPC_order:
case OMPC_detach:
case OMPC_inclusive:
llvm_unreachable("Clause is not allowed.");
}
return Res;
@ -12977,6 +12988,9 @@ OMPClause *Sema::ActOnOpenMPVarListClause(
case OMPC_nontemporal:
Res = ActOnOpenMPNontemporalClause(VarList, StartLoc, LParenLoc, EndLoc);
break;
case OMPC_inclusive:
Res = ActOnOpenMPInclusiveClause(VarList, StartLoc, LParenLoc, EndLoc);
break;
case OMPC_if:
case OMPC_depobj:
case OMPC_final:
@ -18043,3 +18057,31 @@ OMPClause *Sema::ActOnOpenMPNontemporalClause(ArrayRef<Expr *> VarList,
return OMPNontemporalClause::Create(Context, StartLoc, LParenLoc, EndLoc,
Vars);
}
OMPClause *Sema::ActOnOpenMPInclusiveClause(ArrayRef<Expr *> VarList,
SourceLocation StartLoc,
SourceLocation LParenLoc,
SourceLocation EndLoc) {
SmallVector<Expr *, 8> Vars;
for (Expr *RefExpr : VarList) {
assert(RefExpr && "NULL expr in OpenMP nontemporal clause.");
SourceLocation ELoc;
SourceRange ERange;
Expr *SimpleRefExpr = RefExpr;
auto Res = getPrivateItem(*this, SimpleRefExpr, ELoc, ERange,
/*AllowArraySection=*/true);
if (Res.second)
// It will be analyzed later.
Vars.push_back(RefExpr);
ValueDecl *D = Res.first;
if (!D)
continue;
Vars.push_back(RefExpr);
}
if (Vars.empty())
return nullptr;
return OMPInclusiveClause::Create(Context, StartLoc, LParenLoc, EndLoc, Vars);
}

View File

@ -2053,6 +2053,18 @@ public:
EndLoc);
}
/// Build a new OpenMP 'inclusive' clause.
///
/// By default, performs semantic analysis to build the new OpenMP clause.
/// Subclasses may override this routine to provide different behavior.
OMPClause *RebuildOMPInclusiveClause(ArrayRef<Expr *> VarList,
SourceLocation StartLoc,
SourceLocation LParenLoc,
SourceLocation EndLoc) {
return getSema().ActOnOpenMPInclusiveClause(VarList, StartLoc, LParenLoc,
EndLoc);
}
/// Build a new OpenMP 'order' clause.
///
/// By default, performs semantic analysis to build the new OpenMP clause.
@ -9521,6 +9533,21 @@ TreeTransform<Derived>::TransformOMPNontemporalClause(OMPNontemporalClause *C) {
Vars, C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
}
template <typename Derived>
OMPClause *
TreeTransform<Derived>::TransformOMPInclusiveClause(OMPInclusiveClause *C) {
llvm::SmallVector<Expr *, 16> Vars;
Vars.reserve(C->varlist_size());
for (auto *VE : C->varlists()) {
ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
if (EVar.isInvalid())
return nullptr;
Vars.push_back(EVar.get());
}
return getDerived().RebuildOMPInclusiveClause(
Vars, C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
}
template <typename Derived>
OMPClause *
TreeTransform<Derived>::TransformOMPOrderClause(OMPOrderClause *C) {

View File

@ -11824,6 +11824,9 @@ OMPClause *OMPClauseReader::readClause() {
case OMPC_nontemporal:
C = OMPNontemporalClause::CreateEmpty(Context, Record.readInt());
break;
case OMPC_inclusive:
C = OMPInclusiveClause::CreateEmpty(Context, Record.readInt());
break;
case OMPC_order:
C = new (Context) OMPOrderClause();
break;
@ -12634,6 +12637,16 @@ void OMPClauseReader::VisitOMPNontemporalClause(OMPNontemporalClause *C) {
C->setPrivateRefs(Vars);
}
void OMPClauseReader::VisitOMPInclusiveClause(OMPInclusiveClause *C) {
C->setLParenLoc(Record.readSourceLocation());
unsigned NumVars = C->varlist_size();
SmallVector<Expr *, 16> Vars;
Vars.reserve(NumVars);
for (unsigned i = 0; i != NumVars; ++i)
Vars.push_back(Record.readSubExpr());
C->setVarRefs(Vars);
}
void OMPClauseReader::VisitOMPOrderClause(OMPOrderClause *C) {
C->setKind(Record.readEnum<OpenMPOrderClauseKind>());
C->setLParenLoc(Record.readSourceLocation());

View File

@ -6593,6 +6593,13 @@ void OMPClauseWriter::VisitOMPNontemporalClause(OMPNontemporalClause *C) {
Record.AddStmt(E);
}
void OMPClauseWriter::VisitOMPInclusiveClause(OMPInclusiveClause *C) {
Record.push_back(C->varlist_size());
Record.AddSourceLocation(C->getLParenLoc());
for (auto *VE : C->varlists())
Record.AddStmt(VE);
}
void OMPClauseWriter::VisitOMPOrderClause(OMPOrderClause *C) {
Record.writeEnum(C->getKind());
Record.AddSourceLocation(C->getLParenLoc());

View File

@ -337,7 +337,7 @@ void foo() {
}
#pragma omp simd
for (int i = 0; i < 10; ++i) {
#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}}
#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}}
bar();
}
#pragma omp simd
@ -618,7 +618,7 @@ void foo() {
}
#pragma omp for
for (int i = 0; i < 10; ++i) {
#pragma omp scan // omp45-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}}
#pragma omp scan // omp45-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp scan' directive into a for, simd, or for simd region?}} omp50-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}}
bar();
}
#pragma omp for
@ -876,7 +876,7 @@ void foo() {
}
#pragma omp for simd
for (int i = 0; i < 10; ++i) {
#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}}
#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}}
bar();
}
#pragma omp for simd
@ -9861,7 +9861,7 @@ void foo() {
}
#pragma omp simd
for (int i = 0; i < 10; ++i) {
#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}}
#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}}
bar();
}
#pragma omp simd
@ -10116,7 +10116,7 @@ void foo() {
}
#pragma omp for
for (int i = 0; i < 10; ++i) {
#pragma omp scan // omp45-error {{region cannot be closely nested inside 'for' region}}
#pragma omp scan // omp45-error {{region cannot be closely nested inside 'for' region}} omp50-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}}
bar();
}
#pragma omp for
@ -10361,7 +10361,7 @@ void foo() {
}
#pragma omp for simd
for (int i = 0; i < 10; ++i) {
#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}}
#pragma omp scan // omp45-error {{OpenMP constructs may not be nested inside a simd region}} omp50-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}}
bar();
}
#pragma omp for simd

View File

@ -17,33 +17,33 @@ T tmain(T argc) {
static T a;
#pragma omp for
for (int i = 0; i < 10; ++i) {
#pragma omp scan
#pragma omp scan inclusive(a)
}
return a + argc;
}
// CHECK: static T a;
// CHECK-NEXT: #pragma omp for
// CHECK-NEXT: for (int i = 0; i < 10; ++i) {
// CHECK-NEXT: #pragma omp scan{{$}}
// CHECK-NEXT: #pragma omp scan inclusive(a){{$}}
// CHECK: static int a;
// CHECK-NEXT: #pragma omp for
// CHECK-NEXT: for (int i = 0; i < 10; ++i) {
// CHECK-NEXT: #pragma omp scan
// CHECK-NEXT: #pragma omp scan inclusive(a)
// CHECK: static char a;
// CHECK-NEXT: #pragma omp for
// CHECK-NEXT: for (int i = 0; i < 10; ++i) {
// CHECK-NEXT: #pragma omp scan
// CHECK-NEXT: #pragma omp scan inclusive(a)
int main(int argc, char **argv) {
static int a;
// CHECK: static int a;
#pragma omp for simd
for (int i = 0; i < 10; ++i) {
#pragma omp scan
#pragma omp scan inclusive(a)
}
// CHECK-NEXT: #pragma omp for simd
// CHECK-NEXT: for (int i = 0; i < 10; ++i) {
// CHECK-NEXT: #pragma omp scan{{$}}
// CHECK-NEXT: #pragma omp scan inclusive(a){{$}}
return tmain(argc) + tmain(argv[0][0]) + a;
}

View File

@ -6,78 +6,78 @@ template <class T>
T tmain(T argc) {
#pragma omp for
for (int i = 0; i < 10; ++i) {
#pragma omp scan
#pragma omp scan // expected-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}}
;
}
#pragma omp for
for (int i = 0; i < 10; ++i) {
#pragma omp scan allocate(argc) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp scan'}}
#pragma omp scan untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp scan'}}
#pragma omp scan unknown // expected-warning {{extra tokens at the end of '#pragma omp scan' are ignored}}
#pragma omp scan allocate(argc) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp scan'}} expected-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}}
#pragma omp scan untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp scan'}} expected-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}}
#pragma omp scan unknown // expected-warning {{extra tokens at the end of '#pragma omp scan' are ignored}} expected-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}}
}
#pragma omp for simd
for (int i = 0; i < 10; ++i)
if (argc)
#pragma omp scan // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
#pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
if (argc) {
#pragma omp scan
#pragma omp scan inclusive(argc)
}
#pragma omp simd
for (int i = 0; i < 10; ++i)
while (argc)
#pragma omp scan // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
#pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
while (argc) {
#pragma omp scan
#pragma omp scan inclusive(argc)
}
#pragma omp simd
for (int i = 0; i < 10; ++i)
do
#pragma omp scan // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
#pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
while (argc)
;
#pragma omp simd
for (int i = 0; i < 10; ++i)
do {
#pragma omp scan
#pragma omp scan inclusive(argc)
} while (argc);
#pragma omp simd
for (int i = 0; i < 10; ++i)
switch (argc)
#pragma omp scan // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
#pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
switch (argc)
case 1:
#pragma omp scan // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
#pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
switch (argc)
case 1: {
#pragma omp scan
#pragma omp scan inclusive(argc)
}
#pragma omp simd
for (int i = 0; i < 10; ++i)
switch (argc) {
#pragma omp scan
#pragma omp scan inclusive(argc)
case 1:
#pragma omp scan
#pragma omp scan inclusive(argc)
break;
default: {
#pragma omp scan
#pragma omp scan inclusive(argc)
} break;
}
#pragma omp simd
for (int i = 0; i < 10; ++i)
for (;;)
#pragma omp scan // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
#pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
for (;;) {
#pragma omp scan
#pragma omp scan inclusive(argc)
}
#pragma omp simd
for (int i = 0; i < 10; ++i) {
label:
#pragma omp scan
#pragma omp scan inclusive(argc)
}
#pragma omp simd
for (int i = 0; i < 10; ++i) {
label1 : {
#pragma omp scan
#pragma omp scan inclusive(argc)
}}
return T();
@ -86,77 +86,77 @@ label1 : {
int main(int argc, char **argv) {
#pragma omp simd
for (int i = 0; i < 10; ++i) {
#pragma omp scan
#pragma omp scan inclusive(argc) inclusive(argc) // expected-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}}
;
}
#pragma omp simd
for (int i = 0; i < 10; ++i) {
#pragma omp scan untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp scan'}}
#pragma omp scan unknown // expected-warning {{extra tokens at the end of '#pragma omp scan' are ignored}}
#pragma omp scan untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp scan'}} expected-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}}
#pragma omp scan unknown // expected-warning {{extra tokens at the end of '#pragma omp scan' are ignored}} expected-error {{exactly one of 'inclusive' or 'exclusive' clauses is expected}}
}
#pragma omp simd
for (int i = 0; i < 10; ++i)
if (argc)
#pragma omp scan // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
#pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
if (argc) {
#pragma omp scan
#pragma omp scan inclusive(argc)
}
#pragma omp simd
for (int i = 0; i < 10; ++i)
while (argc)
#pragma omp scan // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
#pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
while (argc) {
#pragma omp scan
#pragma omp scan inclusive(argc)
}
#pragma omp simd
for (int i = 0; i < 10; ++i)
do
#pragma omp scan // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
#pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
while (argc)
;
#pragma omp simd
for (int i = 0; i < 10; ++i)
do {
#pragma omp scan
#pragma omp scan inclusive(argc)
} while (argc);
#pragma omp simd
for (int i = 0; i < 10; ++i)
switch (argc)
#pragma omp scan // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
#pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
switch (argc)
case 1:
#pragma omp scan // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
#pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
switch (argc)
case 1: {
#pragma omp scan
#pragma omp scan inclusive(argc)
}
#pragma omp simd
for (int i = 0; i < 10; ++i)
switch (argc) {
#pragma omp scan
#pragma omp scan inclusive(argc)
case 1:
#pragma omp scan
#pragma omp scan inclusive(argc)
break;
default: {
#pragma omp scan
#pragma omp scan inclusive(argc)
} break;
}
#pragma omp simd
for (int i = 0; i < 10; ++i)
for (;;)
#pragma omp scan // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
#pragma omp scan inclusive(argc) // expected-error {{'#pragma omp scan' cannot be an immediate substatement}}
for (;;) {
#pragma omp scan
#pragma omp scan inclusive(argc)
}
#pragma omp simd
for (int i = 0; i < 10; ++i) {
label:
#pragma omp scan
#pragma omp scan inclusive(argc)
}
#pragma omp simd
for (int i = 0; i < 10; ++i) {
label1 : {
#pragma omp scan
#pragma omp scan inclusive(argc)
}
}

View File

@ -2309,6 +2309,9 @@ void OMPClauseEnqueue::VisitOMPClauseList(T *Node) {
}
}
void OMPClauseEnqueue::VisitOMPInclusiveClause(const OMPInclusiveClause *C) {
VisitOMPClauseList(C);
}
void OMPClauseEnqueue::VisitOMPAllocateClause(const OMPAllocateClause *C) {
VisitOMPClauseList(C);
Visitor->AddStmt(C->getAllocator());