[OPENMP]Initial support for 'allocate' clause.

Added parsing/sema analysis of the allocate clause.

llvm-svn: 357068
This commit is contained in:
Alexey Bataev 2019-03-27 14:14:31 +00:00
parent 5c0d7a24e8
commit e04483ee35
197 changed files with 737 additions and 282 deletions

View File

@ -295,6 +295,92 @@ public:
}
};
/// This represents clause 'allocate' in the '#pragma omp ...' directives.
///
/// \code
/// #pragma omp parallel private(a) allocate(omp_default_mem_alloc :a)
/// \endcode
/// In this example directive '#pragma omp parallel' has clause 'private'
/// and clause 'allocate' for the variable 'a'.
class OMPAllocateClause final
: public OMPVarListClause<OMPAllocateClause>,
private llvm::TrailingObjects<OMPAllocateClause, Expr *> {
friend class OMPClauseReader;
friend OMPVarListClause;
friend TrailingObjects;
/// Allocator specified in the clause, or 'nullptr' if the default one is
/// used.
Expr *Allocator = nullptr;
/// Position of the ':' delimiter in the clause;
SourceLocation ColonLoc;
/// Build clause with number of variables \a N.
///
/// \param StartLoc Starting location of the clause.
/// \param LParenLoc Location of '('.
/// \param Allocator Allocator expression.
/// \param ColonLoc Location of ':' delimiter.
/// \param EndLoc Ending location of the clause.
/// \param N Number of the variables in the clause.
OMPAllocateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
Expr *Allocator, SourceLocation ColonLoc,
SourceLocation EndLoc, unsigned N)
: OMPVarListClause<OMPAllocateClause>(OMPC_allocate, StartLoc, LParenLoc,
EndLoc, N),
Allocator(Allocator), ColonLoc(ColonLoc) {}
/// Build an empty clause.
///
/// \param N Number of variables.
explicit OMPAllocateClause(unsigned N)
: OMPVarListClause<OMPAllocateClause>(OMPC_allocate, SourceLocation(),
SourceLocation(), SourceLocation(),
N) {}
/// Sets location of ':' symbol in clause.
void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
void setAllocator(Expr *A) { Allocator = A; }
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 Allocator Allocator expression.
/// \param ColonLoc Location of ':' delimiter.
/// \param EndLoc Ending location of the clause.
/// \param VL List of references to the variables.
/// \param PrivateVL List of references to private copies with initializers.
static OMPAllocateClause *Create(const ASTContext &C, SourceLocation StartLoc,
SourceLocation LParenLoc, Expr *Allocator,
SourceLocation ColonLoc,
SourceLocation EndLoc, ArrayRef<Expr *> VL);
/// Returns the allocator expression or nullptr, if no allocator is specified.
Expr *getAllocator() const { return Allocator; }
/// Returns the location of the ':' delimiter.
SourceLocation getColonLoc() const { return ColonLoc; }
/// Creates an empty clause with the place for \a N variables.
///
/// \param C AST context.
/// \param N The number of variables.
static OMPAllocateClause *CreateEmpty(const ASTContext &C, unsigned N);
child_range children() {
return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
reinterpret_cast<Stmt **>(varlist_end()));
}
static bool classof(const OMPClause *T) {
return T->getClauseKind() == OMPC_allocate;
}
};
/// This represents 'if' clause in the '#pragma omp ...' directive.
///
/// \code

View File

@ -2804,7 +2804,6 @@ bool RecursiveASTVisitor<Derived>::TraverseOMPClause(OMPClause *C) {
break;
#include "clang/Basic/OpenMPKinds.def"
case OMPC_threadprivate:
case OMPC_allocate:
case OMPC_uniform:
case OMPC_unknown:
break;
@ -2834,6 +2833,13 @@ bool RecursiveASTVisitor<Derived>::VisitOMPAllocatorClause(
return true;
}
template <typename Derived>
bool RecursiveASTVisitor<Derived>::VisitOMPAllocateClause(OMPAllocateClause *C) {
TRY_TO(TraverseStmt(C->getAllocator()));
TRY_TO(VisitOMPClauseList(C));
return true;
}
template <typename Derived>
bool RecursiveASTVisitor<Derived>::VisitOMPIfClause(OMPIfClause *C) {
TRY_TO(VisitOMPClauseWithPreInit(C));

View File

@ -304,6 +304,7 @@ OPENMP_CLAUSE(unified_shared_memory, OMPUnifiedSharedMemoryClause)
OPENMP_CLAUSE(reverse_offload, OMPReverseOffloadClause)
OPENMP_CLAUSE(dynamic_allocators, OMPDynamicAllocatorsClause)
OPENMP_CLAUSE(atomic_default_mem_order, OMPAtomicDefaultMemOrderClause)
OPENMP_CLAUSE(allocate, OMPAllocateClause)
// Clauses allowed for OpenMP directive 'parallel'.
OPENMP_PARALLEL_CLAUSE(if)
@ -315,6 +316,7 @@ OPENMP_PARALLEL_CLAUSE(firstprivate)
OPENMP_PARALLEL_CLAUSE(shared)
OPENMP_PARALLEL_CLAUSE(reduction)
OPENMP_PARALLEL_CLAUSE(copyin)
OPENMP_PARALLEL_CLAUSE(allocate)
// Clauses allowed for directive 'omp simd'.
OPENMP_SIMD_CLAUSE(private)
@ -325,6 +327,7 @@ OPENMP_SIMD_CLAUSE(safelen)
OPENMP_SIMD_CLAUSE(simdlen)
OPENMP_SIMD_CLAUSE(collapse)
OPENMP_SIMD_CLAUSE(reduction)
OPENMP_SIMD_CLAUSE(allocate)
// Clauses allowed for directive 'omp for'.
OPENMP_FOR_CLAUSE(private)
@ -336,6 +339,7 @@ OPENMP_FOR_CLAUSE(schedule)
OPENMP_FOR_CLAUSE(ordered)
OPENMP_FOR_CLAUSE(nowait)
OPENMP_FOR_CLAUSE(linear)
OPENMP_FOR_CLAUSE(allocate)
// Clauses allowed for directive 'omp for simd'.
OPENMP_FOR_SIMD_CLAUSE(private)
@ -350,6 +354,7 @@ OPENMP_FOR_SIMD_CLAUSE(simdlen)
OPENMP_FOR_SIMD_CLAUSE(linear)
OPENMP_FOR_SIMD_CLAUSE(aligned)
OPENMP_FOR_SIMD_CLAUSE(ordered)
OPENMP_FOR_SIMD_CLAUSE(allocate)
// Clauses allowed for OpenMP directive 'omp sections'.
OPENMP_SECTIONS_CLAUSE(private)
@ -357,12 +362,14 @@ OPENMP_SECTIONS_CLAUSE(lastprivate)
OPENMP_SECTIONS_CLAUSE(firstprivate)
OPENMP_SECTIONS_CLAUSE(reduction)
OPENMP_SECTIONS_CLAUSE(nowait)
OPENMP_SECTIONS_CLAUSE(allocate)
// Clauses allowed for directive 'omp single'.
OPENMP_SINGLE_CLAUSE(private)
OPENMP_SINGLE_CLAUSE(firstprivate)
OPENMP_SINGLE_CLAUSE(copyprivate)
OPENMP_SINGLE_CLAUSE(nowait)
OPENMP_SINGLE_CLAUSE(allocate)
// Clauses allowed for OpenMP directive 'cancel'.
OPENMP_CANCEL_CLAUSE(if)
@ -422,6 +429,7 @@ OPENMP_PARALLEL_FOR_CLAUSE(collapse)
OPENMP_PARALLEL_FOR_CLAUSE(schedule)
OPENMP_PARALLEL_FOR_CLAUSE(ordered)
OPENMP_PARALLEL_FOR_CLAUSE(linear)
OPENMP_PARALLEL_FOR_CLAUSE(allocate)
// Clauses allowed for OpenMP directive 'parallel for simd'.
OPENMP_PARALLEL_FOR_SIMD_CLAUSE(if)
@ -441,6 +449,7 @@ OPENMP_PARALLEL_FOR_SIMD_CLAUSE(simdlen)
OPENMP_PARALLEL_FOR_SIMD_CLAUSE(linear)
OPENMP_PARALLEL_FOR_SIMD_CLAUSE(aligned)
OPENMP_PARALLEL_FOR_SIMD_CLAUSE(ordered)
OPENMP_PARALLEL_FOR_SIMD_CLAUSE(allocate)
// Clauses allowed for OpenMP directive 'parallel sections'.
OPENMP_PARALLEL_SECTIONS_CLAUSE(if)
@ -453,6 +462,7 @@ OPENMP_PARALLEL_SECTIONS_CLAUSE(shared)
OPENMP_PARALLEL_SECTIONS_CLAUSE(reduction)
OPENMP_PARALLEL_SECTIONS_CLAUSE(copyin)
OPENMP_PARALLEL_SECTIONS_CLAUSE(lastprivate)
OPENMP_PARALLEL_SECTIONS_CLAUSE(allocate)
// Clauses allowed for OpenMP directive 'task'.
OPENMP_TASK_CLAUSE(if)
@ -466,6 +476,7 @@ OPENMP_TASK_CLAUSE(mergeable)
OPENMP_TASK_CLAUSE(depend)
OPENMP_TASK_CLAUSE(priority)
OPENMP_TASK_CLAUSE(in_reduction)
OPENMP_TASK_CLAUSE(allocate)
// Clauses allowed for OpenMP directive 'atomic'.
OPENMP_ATOMIC_CLAUSE(read)
@ -485,6 +496,7 @@ OPENMP_TARGET_CLAUSE(defaultmap)
OPENMP_TARGET_CLAUSE(firstprivate)
OPENMP_TARGET_CLAUSE(is_device_ptr)
OPENMP_TARGET_CLAUSE(reduction)
OPENMP_TARGET_CLAUSE(allocate)
// Clauses allowed for OpenMP directive 'requires'.
OPENMP_REQUIRES_CLAUSE(unified_address)
@ -536,6 +548,7 @@ OPENMP_TARGET_PARALLEL_CLAUSE(proc_bind)
OPENMP_TARGET_PARALLEL_CLAUSE(shared)
OPENMP_TARGET_PARALLEL_CLAUSE(reduction)
OPENMP_TARGET_PARALLEL_CLAUSE(is_device_ptr)
OPENMP_TARGET_PARALLEL_CLAUSE(allocate)
// Clauses allowed for OpenMP directive 'target parallel for'.
OPENMP_TARGET_PARALLEL_FOR_CLAUSE(if)
@ -557,6 +570,7 @@ OPENMP_TARGET_PARALLEL_FOR_CLAUSE(schedule)
OPENMP_TARGET_PARALLEL_FOR_CLAUSE(ordered)
OPENMP_TARGET_PARALLEL_FOR_CLAUSE(linear)
OPENMP_TARGET_PARALLEL_FOR_CLAUSE(is_device_ptr)
OPENMP_TARGET_PARALLEL_FOR_CLAUSE(allocate)
// Clauses allowed for OpenMP directive 'target update'.
OPENMP_TARGET_UPDATE_CLAUSE(if)
@ -574,6 +588,7 @@ OPENMP_TEAMS_CLAUSE(shared)
OPENMP_TEAMS_CLAUSE(reduction)
OPENMP_TEAMS_CLAUSE(num_teams)
OPENMP_TEAMS_CLAUSE(thread_limit)
OPENMP_TEAMS_CLAUSE(allocate)
// Clauses allowed for OpenMP directive 'ordered'.
OPENMP_ORDERED_CLAUSE(threads)
@ -616,6 +631,7 @@ OPENMP_TASKLOOP_CLAUSE(nogroup)
OPENMP_TASKLOOP_CLAUSE(num_tasks)
OPENMP_TASKLOOP_CLAUSE(reduction)
OPENMP_TASKLOOP_CLAUSE(in_reduction)
OPENMP_TASKLOOP_CLAUSE(allocate)
// Clauses allowed for OpenMP directive 'taskloop simd'.
OPENMP_TASKLOOP_SIMD_CLAUSE(if)
@ -638,6 +654,7 @@ OPENMP_TASKLOOP_SIMD_CLAUSE(nogroup)
OPENMP_TASKLOOP_SIMD_CLAUSE(num_tasks)
OPENMP_TASKLOOP_SIMD_CLAUSE(reduction)
OPENMP_TASKLOOP_SIMD_CLAUSE(in_reduction)
OPENMP_TASKLOOP_SIMD_CLAUSE(allocate)
// Clauses allowed for OpenMP directive 'critical'.
OPENMP_CRITICAL_CLAUSE(hint)
@ -648,6 +665,7 @@ OPENMP_DISTRIBUTE_CLAUSE(firstprivate)
OPENMP_DISTRIBUTE_CLAUSE(lastprivate)
OPENMP_DISTRIBUTE_CLAUSE(collapse)
OPENMP_DISTRIBUTE_CLAUSE(dist_schedule)
OPENMP_DISTRIBUTE_CLAUSE(allocate)
// Static attributes for 'dist_schedule' clause.
OPENMP_DIST_SCHEDULE_KIND(static)
@ -666,6 +684,7 @@ OPENMP_DISTRIBUTE_PARALLEL_FOR_CLAUSE(shared)
OPENMP_DISTRIBUTE_PARALLEL_FOR_CLAUSE(reduction)
OPENMP_DISTRIBUTE_PARALLEL_FOR_CLAUSE(copyin)
OPENMP_DISTRIBUTE_PARALLEL_FOR_CLAUSE(schedule)
OPENMP_DISTRIBUTE_PARALLEL_FOR_CLAUSE(allocate)
// Clauses allowed for OpenMP directive 'distribute parallel for simd'
OPENMP_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(firstprivate)
@ -685,6 +704,7 @@ OPENMP_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(linear)
OPENMP_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(aligned)
OPENMP_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(safelen)
OPENMP_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(simdlen)
OPENMP_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(allocate)
// Clauses allowed for OpenMP directive 'distribute simd'
OPENMP_DISTRIBUTE_SIMD_CLAUSE(private)
@ -697,6 +717,7 @@ OPENMP_DISTRIBUTE_SIMD_CLAUSE(aligned)
OPENMP_DISTRIBUTE_SIMD_CLAUSE(safelen)
OPENMP_DISTRIBUTE_SIMD_CLAUSE(simdlen)
OPENMP_DISTRIBUTE_SIMD_CLAUSE(reduction)
OPENMP_DISTRIBUTE_SIMD_CLAUSE(allocate)
// Clauses allowed for OpenMP directive 'target parallel for simd'.
OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(if)
@ -721,6 +742,7 @@ OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(safelen)
OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(simdlen)
OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(aligned)
OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(is_device_ptr)
OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(allocate)
// Clauses allowed for OpenMP directive 'target simd'.
OPENMP_TARGET_SIMD_CLAUSE(if)
@ -739,6 +761,7 @@ OPENMP_TARGET_SIMD_CLAUSE(safelen)
OPENMP_TARGET_SIMD_CLAUSE(simdlen)
OPENMP_TARGET_SIMD_CLAUSE(collapse)
OPENMP_TARGET_SIMD_CLAUSE(reduction)
OPENMP_TARGET_SIMD_CLAUSE(allocate)
// Clauses allowed for OpenMP directive 'teams distribute'.
OPENMP_TEAMS_DISTRIBUTE_CLAUSE(default)
@ -751,6 +774,7 @@ OPENMP_TEAMS_DISTRIBUTE_CLAUSE(thread_limit)
OPENMP_TEAMS_DISTRIBUTE_CLAUSE(lastprivate)
OPENMP_TEAMS_DISTRIBUTE_CLAUSE(collapse)
OPENMP_TEAMS_DISTRIBUTE_CLAUSE(dist_schedule)
OPENMP_TEAMS_DISTRIBUTE_CLAUSE(allocate)
// Clauses allowed for OpenMP directive 'teams distribute simd'
OPENMP_TEAMS_DISTRIBUTE_SIMD_CLAUSE(default)
@ -767,6 +791,7 @@ OPENMP_TEAMS_DISTRIBUTE_SIMD_CLAUSE(linear)
OPENMP_TEAMS_DISTRIBUTE_SIMD_CLAUSE(aligned)
OPENMP_TEAMS_DISTRIBUTE_SIMD_CLAUSE(safelen)
OPENMP_TEAMS_DISTRIBUTE_SIMD_CLAUSE(simdlen)
OPENMP_TEAMS_DISTRIBUTE_SIMD_CLAUSE(allocate)
// Clauses allowed for OpenMP directive 'teams distribute parallel for simd'
OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(firstprivate)
@ -787,6 +812,7 @@ OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(safelen)
OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(simdlen)
OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(num_teams)
OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(thread_limit)
OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(allocate)
// Clauses allowed for OpenMP directive 'teams distribute parallel for'
OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(firstprivate)
@ -804,6 +830,7 @@ OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(schedule)
OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(num_teams)
OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(thread_limit)
OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(copyin)
OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(allocate)
// Clauses allowed for OpenMP directive 'target teams'.
OPENMP_TARGET_TEAMS_CLAUSE(if)
@ -820,6 +847,7 @@ OPENMP_TARGET_TEAMS_CLAUSE(shared)
OPENMP_TARGET_TEAMS_CLAUSE(reduction)
OPENMP_TARGET_TEAMS_CLAUSE(num_teams)
OPENMP_TARGET_TEAMS_CLAUSE(thread_limit)
OPENMP_TARGET_TEAMS_CLAUSE(allocate)
// Clauses allowed for OpenMP directive 'target teams distribute'.
OPENMP_TARGET_TEAMS_DISTRIBUTE_CLAUSE(if)
@ -839,6 +867,7 @@ OPENMP_TARGET_TEAMS_DISTRIBUTE_CLAUSE(thread_limit)
OPENMP_TARGET_TEAMS_DISTRIBUTE_CLAUSE(lastprivate)
OPENMP_TARGET_TEAMS_DISTRIBUTE_CLAUSE(collapse)
OPENMP_TARGET_TEAMS_DISTRIBUTE_CLAUSE(dist_schedule)
OPENMP_TARGET_TEAMS_DISTRIBUTE_CLAUSE(allocate)
// Clauses allowed for OpenMP directive 'target teams distribute parallel for'.
OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(if)
@ -861,6 +890,7 @@ OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(dist_schedule)
OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(num_threads)
OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(proc_bind)
OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(schedule)
OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(allocate)
// Clauses allowed for OpenMP directive
// 'target teams distribute parallel for simd'.
@ -888,6 +918,7 @@ OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(linear)
OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(aligned)
OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(safelen)
OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(simdlen)
OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(allocate)
// Clauses allowed for OpenMP directive 'target teams distribute simd'.
OPENMP_TARGET_TEAMS_DISTRIBUTE_SIMD_CLAUSE(if)
@ -910,9 +941,11 @@ OPENMP_TARGET_TEAMS_DISTRIBUTE_SIMD_CLAUSE(linear)
OPENMP_TARGET_TEAMS_DISTRIBUTE_SIMD_CLAUSE(aligned)
OPENMP_TARGET_TEAMS_DISTRIBUTE_SIMD_CLAUSE(safelen)
OPENMP_TARGET_TEAMS_DISTRIBUTE_SIMD_CLAUSE(simdlen)
OPENMP_TARGET_TEAMS_DISTRIBUTE_SIMD_CLAUSE(allocate)
// Clauses allowed for OpenMP directive 'taskgroup'.
OPENMP_TASKGROUP_CLAUSE(task_reduction)
OPENMP_TASKGROUP_CLAUSE(allocate)
// Clauses allowed for OpenMP directive 'declare mapper'.
OPENMP_DECLARE_MAPPER_CLAUSE(map)

View File

@ -35,7 +35,6 @@ enum OpenMPClauseKind {
#include "clang/Basic/OpenMPKinds.def"
OMPC_threadprivate,
OMPC_uniform,
OMPC_allocate,
OMPC_unknown
};

View File

@ -9389,6 +9389,11 @@ public:
ArrayRef<OpenMPMapModifierKind> MapTypeModifiers,
ArrayRef<SourceLocation> MapTypeModifiersLoc, OpenMPMapClauseKind MapType,
bool IsMapTypeImplicit, SourceLocation DepLinMapLoc);
/// Called on well-formed 'allocate' clause.
OMPClause *
ActOnOpenMPAllocateClause(Expr *Allocator, ArrayRef<Expr *> VarList,
SourceLocation StartLoc, SourceLocation ColonLoc,
SourceLocation LParenLoc, SourceLocation EndLoc);
/// Called on well-formed 'private' clause.
OMPClause *ActOnOpenMPPrivateClause(ArrayRef<Expr *> VarList,
SourceLocation StartLoc,

View File

@ -113,7 +113,6 @@ ASTNodeKind ASTNodeKind::getFromNode(const OMPClause &C) {
#define OPENMP_CLAUSE(Name, Class) \
case OMPC_##Name: return ASTNodeKind(NKI_##Class);
#include "clang/Basic/OpenMPKinds.def"
case OMPC_allocate:
case OMPC_threadprivate:
case OMPC_uniform:
case OMPC_unknown:

View File

@ -74,6 +74,7 @@ const OMPClauseWithPreInit *OMPClauseWithPreInit::get(const OMPClause *C) {
case OMPC_safelen:
case OMPC_simdlen:
case OMPC_allocator:
case OMPC_allocate:
case OMPC_collapse:
case OMPC_private:
case OMPC_shared:
@ -85,7 +86,6 @@ const OMPClauseWithPreInit *OMPClauseWithPreInit::get(const OMPClause *C) {
case OMPC_untied:
case OMPC_mergeable:
case OMPC_threadprivate:
case OMPC_allocate:
case OMPC_flush:
case OMPC_read:
case OMPC_write:
@ -147,6 +147,7 @@ const OMPClauseWithPostUpdate *OMPClauseWithPostUpdate::get(const OMPClause *C)
case OMPC_safelen:
case OMPC_simdlen:
case OMPC_allocator:
case OMPC_allocate:
case OMPC_collapse:
case OMPC_private:
case OMPC_shared:
@ -158,7 +159,6 @@ const OMPClauseWithPostUpdate *OMPClauseWithPostUpdate::get(const OMPClause *C)
case OMPC_untied:
case OMPC_mergeable:
case OMPC_threadprivate:
case OMPC_allocate:
case OMPC_flush:
case OMPC_read:
case OMPC_write:
@ -701,6 +701,25 @@ OMPInReductionClause *OMPInReductionClause::CreateEmpty(const ASTContext &C,
return new (Mem) OMPInReductionClause(N);
}
OMPAllocateClause *
OMPAllocateClause::Create(const ASTContext &C, SourceLocation StartLoc,
SourceLocation LParenLoc, Expr *Allocator,
SourceLocation ColonLoc, SourceLocation EndLoc,
ArrayRef<Expr *> VL) {
// Allocate space for private variables and initializer expressions.
void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(VL.size()));
auto *Clause = new (Mem) OMPAllocateClause(StartLoc, LParenLoc, Allocator,
ColonLoc, EndLoc, VL.size());
Clause->setVarRefs(VL);
return Clause;
}
OMPAllocateClause *OMPAllocateClause::CreateEmpty(const ASTContext &C,
unsigned N) {
void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(N));
return new (Mem) OMPAllocateClause(N);
}
OMPFlushClause *OMPFlushClause::Create(const ASTContext &C,
SourceLocation StartLoc,
SourceLocation LParenLoc,
@ -1264,6 +1283,21 @@ void OMPClausePrinter::VisitOMPClauseList(T *Node, char StartSym) {
}
}
void OMPClausePrinter::VisitOMPAllocateClause(OMPAllocateClause *Node) {
if (Node->varlist_empty())
return;
OS << "allocate";
if (Expr *Allocator = Node->getAllocator()) {
OS << "(";
Allocator->printPretty(OS, nullptr, Policy, 0);
OS << ":";
VisitOMPClauseList(Node, ' ');
} else {
VisitOMPClauseList(Node, '(');
}
OS << ")";
}
void OMPClausePrinter::VisitOMPPrivateClause(OMPPrivateClause *Node) {
if (!Node->varlist_empty()) {
OS << "private";

View File

@ -716,6 +716,11 @@ void OMPClauseProfiler::VisitOMPDeviceClause(const OMPDeviceClause *C) {
void OMPClauseProfiler::VisitOMPMapClause(const OMPMapClause *C) {
VisitOMPClauseList(C);
}
void OMPClauseProfiler::VisitOMPAllocateClause(const OMPAllocateClause *C) {
if (Expr *Allocator = C->getAllocator())
Profiler->VisitStmt(Allocator);
VisitOMPClauseList(C);
}
void OMPClauseProfiler::VisitOMPNumTeamsClause(const OMPNumTeamsClause *C) {
VistOMPClauseWithPreInit(C);
if (C->getNumTeams())

View File

@ -71,8 +71,6 @@ const char *clang::getOpenMPClauseName(OpenMPClauseKind Kind) {
return "uniform";
case OMPC_threadprivate:
return "threadprivate or thread local";
case OMPC_allocate:
return "allocate";
}
llvm_unreachable("Invalid OpenMP clause kind");
}
@ -149,13 +147,13 @@ unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind,
.Default(OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown);
case OMPC_unknown:
case OMPC_threadprivate:
case OMPC_allocate:
case OMPC_if:
case OMPC_final:
case OMPC_num_threads:
case OMPC_safelen:
case OMPC_simdlen:
case OMPC_allocator:
case OMPC_allocate:
case OMPC_collapse:
case OMPC_private:
case OMPC_firstprivate:
@ -332,13 +330,13 @@ const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind,
llvm_unreachable("Invalid OpenMP 'atomic_default_mem_order' clause type");
case OMPC_unknown:
case OMPC_threadprivate:
case OMPC_allocate:
case OMPC_if:
case OMPC_final:
case OMPC_num_threads:
case OMPC_safelen:
case OMPC_simdlen:
case OMPC_allocator:
case OMPC_allocate:
case OMPC_collapse:
case OMPC_private:
case OMPC_firstprivate:

View File

@ -3950,6 +3950,7 @@ static void emitOMPAtomicExpr(CodeGenFunction &CGF, OpenMPClauseKind Kind,
case OMPC_safelen:
case OMPC_simdlen:
case OMPC_allocator:
case OMPC_allocate:
case OMPC_collapse:
case OMPC_default:
case OMPC_seq_cst:
@ -3965,7 +3966,6 @@ static void emitOMPAtomicExpr(CodeGenFunction &CGF, OpenMPClauseKind Kind,
case OMPC_nowait:
case OMPC_untied:
case OMPC_threadprivate:
case OMPC_allocate:
case OMPC_depend:
case OMPC_mergeable:
case OMPC_device:

View File

@ -1562,7 +1562,7 @@ bool Parser::ParseOpenMPSimpleVarList(
/// thread_limit-clause | priority-clause | grainsize-clause |
/// nogroup-clause | num_tasks-clause | hint-clause | to-clause |
/// from-clause | is_device_ptr-clause | task_reduction-clause |
/// in_reduction-clause | allocator-clause
/// in_reduction-clause | allocator-clause | allocate-clause
///
OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind DKind,
OpenMPClauseKind CKind, bool FirstClause) {
@ -1708,6 +1708,7 @@ OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind DKind,
case OMPC_from:
case OMPC_use_device_ptr:
case OMPC_is_device_ptr:
case OMPC_allocate:
Clause = ParseOpenMPVarListClause(DKind, CKind, WrongDirective);
break;
case OMPC_unknown:
@ -1716,7 +1717,6 @@ OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind DKind,
SkipUntil(tok::annot_pragma_openmp_end, StopBeforeMatch);
break;
case OMPC_threadprivate:
case OMPC_allocate:
case OMPC_uniform:
if (!WrongDirective)
Diag(Tok, diag::err_omp_unexpected_clause)
@ -2306,6 +2306,31 @@ bool Parser::ParseOpenMPVarList(OpenMPDirectiveKind DKind,
ConsumeToken();
}
}
} else if (Kind == OMPC_allocate) {
// Handle optional allocator expression followed by colon delimiter.
ColonProtectionRAIIObject ColonRAII(*this);
TentativeParsingAction TPA(*this);
ExprResult Tail =
Actions.CorrectDelayedTyposInExpr(ParseAssignmentExpression());
Tail = Actions.ActOnFinishFullExpr(Tail.get(), T.getOpenLocation(),
/*DiscardedValue=*/false);
if (Tail.isUsable()) {
if (Tok.is(tok::colon)) {
Data.TailExpr = Tail.get();
Data.ColonLoc = ConsumeToken();
TPA.Commit();
} else {
// colon not found, no allocator specified, parse only list of
// variables.
TPA.Revert();
}
} else {
// Parsing was unsuccessfull, revert and skip to the end of clause or
// directive.
TPA.Revert();
SkipUntil(tok::comma, tok::r_paren, tok::annot_pragma_openmp_end,
StopBeforeMatch);
}
}
bool IsComma =
@ -2410,6 +2435,8 @@ bool Parser::ParseOpenMPVarList(OpenMPDirectiveKind DKind,
/// 'use_device_ptr' '(' list ')'
/// is_device_ptr-clause:
/// 'is_device_ptr' '(' list ')'
/// allocate-clause:
/// 'allocate' '(' [ allocator ':' ] list ')'
///
/// For 'linear' clause linear-list may have the following forms:
/// list

View File

@ -10152,6 +10152,10 @@ OMPClause *Sema::ActOnOpenMPVarListClause(
case OMPC_is_device_ptr:
Res = ActOnOpenMPIsDevicePtrClause(VarList, Locs);
break;
case OMPC_allocate:
Res = ActOnOpenMPAllocateClause(TailExpr, VarList, StartLoc, LParenLoc,
ColonLoc, EndLoc);
break;
case OMPC_if:
case OMPC_final:
case OMPC_num_threads:
@ -10167,7 +10171,6 @@ OMPClause *Sema::ActOnOpenMPVarListClause(
case OMPC_untied:
case OMPC_mergeable:
case OMPC_threadprivate:
case OMPC_allocate:
case OMPC_read:
case OMPC_write:
case OMPC_update:
@ -14700,3 +14703,55 @@ OMPClause *Sema::ActOnOpenMPIsDevicePtrClause(ArrayRef<Expr *> VarList,
MVLI.VarBaseDeclarations,
MVLI.VarComponents);
}
OMPClause *Sema::ActOnOpenMPAllocateClause(
Expr *Allocator, ArrayRef<Expr *> VarList, SourceLocation StartLoc,
SourceLocation ColonLoc, SourceLocation LParenLoc, SourceLocation EndLoc) {
if (Allocator) {
// OpenMP [2.11.4 allocate Clause, Description]
// allocator is an expression of omp_allocator_handle_t type.
if (!findOMPAllocatorHandleT(*this, Allocator->getExprLoc(), DSAStack))
return nullptr;
ExprResult AllocatorRes = DefaultLvalueConversion(Allocator);
if (AllocatorRes.isInvalid())
return nullptr;
AllocatorRes = PerformImplicitConversion(AllocatorRes.get(),
DSAStack->getOMPAllocatorHandleT(),
Sema::AA_Initializing,
/*AllowExplicit=*/true);
if (AllocatorRes.isInvalid())
return nullptr;
Allocator = AllocatorRes.get();
}
// Analyze and build list of variables.
SmallVector<Expr *, 8> Vars;
for (Expr *RefExpr : VarList) {
assert(RefExpr && "NULL expr in OpenMP private clause.");
SourceLocation ELoc;
SourceRange ERange;
Expr *SimpleRefExpr = RefExpr;
auto Res = getPrivateItem(*this, SimpleRefExpr, ELoc, ERange);
if (Res.second) {
// It will be analyzed later.
Vars.push_back(RefExpr);
}
ValueDecl *D = Res.first;
if (!D)
continue;
auto *VD = dyn_cast<VarDecl>(D);
DeclRefExpr *Ref = nullptr;
if (!VD && !CurContext->isDependentContext())
Ref = buildCapture(*this, D, SimpleRefExpr, /*WithInit=*/false);
Vars.push_back((VD || CurContext->isDependentContext())
? RefExpr->IgnoreParens()
: Ref);
}
if (Vars.empty())
return nullptr;
return OMPAllocateClause::Create(Context, StartLoc, LParenLoc, Allocator,
ColonLoc, EndLoc, Vars);
}

View File

@ -1827,6 +1827,19 @@ public:
VarList, Locs, UnresolvedMappers);
}
/// Build a new OpenMP 'allocate' clause.
///
/// By default, performs semantic analysis to build the new OpenMP clause.
/// Subclasses may override this routine to provide different behavior.
OMPClause *RebuildOMPAllocateClause(Expr *Allocate, ArrayRef<Expr *> VarList,
SourceLocation StartLoc,
SourceLocation LParenLoc,
SourceLocation ColonLoc,
SourceLocation EndLoc) {
return getSema().ActOnOpenMPAllocateClause(Allocate, VarList, StartLoc,
LParenLoc, ColonLoc, EndLoc);
}
/// Build a new OpenMP 'num_teams' clause.
///
/// By default, performs semantic analysis to build the new statement.
@ -8906,6 +8919,29 @@ OMPClause *TreeTransform<Derived>::TransformOMPMapClause(OMPMapClause *C) {
C->getColonLoc(), Vars, Locs, UnresolvedMappers);
}
template <typename Derived>
OMPClause *
TreeTransform<Derived>::TransformOMPAllocateClause(OMPAllocateClause *C) {
Expr *Allocator = C->getAllocator();
if (Allocator) {
ExprResult AllocatorRes = getDerived().TransformExpr(Allocator);
if (AllocatorRes.isInvalid())
return nullptr;
Allocator = AllocatorRes.get();
}
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().RebuildOMPAllocateClause(
Allocator, Vars, C->getBeginLoc(), C->getLParenLoc(), C->getColonLoc(),
C->getEndLoc());
}
template <typename Derived>
OMPClause *
TreeTransform<Derived>::TransformOMPNumTeamsClause(OMPNumTeamsClause *C) {

View File

@ -11884,6 +11884,9 @@ OMPClause *OMPClauseReader::readClause() {
C = OMPIsDevicePtrClause::CreateEmpty(Context, Sizes);
break;
}
case OMPC_allocate:
C = OMPAllocateClause::CreateEmpty(Context, Record.readInt());
break;
}
Visit(C);
C->setLocStart(Record.readSourceLocation());
@ -12379,6 +12382,18 @@ void OMPClauseReader::VisitOMPMapClause(OMPMapClause *C) {
C->setComponents(Components, ListSizes);
}
void OMPClauseReader::VisitOMPAllocateClause(OMPAllocateClause *C) {
C->setLParenLoc(Record.readSourceLocation());
C->setColonLoc(Record.readSourceLocation());
C->setAllocator(Record.readSubExpr());
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::VisitOMPNumTeamsClause(OMPNumTeamsClause *C) {
VisitOMPClauseWithPreInit(C);
C->setNumTeams(Record.readSubExpr());

View File

@ -6831,6 +6831,15 @@ void OMPClauseWriter::VisitOMPMapClause(OMPMapClause *C) {
}
}
void OMPClauseWriter::VisitOMPAllocateClause(OMPAllocateClause *C) {
Record.push_back(C->varlist_size());
Record.AddSourceLocation(C->getLParenLoc());
Record.AddSourceLocation(C->getColonLoc());
Record.AddStmt(C->getAllocator());
for (auto *VE : C->varlists())
Record.AddStmt(VE);
}
void OMPClauseWriter::VisitOMPNumTeamsClause(OMPNumTeamsClause *C) {
VisitOMPClauseWithPreInit(C);
Record.AddStmt(C->getNumTeams());

View File

@ -7,7 +7,8 @@ struct St{
};
int sss;
#pragma omp allocate(sss) allocate // expected-warning {{extra tokens at the end of '#pragma omp allocate' are ignored}}
#pragma omp allocate(sss) allocat // expected-warning {{extra tokens at the end of '#pragma omp allocate' are ignored}}
#pragma omp allocate(sss) allocate(sss) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp allocate'}}
#pragma omp allocate(sss) allocator // expected-error {{expected '(' after 'allocator'}}
#pragma omp allocate(sss) allocator(0, // expected-error {{expected ')'}} expected-error {{omp_allocator_handle_t type not found; include <omp.h>}} expected-note {{to match this '('}}
#pragma omp allocate(sss) allocator(0,sss // expected-error {{expected ')'}} expected-error {{omp_allocator_handle_t type not found; include <omp.h>}} expected-note {{to match this '('}}

View File

@ -59,8 +59,8 @@ int readint() {
int readS() {
struct S a, b;
// expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'read' clause}}
#pragma omp atomic read read
// expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'read' clause}} expected-error@+1 {{unexpected OpenMP clause 'allocate' in directive '#pragma omp atomic'}}
#pragma omp atomic read read allocate(a)
// expected-error@+2 {{the statement for 'atomic read' must be an expression statement of form 'v = x;', where v and x are both lvalue expressions with scalar type}}
// expected-note@+1 {{expected expression of scalar type}}
a = b;

View File

@ -6,6 +6,7 @@ template <class T>
T tmain(T argc) {
#pragma omp barrier
;
#pragma omp barrier allocate(argc) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp barrier'}}
#pragma omp barrier untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp barrier'}}
#pragma omp barrier unknown // expected-warning {{extra tokens at the end of '#pragma omp barrier' are ignored}}
if (argc)

View File

@ -45,7 +45,7 @@ int main(int argc, char **argv) {
}
#pragma omp sections
{
#pragma omp cancel parallel // expected-error {{region cannot be closely nested inside 'sections' region}}
#pragma omp cancel parallel allocate(argc) // expected-error {{region cannot be closely nested inside 'sections' region}} expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp cancel'}}
}
while (argc)
#pragma omp cancel for // expected-error {{'#pragma omp cancel' cannot be an immediate substatement}} expected-error {{orphaned 'omp cancel' directives are prohibited; perhaps you forget to enclose the directive into a region?}}

View File

@ -10,7 +10,7 @@ int main(int argc, char **argv) {
{
#pragma omp cancellation point // expected-error {{one of 'for', 'parallel', 'sections' or 'taskgroup' is expected}}
}
#pragma omp cancellation point parallel untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp cancellation point'}} expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}}
#pragma omp cancellation point parallel untied allocate(argc) // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp cancellation point'}} expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}} expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp cancellation point'}}
#pragma omp cancellation point unknown // expected-error {{one of 'for', 'parallel', 'sections' or 'taskgroup' is expected}}
#pragma omp parallel
{

View File

@ -8,7 +8,7 @@ template<typename T, int N>
int tmain(int argc, char **argv) { // expected-note {{declared here}}
#pragma omp critical
;
#pragma omp critical untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp critical'}}
#pragma omp critical untied allocate(argc) // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp critical'}} expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp critical'}}
#pragma omp critical unknown // expected-warning {{extra tokens at the end of '#pragma omp critical' are ignored}}
#pragma omp critical ( // expected-error {{expected identifier}} expected-error {{expected ')'}} expected-note {{to match this '('}}
#pragma omp critical ( + // expected-error {{expected identifier}} expected-error {{expected ')'}} expected-note {{to match this '('}}

View File

@ -34,7 +34,7 @@ int fun(int arg) {
#pragma omp declare mapper(id: struct vec v) map(v.len) // expected-note {{previous definition is here}}
#pragma omp declare mapper(id: struct vec v) map(v.len) // expected-error {{redefinition of user-defined mapper for type 'struct vec' with name 'id'}}
{
#pragma omp declare mapper(id: struct vec v) map(v.len)
#pragma omp declare mapper(id: struct vec v) map(v.len) allocate(v) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp declare mapper'}}
struct vec vv, v1;
#pragma omp target map(mapper) // expected-error {{use of undeclared identifier 'mapper'}}
{}

View File

@ -147,7 +147,7 @@ struct A {
int A_TEST() {
A test;
#pragma omp declare reduction(+ : A : omp_out) initializer(omp_priv = A())
#pragma omp declare reduction(+ : A : omp_out) initializer(omp_priv = A()) allocate(test) // expected-warning {{extra tokens at the end of '#pragma omp declare reduction' are ignored}}
#pragma omp parallel reduction(+ : test)
{}
return 0;

View File

@ -195,8 +195,8 @@ void test() {
#pragma omp declare simd linear(uval(b))
// expected-error@+1 {{variable of non-reference type 'int *' can be used only with 'val' modifier, but used with 'ref'}}
#pragma omp declare simd linear(ref(b))
// expected-error@+1 {{expected one of 'ref', val' or 'uval' modifiers}}
#pragma omp declare simd linear(uref(b))
// expected-error@+1 {{expected one of 'ref', val' or 'uval' modifiers}} expected-warning@+1 {{extra tokens at the end of '#pragma omp declare simd' are ignored}}
#pragma omp declare simd linear(uref(b)) allocate(b)
void bar(int a, int *b);
template <class T>

View File

@ -23,7 +23,7 @@ void c();
void func() {} // expected-note {{'func' defined here}}
#pragma omp declare target link(func) // expected-error {{function name is not allowed in 'link' clause}}
#pragma omp declare target link(func) allocate(a) // expected-error {{function name is not allowed in 'link' clause}} expected-error {{unexpected 'allocate' clause, only 'to' or 'link' clauses expected}}
extern int b;

View File

@ -29,14 +29,14 @@ public:
S7(typename T::type v) : a(v) {
#pragma omp target
#pragma omp teams
#pragma omp distribute private(a) private(this->a) private(T::a)
#pragma omp distribute private(a) private(this->a) private(T::a) allocate(a)
for (int k = 0; k < a.a; ++k)
++this->a.a;
}
S7 &operator=(S7 &s) {
#pragma omp target
#pragma omp teams
#pragma omp distribute private(a) private(this->a)
#pragma omp distribute allocate(a) private(a) private(this->a)
for (int k = 0; k < s.a.a; ++k)
++s.a.a;
return *this;
@ -45,13 +45,13 @@ public:
// CHECK: #pragma omp target
// CHECK-NEXT: #pragma omp teams
// CHECK-NEXT: #pragma omp distribute private(this->a) private(this->a) private(T::a)
// CHECK-NEXT: #pragma omp distribute private(this->a) private(this->a) private(T::a) allocate(this->a)
// CHECK: #pragma omp target
// CHECK-NEXT: #pragma omp teams
// CHECK-NEXT: #pragma omp distribute private(this->a) private(this->a)
// CHECK-NEXT: #pragma omp distribute allocate(this->a) private(this->a) private(this->a)
// CHECK: #pragma omp target
// CHECK-NEXT: #pragma omp teams
// CHECK-NEXT: #pragma omp distribute private(this->a) private(this->a) private(this->S::a)
// CHECK-NEXT: #pragma omp distribute private(this->a) private(this->a) private(this->S::a) allocate(this->a)
class S8 : public S7<S> {
S8() {}

View File

@ -54,6 +54,8 @@ public:
S6() : a(0) { }
};
extern int omp_default_mem_alloc;
S3 h;
#pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}}
@ -85,7 +87,7 @@ int main(int argc, char **argv) {
for (i = 0; i < argc; ++i) foo();
#pragma omp target
#pragma omp teams
#pragma omp distribute firstprivate (argc)
#pragma omp distribute firstprivate (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target
#pragma omp teams

View File

@ -78,15 +78,15 @@ T tmain(T argc) {
#pragma omp threadprivate(g)
#pragma omp target
#pragma omp teams
#pragma omp distribute parallel for dist_schedule(static, a) schedule(dynamic) default(none) copyin(g) firstprivate(a)
// CHECK: #pragma omp distribute parallel for dist_schedule(static, a) schedule(dynamic) default(none) copyin(g)
#pragma omp distribute parallel for dist_schedule(static, a) schedule(dynamic) default(none) copyin(g) firstprivate(a) allocate(a)
// CHECK: #pragma omp distribute parallel for dist_schedule(static, a) schedule(dynamic) default(none) copyin(g) firstprivate(a) allocate(a)
for (int i = 0; i < 2; ++i)
a = 2;
// CHECK-NEXT: for (int i = 0; i < 2; ++i)
// CHECK-NEXT: a = 2;
#pragma omp target
#pragma omp teams
#pragma omp distribute parallel for private(argc, b), firstprivate(c, d), lastprivate(f) collapse(N) schedule(static, N) if (parallel :argc) num_threads(N) default(shared) shared(e) reduction(+ : h) dist_schedule(static,N)
#pragma omp distribute parallel for allocate(argc) private(argc, b), firstprivate(c, d), lastprivate(f) collapse(N) schedule(static, N) if (parallel :argc) num_threads(N) default(shared) shared(e) reduction(+ : h) dist_schedule(static,N)
for (int i = 0; i < 2; ++i)
for (int j = 0; j < 2; ++j)
for (int j = 0; j < 2; ++j)
@ -98,7 +98,7 @@ T tmain(T argc) {
for (int j = 0; j < 2; ++j)
for (int j = 0; j < 2; ++j)
a++;
// CHECK: #pragma omp distribute parallel for private(argc,b) firstprivate(c,d) lastprivate(f) collapse(N) schedule(static, N) if(parallel: argc) num_threads(N) default(shared) shared(e) reduction(+: h) dist_schedule(static, N)
// CHECK: #pragma omp distribute parallel for allocate(argc) private(argc,b) firstprivate(c,d) lastprivate(f) collapse(N) schedule(static, N) if(parallel: argc) num_threads(N) default(shared) shared(e) reduction(+: h) dist_schedule(static, N)
// CHECK-NEXT: for (int i = 0; i < 2; ++i)
// CHECK-NEXT: for (int j = 0; j < 2; ++j)
// CHECK-NEXT: for (int j = 0; j < 2; ++j)

View File

@ -8,6 +8,7 @@ void foo() {
bool foobool(int argc) {
return argc;
}
extern int omp_default_mem_alloc;
struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
extern S1 a;
@ -100,7 +101,7 @@ int foomain(int argc, char **argv) {
++k;
#pragma omp target
#pragma omp teams
#pragma omp distribute parallel for firstprivate(argc)
#pragma omp distribute parallel for firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp target

View File

@ -8,7 +8,7 @@ void foo() {
bool foobool(int argc) {
return argc;
}
extern int omp_default_mem_alloc;
struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
extern S1 a;
class S2 {
@ -102,7 +102,7 @@ int foomain(int argc, char **argv) {
++k;
#pragma omp target
#pragma omp teams
#pragma omp distribute parallel for lastprivate(argc)
#pragma omp distribute parallel for lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp target

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -34,7 +35,7 @@ public:
S4(int v) : a(v) {
#pragma omp target
#pragma omp teams
#pragma omp distribute parallel for private(a) private(this->a)
#pragma omp distribute parallel for private(a) private(this->a) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: a, allocate(omp_default_mem_alloc: a), allocate(a) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int k = 0; k < v; ++k)
++this->a;
}

View File

@ -6,6 +6,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s
// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -150,7 +151,7 @@ T tmain(T argc) {
foo();
#pragma omp target
#pragma omp teams
#pragma omp distribute parallel for reduction(&& : argc)
#pragma omp distribute parallel for reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp target

View File

@ -79,15 +79,15 @@ T tmain(T argc) {
#pragma omp threadprivate(g)
#pragma omp target
#pragma omp teams
#pragma omp distribute parallel for simd dist_schedule(static, a) schedule(dynamic) default(none) copyin(g) firstprivate(a)
// CHECK: #pragma omp distribute parallel for simd dist_schedule(static, a) schedule(dynamic) default(none) copyin(g)
#pragma omp distribute parallel for simd dist_schedule(static, a) schedule(dynamic) default(none) copyin(g) firstprivate(a) allocate(a)
// CHECK: #pragma omp distribute parallel for simd dist_schedule(static, a) schedule(dynamic) default(none) copyin(g) firstprivate(a) allocate(a)
for (int i = 0; i < 2; ++i)
a = 2;
// CHECK-NEXT: for (int i = 0; i < 2; ++i)
// CHECK-NEXT: a = 2;
#pragma omp target
#pragma omp teams
#pragma omp distribute parallel for simd private(argc, b), firstprivate(c, d), lastprivate(f) collapse(N) schedule(static, N) if (parallel :argc) num_threads(N) default(shared) shared(e) reduction(+ : h) dist_schedule(static,N)
#pragma omp distribute parallel for simd allocate(argc) private(argc, b), firstprivate(c, d), lastprivate(f) collapse(N) schedule(static, N) if (parallel :argc) num_threads(N) default(shared) shared(e) reduction(+ : h) dist_schedule(static,N)
for (int i = 0; i < 2; ++i)
for (int j = 0; j < 2; ++j)
for (int j = 0; j < 2; ++j)
@ -99,7 +99,7 @@ T tmain(T argc) {
for (int j = 0; j < 2; ++j)
for (int j = 0; j < 2; ++j)
a++;
// CHECK: #pragma omp distribute parallel for simd private(argc,b) firstprivate(c,d) lastprivate(f) collapse(N) schedule(static, N) if(parallel: argc) num_threads(N) default(shared) shared(e) reduction(+: h) dist_schedule(static, N)
// CHECK: #pragma omp distribute parallel for simd allocate(argc) private(argc,b) firstprivate(c,d) lastprivate(f) collapse(N) schedule(static, N) if(parallel: argc) num_threads(N) default(shared) shared(e) reduction(+: h) dist_schedule(static, N)
// CHECK-NEXT: for (int i = 0; i < 2; ++i)
// CHECK-NEXT: for (int j = 0; j < 2; ++j)
// CHECK-NEXT: for (int j = 0; j < 2; ++j)

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wno-openmp-target
extern int omp_default_mem_alloc;
void foo() {
}
@ -222,7 +223,7 @@ int main(int argc, char **argv) {
foo();
#pragma omp target
#pragma omp teams
#pragma omp distribute parallel for simd firstprivate(argc)
#pragma omp distribute parallel for simd firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (i = 0; i < argc; ++i)
foo();
#pragma omp target

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wno-openmp-target
extern int omp_default_mem_alloc;
void foo() {
}
@ -211,7 +212,7 @@ int main(int argc, char **argv) {
foo();
#pragma omp target
#pragma omp teams
#pragma omp distribute parallel for simd lastprivate(argc)
#pragma omp distribute parallel for simd lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (i = 0; i < argc; ++i)
foo();
#pragma omp target

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wno-openmp-target
extern int omp_default_mem_alloc;
namespace X {
int x;
};
@ -283,7 +284,7 @@ int main(int argc, char **argv) {
// expected-error@+3 {{only loop iteration variables are allowed in 'linear' clause in distribute directives}}
#pragma omp target
#pragma omp teams
#pragma omp distribute parallel for simd linear (argc)
#pragma omp distribute parallel for simd linear (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int k = 0; k < argc; ++k) ++k;
#pragma omp target

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -142,7 +143,7 @@ int foomain(I argc, C **argv) {
++k;
#pragma omp target
#pragma omp teams
#pragma omp distribute parallel for simd private(argc)
#pragma omp distribute parallel for simd private(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp target

View File

@ -6,6 +6,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s -Wno-openmp-target
// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s -Wno-openmp-target
extern int omp_default_mem_alloc;
void foo() {
}
@ -334,7 +335,7 @@ int main(int argc, char **argv) {
foo();
#pragma omp target
#pragma omp teams
#pragma omp distribute parallel for simd reduction(&& : argc)
#pragma omp distribute parallel for simd reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp target

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp-simd -ferror-limit 100 %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -63,7 +64,7 @@ int main(int argc, char **argv) {
for (int k = 0; k < argc; ++k) ++k;
#pragma omp distribute private (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
for (int k = 0; k < argc; ++k) ++k;
#pragma omp distribute private (argc)
#pragma omp distribute private (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int k = 0; k < argc; ++k) ++k;
#pragma omp distribute private (S1) // expected-error {{'S1' does not refer to a value}}
for (int k = 0; k < argc; ++k) ++k;

View File

@ -27,23 +27,23 @@ public:
S7(typename T::type v) : a(v) {
#pragma omp target
#pragma omp teams
#pragma omp distribute simd private(a) private(this->a) private(T::a)
#pragma omp distribute simd private(a) private(this->a) private(T::a) allocate(T::a)
for (int k = 0; k < a.a; ++k)
++this->a.a;
}
S7 &operator=(S7 &s) {
#pragma omp target
#pragma omp teams
#pragma omp distribute simd private(a) private(this->a)
#pragma omp distribute simd allocate(a) private(a) private(this->a)
for (int k = 0; k < s.a.a; ++k)
++s.a.a;
return *this;
}
};
// CHECK: #pragma omp distribute simd private(this->a) private(this->a) private(T::a){{$}}
// CHECK: #pragma omp distribute simd private(this->a) private(this->a)
// CHECK: #pragma omp distribute simd private(this->a) private(this->a) private(this->S::a)
// CHECK: #pragma omp distribute simd private(this->a) private(this->a) private(T::a) allocate(T::a){{$}}
// CHECK: #pragma omp distribute simd allocate(this->a) private(this->a) private(this->a)
// CHECK: #pragma omp distribute simd private(this->a) private(this->a) private(this->S::a) allocate(this->S::a)
class S8 : public S7<S> {
S8() {}

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -100,7 +101,7 @@ int foomain(int argc, char **argv) {
++k;
#pragma omp target
#pragma omp teams
#pragma omp distribute simd firstprivate(argc)
#pragma omp distribute simd firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp target

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -211,7 +212,7 @@ int main(int argc, char **argv) {
foo();
#pragma omp target
#pragma omp teams
#pragma omp distribute simd lastprivate(argc)
#pragma omp distribute simd lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (i = 0; i < argc; ++i)
foo();
#pragma omp target

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
namespace X {
int x;
};
@ -272,7 +273,7 @@ int main(int argc, char **argv) {
// expected-error@+3 {{only loop iteration variables are allowed in 'linear' clause in distribute directives}}
#pragma omp target
#pragma omp teams
#pragma omp distribute simd linear (argc)
#pragma omp distribute simd linear (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int k = 0; k < argc; ++k) ++k;
#pragma omp target

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -142,7 +143,7 @@ int foomain(I argc, C **argv) {
++k;
#pragma omp target
#pragma omp teams
#pragma omp distribute simd private(argc)
#pragma omp distribute simd private(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp target

View File

@ -6,6 +6,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s
// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -150,7 +151,7 @@ T tmain(T argc) {
foo();
#pragma omp target
#pragma omp teams
#pragma omp distribute simd reduction(&& : argc)
#pragma omp distribute simd reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp target

View File

@ -8,7 +8,7 @@ struct S1 { // expected-note 2 {{declared here}}
template <class T>
T tmain(T argc) {
#pragma omp flush
#pragma omp flush allocate(argc) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp flush'}}
;
#pragma omp flush untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp flush'}}
#pragma omp flush unknown // expected-warning {{extra tokens at the end of '#pragma omp flush' are ignored}}

View File

@ -105,14 +105,14 @@ T tmain(T argc) {
T b = argc, c, d, e, f, g;
static T a;
// CHECK: static T a;
#pragma omp for schedule(dynamic) linear(a)
// CHECK-NEXT: #pragma omp for schedule(dynamic) linear(a)
#pragma omp for schedule(dynamic) linear(a) allocate(a)
// CHECK-NEXT: #pragma omp for schedule(dynamic) linear(a) allocate(a)
for (int i = 0; i < 2; ++i)
a = 2;
// CHECK-NEXT: for (int i = 0; i < 2; ++i)
// CHECK-NEXT: a = 2;
#pragma omp parallel
#pragma omp for private(argc, b), firstprivate(c, d), lastprivate(d, f) collapse(N) schedule(static, N) ordered(N) nowait
#pragma omp for allocate(argc) private(argc, b), firstprivate(c, d), lastprivate(d, f) collapse(N) schedule(static, N) ordered(N) nowait
for (int i = 0; i < 2; ++i)
for (int j = 0; j < 2; ++j)
for (int j = 0; j < 2; ++j)
@ -125,7 +125,7 @@ T tmain(T argc) {
for (int j = 0; j < 2; ++j)
foo();
// CHECK-NEXT: #pragma omp parallel
// CHECK-NEXT: #pragma omp for private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N) schedule(static, N) ordered(N) nowait
// CHECK-NEXT: #pragma omp for allocate(argc) private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N) schedule(static, N) ordered(N) nowait
// CHECK-NEXT: for (int i = 0; i < 2; ++i)
// CHECK-NEXT: for (int j = 0; j < 2; ++j)
// CHECK-NEXT: for (int j = 0; j < 2; ++j)

View File

@ -1,6 +1,7 @@
// RUN: %clang_cc1 -verify -fopenmp %s
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -92,7 +93,7 @@ int foomain(int argc, char **argv) {
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel
#pragma omp for firstprivate(argc)
#pragma omp for firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -95,7 +96,7 @@ int foomain(int argc, char **argv) {
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel
#pragma omp for lastprivate(argc)
#pragma omp for lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
namespace X {
int x;
};
@ -117,7 +118,7 @@ template<class I, class C> int foomain(I argc, C **argv) {
for (int k = 0; k < argc; ++k) ++k;
#pragma omp for linear (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
for (int k = 0; k < argc; ++k) ++k;
#pragma omp for linear (argc : 5)
#pragma omp for linear (argc : 5) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int k = 0; k < argc; ++k) ++k;
#pragma omp for linear (S1) // expected-error {{'S1' does not refer to a value}}
for (int k = 0; k < argc; ++k) ++k;

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -116,7 +117,7 @@ int foomain(I argc, C **argv) {
#pragma omp for private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp for private(argc)
#pragma omp for private(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp for private(S1) // expected-error {{'S1' does not refer to a value}}

View File

@ -6,6 +6,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s
// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -295,7 +296,7 @@ int main(int argc, char **argv) {
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel
#pragma omp for reduction(&& : argc)
#pragma omp for reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel

View File

@ -90,7 +90,7 @@ template<class T> struct S {
// CHECK: T res;
// CHECK: T val;
// CHECK: T lin = 0;
#pragma omp for simd private(val) safelen(7) linear(lin : -5) lastprivate(res) simdlen(5)
#pragma omp for simd private(val) safelen(7) linear(lin : -5) lastprivate(res) simdlen(5) allocate(res)
// CHECK-NEXT: #pragma omp for simd private(val) safelen(7) linear(lin: -5) lastprivate(res) simdlen(5)
for (T i = 7; i < m_a; ++i) {
val = v[i-7] + m_a;
@ -117,7 +117,7 @@ template<class T> struct S {
template<int LEN> struct S2 {
static void func(int n, float *a, float *b, float *c) {
int k1 = 0, k2 = 0;
#pragma omp for simd safelen(LEN) linear(k1,k2:LEN) aligned(a:LEN) simdlen(LEN)
#pragma omp for simd allocate(k1) safelen(LEN) linear(k1,k2:LEN) aligned(a:LEN) simdlen(LEN)
for(int i = 0; i < n; i++) {
c[i] = a[i] + b[i];
c[k1] = a[k1] + b[k1];
@ -132,7 +132,7 @@ template<int LEN> struct S2 {
// CHECK: template<> struct S2<4> {
// CHECK-NEXT: static void func(int n, float *a, float *b, float *c) {
// CHECK-NEXT: int k1 = 0, k2 = 0;
// CHECK-NEXT: #pragma omp for simd safelen(4) linear(k1,k2: 4) aligned(a: 4) simdlen(4)
// CHECK-NEXT: #pragma omp for simd allocate(k1) safelen(4) linear(k1,k2: 4) aligned(a: 4) simdlen(4)
// CHECK-NEXT: for (int i = 0; i < n; i++) {
// CHECK-NEXT: c[i] = a[i] + b[i];
// CHECK-NEXT: c[k1] = a[k1] + b[k1];

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -93,7 +94,7 @@ int foomain(int argc, char **argv) {
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel
#pragma omp for simd firstprivate(argc)
#pragma omp for simd firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -95,7 +96,7 @@ int foomain(int argc, char **argv) {
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel
#pragma omp for simd lastprivate(argc)
#pragma omp for simd lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
namespace X {
int x;
};
@ -117,7 +118,7 @@ template<class I, class C> int foomain(I argc, C **argv) {
for (int k = 0; k < argc; ++k) ++k;
#pragma omp for simd linear (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
for (int k = 0; k < argc; ++k) ++k;
#pragma omp for simd linear (argc : 5)
#pragma omp for simd linear (argc : 5) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int k = 0; k < argc; ++k) ++k;
#pragma omp for simd linear (S1) // expected-error {{'S1' does not refer to a value}}
for (int k = 0; k < argc; ++k) ++k;

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -116,7 +117,7 @@ int foomain(I argc, C **argv) {
#pragma omp for simd private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp for simd private(argc)
#pragma omp for simd private(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp for simd private(S1) // expected-error {{'S1' does not refer to a value}}

View File

@ -6,6 +6,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 %s
// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -137,7 +138,7 @@ T tmain(T argc) {
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel
#pragma omp for simd reduction(&& : argc)
#pragma omp for simd reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel

View File

@ -28,7 +28,7 @@ int main() {
#pragma omp single
for (int i = 0; i < 10; ++i) {
foo();
#pragma omp master // expected-error {{region cannot be closely nested inside 'single' region}}
#pragma omp master allocate(i) // expected-error {{region cannot be closely nested inside 'single' region}} expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp master'}}
foo();
}
#pragma omp master

View File

@ -262,7 +262,7 @@ int k;
#pragma omp ordered simd depend(source) // expected-error {{'depend' clauses cannot be mixed with 'simd' clause}}
#pragma omp ordered depend(source) depend(source) // expected-error {{directive '#pragma omp ordered' cannot contain more than one 'depend' clause with 'source' dependence}}
#pragma omp ordered depend(in : i) // expected-error {{expected 'source' or 'sink' in OpenMP clause 'depend'}} expected-error {{'ordered' directive without any clauses cannot be closely nested inside ordered region with specified parameter}}
#pragma omp ordered depend(sink : i, j)
#pragma omp ordered depend(sink : i, j) allocate(i) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp ordered'}}
#pragma omp ordered depend(sink : j, i) // expected-error {{expected 'i' loop iteration variable}} expected-error {{expected 'j' loop iteration variable}}
#pragma omp ordered depend(sink : i, j, k) // expected-error {{unexpected expression: number of expressions is larger than the number of associated loops}}
#pragma omp ordered depend(sink : i+foo(), j/4) // expected-error {{expression is not an integral constant expression}} expected-error {{expected '+' or '-' operation}}

View File

@ -205,13 +205,13 @@ int main (int argc, char **argv) {
// CHECK-NEXT: #pragma omp parallel
a=2;
// CHECK-NEXT: a = 2;
#pragma omp parallel default(none), private(argc,b) firstprivate(argv) if (parallel: argc > 0) num_threads(ee) copyin(a) proc_bind(spread) reduction(| : c, d, arr1[argc]) reduction(* : e, arr[:10][0:argc])
// CHECK-NEXT: #pragma omp parallel default(none) private(argc,b) firstprivate(argv) if(parallel: argc > 0) num_threads(ee) copyin(a) proc_bind(spread) reduction(|: c,d,arr1[argc]) reduction(*: e,arr[:10][0:argc])
#pragma omp parallel default(none), private(argc,b) firstprivate(argv) if (parallel: argc > 0) num_threads(ee) copyin(a) proc_bind(spread) reduction(| : c, d, arr1[argc]) reduction(* : e, arr[:10][0:argc]) allocate(e)
// CHECK-NEXT: #pragma omp parallel default(none) private(argc,b) firstprivate(argv) if(parallel: argc > 0) num_threads(ee) copyin(a) proc_bind(spread) reduction(|: c,d,arr1[argc]) reduction(*: e,arr[:10][0:argc]) allocate(e)
foo();
// CHECK-NEXT: foo();
// CHECK-NEXT: #pragma omp parallel if(b) num_threads(c) proc_bind(close) reduction(^: e,f) reduction(&&: g,arr[0:argc][:10])
// CHECK-NEXT: #pragma omp parallel allocate(e) if(b) num_threads(c) proc_bind(close) reduction(^: e,f) reduction(&&: g,arr[0:argc][:10])
// CHECK-NEXT: foo()
#pragma omp parallel if (b) num_threads(c) proc_bind(close) reduction(^:e, f) reduction(&& : g, arr[0:argc][:10])
#pragma omp parallel allocate(e) if (b) num_threads(c) proc_bind(close) reduction(^:e, f) reduction(&& : g, arr[0:argc][:10])
foo();
return tmain<int, 5>(b, &b) + tmain<long, 1>(x, &x);
}

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -71,7 +72,7 @@ int main(int argc, char **argv) {
#pragma omp parallel firstprivate (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
#pragma omp parallel firstprivate (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
#pragma omp parallel firstprivate (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
#pragma omp parallel firstprivate (argc)
#pragma omp parallel firstprivate (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
#pragma omp parallel firstprivate (S1) // expected-error {{'S1' does not refer to a value}}
#pragma omp parallel firstprivate (a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}}
#pragma omp parallel firstprivate (d)

View File

@ -70,13 +70,13 @@ T tmain(T argc) {
// CHECK: static T a;
static T g;
#pragma omp threadprivate(g)
#pragma omp parallel for schedule(dynamic) default(none) copyin(g) linear(a)
// CHECK: #pragma omp parallel for schedule(dynamic) default(none) copyin(g) linear(a)
#pragma omp parallel for schedule(dynamic) default(none) copyin(g) linear(a) allocate(a)
// CHECK: #pragma omp parallel for schedule(dynamic) default(none) copyin(g) linear(a) allocate(a)
for (int i = 0; i < 2; ++i)
a = 2;
// CHECK-NEXT: for (int i = 0; i < 2; ++i)
// CHECK-NEXT: a = 2;
#pragma omp parallel for private(argc, b), firstprivate(c, d), lastprivate(d, f) collapse(N) schedule(static, N) ordered(N) if (parallel :argc) num_threads(N) default(shared) shared(e) reduction(+ : h)
#pragma omp parallel for allocate(argc) private(argc, b), firstprivate(c, d), lastprivate(d, f) collapse(N) schedule(static, N) ordered(N) if (parallel :argc) num_threads(N) default(shared) shared(e) reduction(+ : h)
for (int i = 0; i < 2; ++i)
for (int j = 0; j < 2; ++j)
for (int j = 0; j < 2; ++j)
@ -88,7 +88,7 @@ T tmain(T argc) {
for (int j = 0; j < 2; ++j)
for (int j = 0; j < 2; ++j)
foo();
// CHECK-NEXT: #pragma omp parallel for private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N) schedule(static, N) ordered(N) if(parallel: argc) num_threads(N) default(shared) shared(e) reduction(+: h)
// CHECK-NEXT: #pragma omp parallel for allocate(argc) private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N) schedule(static, N) ordered(N) if(parallel: argc) num_threads(N) default(shared) shared(e) reduction(+: h)
// CHECK-NEXT: for (int i = 0; i < 2; ++i)
// CHECK-NEXT: for (int j = 0; j < 2; ++j)
// CHECK-NEXT: for (int j = 0; j < 2; ++j)

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -86,7 +87,7 @@ int foomain(int argc, char **argv) {
#pragma omp parallel for firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel for firstprivate(argc)
#pragma omp parallel for firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel for firstprivate(S1) // expected-error {{'S1' does not refer to a value}}

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -88,7 +89,7 @@ int foomain(int argc, char **argv) {
#pragma omp parallel for lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel for lastprivate(argc)
#pragma omp parallel for lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel for lastprivate(S1) // expected-error {{'S1' does not refer to a value}}

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
namespace X {
int x;
};
@ -42,7 +43,7 @@ void test_linear_colons() {
#pragma omp parallel for linear(B, ::z, X::x)
for (int i = 0; i < 10; ++i)
;
#pragma omp parallel for linear(::z)
#pragma omp parallel for linear(::z) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int i = 0; i < 10; ++i)
;
// expected-error@+1 {{expected variable name}}

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -116,7 +117,7 @@ int foomain(I argc, C **argv) {
#pragma omp parallel for private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel for private(argc)
#pragma omp parallel for private(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel for private(S1) // expected-error {{'S1' does not refer to a value}}

View File

@ -6,6 +6,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s
// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -130,7 +131,7 @@ T tmain(T argc) {
#pragma omp parallel for reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel for reduction(&& : argc)
#pragma omp parallel for reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel for reduction(^ : T) // expected-error {{'T' does not refer to a value}}

View File

@ -91,8 +91,8 @@ template<class T> struct S {
// CHECK: T res;
// CHECK: T val;
// CHECK: T lin = 0;
#pragma omp parallel for simd private(val) safelen(7) linear(lin : -5) lastprivate(res) simdlen(5) if(7)
// CHECK-NEXT: #pragma omp parallel for simd private(val) safelen(7) linear(lin: -5) lastprivate(res) simdlen(5) if(7)
#pragma omp parallel for simd private(val) safelen(7) linear(lin : -5) lastprivate(res) simdlen(5) if(7) allocate(lin)
// CHECK-NEXT: #pragma omp parallel for simd private(val) safelen(7) linear(lin: -5) lastprivate(res) simdlen(5) if(7) allocate(lin)
for (T i = 7; i < m_a; ++i) {
val = v[i-7] + m_a;
res = val;
@ -118,7 +118,7 @@ template<class T> struct S {
template<int LEN> struct S2 {
static void func(int n, float *a, float *b, float *c) {
int k1 = 0, k2 = 0;
#pragma omp parallel for simd safelen(LEN) linear(k1,k2:LEN) aligned(a:LEN) simdlen(LEN)
#pragma omp parallel for simd allocate(k1) safelen(LEN) linear(k1,k2:LEN) aligned(a:LEN) simdlen(LEN)
for(int i = 0; i < n; i++) {
c[i] = a[i] + b[i];
c[k1] = a[k1] + b[k1];
@ -133,7 +133,7 @@ template<int LEN> struct S2 {
// CHECK: template<> struct S2<4> {
// CHECK-NEXT: static void func(int n, float *a, float *b, float *c) {
// CHECK-NEXT: int k1 = 0, k2 = 0;
// CHECK-NEXT: #pragma omp parallel for simd safelen(4) linear(k1,k2: 4) aligned(a: 4) simdlen(4)
// CHECK-NEXT: #pragma omp parallel for simd allocate(k1) safelen(4) linear(k1,k2: 4) aligned(a: 4) simdlen(4)
// CHECK-NEXT: for (int i = 0; i < n; i++) {
// CHECK-NEXT: c[i] = a[i] + b[i];
// CHECK-NEXT: c[k1] = a[k1] + b[k1];

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -86,7 +87,7 @@ int foomain(int argc, char **argv) {
#pragma omp parallel for simd firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel for simd firstprivate(argc)
#pragma omp parallel for simd firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel for simd firstprivate(S1) // expected-error {{'S1' does not refer to a value}}

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -87,7 +88,7 @@ int foomain(int argc, char **argv) {
#pragma omp parallel for simd lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel for simd lastprivate(argc)
#pragma omp parallel for simd lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel for simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}}

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
namespace X {
int x;
};
@ -117,7 +118,7 @@ template<class I, class C> int foomain(I argc, C **argv) {
for (int k = 0; k < argc; ++k) ++k;
#pragma omp parallel for simd linear (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
for (int k = 0; k < argc; ++k) ++k;
#pragma omp parallel for simd linear (argc : 5)
#pragma omp parallel for simd linear (argc : 5) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int k = 0; k < argc; ++k) ++k;
#pragma omp parallel for simd linear (S1) // expected-error {{'S1' does not refer to a value}}
for (int k = 0; k < argc; ++k) ++k;

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -116,7 +117,7 @@ int foomain(I argc, C **argv) {
#pragma omp parallel for simd private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel for simd private(argc)
#pragma omp parallel for simd private(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel for simd private(S1) // expected-error {{'S1' does not refer to a value}}

View File

@ -6,6 +6,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -o - %s
// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -o - %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -124,7 +125,7 @@ T tmain(T argc) {
#pragma omp parallel for simd reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel for simd reduction(&& : argc)
#pragma omp parallel for simd reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp parallel for simd reduction(^ : T) // expected-error {{'T' does not refer to a value}}

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -68,7 +69,7 @@ int main(int argc, char **argv) {
#pragma omp parallel private (S1) // expected-error {{'S1' does not refer to a value}}
#pragma omp parallel private (a, b, c, d, f) // expected-error {{a private variable with incomplete type 'S1'}} expected-error 1 {{const-qualified variable without mutable fields cannot be private}} expected-error 2 {{const-qualified variable cannot be private}}
#pragma omp parallel private (argv[1]) // expected-error {{expected variable name}}
#pragma omp parallel private(ba)
#pragma omp parallel private(ba) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
#pragma omp parallel private(ca) // expected-error {{const-qualified variable without mutable fields cannot be private}}
#pragma omp parallel private(da) // expected-error {{const-qualified variable cannot be private}}
#pragma omp parallel private(S2::S2s) // expected-error {{shared variable cannot be private}}

View File

@ -6,6 +6,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s
// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -112,7 +113,7 @@ T tmain(T argc) {
foo();
#pragma omp parallel reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}}
foo();
#pragma omp parallel reduction(&& : argc)
#pragma omp parallel reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
foo();
#pragma omp parallel reduction(^ : T) // expected-error {{'T' does not refer to a value}}
foo();

View File

@ -41,11 +41,11 @@ T tmain(T argc, T *argv) {
{
a = 2;
}
#pragma omp parallel sections default(none), private(argc, b) firstprivate(argv) shared(d) if (parallel: argc > 0) num_threads(C) copyin(S < T > ::TS) proc_bind(master) reduction(+ : c) reduction(max : e)
#pragma omp parallel sections default(none), private(argc, b) firstprivate(argv) shared(d) if (parallel: argc > 0) num_threads(C) copyin(S < T > ::TS) proc_bind(master) reduction(+ : c) reduction(max : e) allocate(e)
{
foo();
}
#pragma omp parallel sections if (C) num_threads(s) proc_bind(close) reduction(^ : e, f) reduction(&& : g) lastprivate(b, c)
#pragma omp parallel sections allocate(b) if (C) num_threads(s) proc_bind(close) reduction(^ : e, f) reduction(&& : g) lastprivate(b, c)
{
foo();
#pragma omp section
@ -62,11 +62,11 @@ T tmain(T argc, T *argv) {
// CHECK-NEXT: {
// CHECK-NEXT: a = 2;
// CHECK-NEXT: }
// CHECK-NEXT: #pragma omp parallel sections default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(C) copyin(S<T>::TS) proc_bind(master) reduction(+: c) reduction(max: e)
// CHECK-NEXT: #pragma omp parallel sections default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(C) copyin(S<T>::TS) proc_bind(master) reduction(+: c) reduction(max: e) allocate(e)
// CHECK-NEXT: {
// CHECK-NEXT: foo();
// CHECK-NEXT: }
// CHECK-NEXT: #pragma omp parallel sections if(C) num_threads(s) proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c)
// CHECK-NEXT: #pragma omp parallel sections allocate(b) if(C) num_threads(s) proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c)
// CHECK-NEXT: {
// CHECK-NEXT: foo();
// CHECK-NEXT: #pragma omp section
@ -80,11 +80,11 @@ T tmain(T argc, T *argv) {
// CHECK-NEXT: {
// CHECK-NEXT: a = 2;
// CHECK-NEXT: }
// CHECK-NEXT: #pragma omp parallel sections default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(5) copyin(S<int>::TS) proc_bind(master) reduction(+: c) reduction(max: e)
// CHECK-NEXT: #pragma omp parallel sections default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(5) copyin(S<int>::TS) proc_bind(master) reduction(+: c) reduction(max: e) allocate(e)
// CHECK-NEXT: {
// CHECK-NEXT: foo();
// CHECK-NEXT: }
// CHECK-NEXT: #pragma omp parallel sections if(5) num_threads(s) proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c)
// CHECK-NEXT: #pragma omp parallel sections allocate(b) if(5) num_threads(s) proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c)
// CHECK-NEXT: {
// CHECK-NEXT: foo();
// CHECK-NEXT: #pragma omp section
@ -98,11 +98,11 @@ T tmain(T argc, T *argv) {
// CHECK-NEXT: {
// CHECK-NEXT: a = 2;
// CHECK-NEXT: }
// CHECK-NEXT: #pragma omp parallel sections default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(1) copyin(S<long>::TS) proc_bind(master) reduction(+: c) reduction(max: e)
// CHECK-NEXT: #pragma omp parallel sections default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(1) copyin(S<long>::TS) proc_bind(master) reduction(+: c) reduction(max: e) allocate(e)
// CHECK-NEXT: {
// CHECK-NEXT: foo();
// CHECK-NEXT: }
// CHECK-NEXT: #pragma omp parallel sections if(1) num_threads(s) proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c)
// CHECK-NEXT: #pragma omp parallel sections allocate(b) if(1) num_threads(s) proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c)
// CHECK-NEXT: {
// CHECK-NEXT: foo();
// CHECK-NEXT: #pragma omp section

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -92,7 +93,7 @@ int foomain(int argc, char **argv) {
{
foo();
}
#pragma omp parallel sections firstprivate(argc)
#pragma omp parallel sections firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
{
foo();
}

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -93,7 +94,7 @@ int foomain(int argc, char **argv) {
{
foo();
}
#pragma omp parallel sections lastprivate(argc)
#pragma omp parallel sections lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
{
foo();
}

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -134,7 +135,7 @@ int foomain(I argc, C **argv) {
{
foo();
}
#pragma omp parallel sections private(argc)
#pragma omp parallel sections private(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
{
foo();
}

View File

@ -6,6 +6,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s
// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -136,7 +137,7 @@ T tmain(T argc) {
{
foo();
}
#pragma omp parallel sections reduction(&& : argc)
#pragma omp parallel sections reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
{
foo();
}

View File

@ -1,6 +1,7 @@
// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
#pragma omp requires unified_address // expected-note {{unified_address clause previously used here}} expected-note {{unified_address clause previously used here}} expected-note {{unified_address clause previously used here}} expected-note {{unified_address clause previously used here}} expected-note {{unified_address clause previously used here}} expected-note{{unified_address clause previously used here}}
int a;
#pragma omp requires unified_address allocate(a) // expected-note {{unified_address clause previously used here}} expected-note {{unified_address clause previously used here}} expected-note {{unified_address clause previously used here}} expected-note {{unified_address clause previously used here}} expected-note {{unified_address clause previously used here}} expected-note{{unified_address clause previously used here}} expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp requires'}}
#pragma omp requires unified_shared_memory // expected-note {{unified_shared_memory clause previously used here}} expected-note{{unified_shared_memory clause previously used here}}

View File

@ -18,12 +18,12 @@ T tmain(T argc) {
static T a;
// CHECK: static T a;
#pragma omp parallel
#pragma omp sections private(argc, b), firstprivate(c, d), lastprivate(d, f) reduction(- : g) nowait
#pragma omp sections private(argc, b), firstprivate(c, d), lastprivate(d, f) reduction(- : g) nowait allocate(d)
{
foo();
}
// CHECK-NEXT: #pragma omp parallel
// CHECK-NEXT: #pragma omp sections private(argc,b) firstprivate(c,d) lastprivate(d,f) reduction(-: g) nowait{{$}}
// CHECK-NEXT: #pragma omp sections private(argc,b) firstprivate(c,d) lastprivate(d,f) reduction(-: g) nowait allocate(d){{$}}
// CHECK-NEXT: {
// CHECK-NEXT: foo();
// CHECK-NEXT: }
@ -36,7 +36,7 @@ int main(int argc, char **argv) {
static int a;
// CHECK: static int a;
#pragma omp parallel
#pragma omp sections private(argc, b), firstprivate(argv, c), lastprivate(d, f) reduction(+ : g) nowait
#pragma omp sections allocate(c) private(argc, b), firstprivate(argv, c), lastprivate(d, f) reduction(+ : g) nowait
{
#pragma omp section
foo();
@ -44,7 +44,7 @@ int main(int argc, char **argv) {
foo();
}
// CHECK-NEXT: #pragma omp parallel
// CHECK-NEXT: #pragma omp sections private(argc,b) firstprivate(argv,c) lastprivate(d,f) reduction(+: g) nowait
// CHECK-NEXT: #pragma omp sections allocate(c) private(argc,b) firstprivate(argv,c) lastprivate(d,f) reduction(+: g) nowait
// CHECK-NEXT: {
// CHECK-NEXT: #pragma omp section{{$}}
// CHECK-NEXT: foo();

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -99,7 +100,7 @@ int foomain(int argc, char **argv) {
foo();
}
#pragma omp parallel
#pragma omp sections firstprivate(argc)
#pragma omp sections firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
{
foo();
}

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -206,7 +207,7 @@ int main(int argc, char **argv) {
foo();
}
#pragma omp parallel
#pragma omp sections lastprivate(argc)
#pragma omp sections lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
{
foo();
}

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -134,7 +135,7 @@ int foomain(I argc, C **argv) {
{
foo();
}
#pragma omp sections private(argc)
#pragma omp sections private(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
{
foo();
}

View File

@ -6,6 +6,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s
// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -149,7 +150,7 @@ T tmain(T argc) {
foo();
}
#pragma omp parallel
#pragma omp sections reduction(&& : argc)
#pragma omp sections reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
{
foo();
}

View File

@ -94,8 +94,8 @@ template<class T> struct S {
// CHECK: T val;
// CHECK: T lin = 0;
// CHECK: T &ref = res;
#pragma omp simd private(val) safelen(7) linear(lin : -5) lastprivate(res) simdlen(5) linear(ref(ref))
// CHECK-NEXT: #pragma omp simd private(val) safelen(7) linear(lin: -5) lastprivate(res) simdlen(5) linear(ref(ref))
#pragma omp simd allocate(res) private(val) safelen(7) linear(lin : -5) lastprivate(res) simdlen(5) linear(ref(ref))
// CHECK-NEXT: #pragma omp simd allocate(res) private(val) safelen(7) linear(lin: -5) lastprivate(res) simdlen(5) linear(ref(ref))
for (T i = 7; i < m_a; ++i) {
val = v[i-7] + m_a;
res = val;
@ -121,7 +121,7 @@ template<class T> struct S {
template<int LEN> struct S2 {
static void func(int n, float *a, float *b, float *c) {
int k1 = 0, k2 = 0;
#pragma omp simd safelen(LEN) linear(k1,k2:LEN) aligned(a:LEN) simdlen(LEN)
#pragma omp simd safelen(LEN) linear(k1,k2:LEN) aligned(a:LEN) simdlen(LEN) allocate(k1)
for(int i = 0; i < n; i++) {
c[i] = a[i] + b[i];
c[k1] = a[k1] + b[k1];
@ -136,7 +136,7 @@ template<int LEN> struct S2 {
// CHECK: template<> struct S2<4> {
// CHECK-NEXT: static void func(int n, float *a, float *b, float *c) {
// CHECK-NEXT: int k1 = 0, k2 = 0;
// CHECK-NEXT: #pragma omp simd safelen(4) linear(k1,k2: 4) aligned(a: 4) simdlen(4)
// CHECK-NEXT: #pragma omp simd safelen(4) linear(k1,k2: 4) aligned(a: 4) simdlen(4) allocate(k1)
// CHECK-NEXT: for (int i = 0; i < n; i++) {
// CHECK-NEXT: c[i] = a[i] + b[i];
// CHECK-NEXT: c[k1] = a[k1] + b[k1];

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -87,7 +88,7 @@ int foomain(I argc, C **argv) {
#pragma omp simd lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp simd lastprivate(argc)
#pragma omp simd lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}}

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
namespace X {
int x;
};
@ -127,7 +128,7 @@ template<class I, class C> int foomain(I argc, C **argv) {
for (int k = 0; k < argc; ++k) ++k;
#pragma omp simd linear (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
for (int k = 0; k < argc; ++k) ++k;
#pragma omp simd linear (argc : 5)
#pragma omp simd linear (argc : 5) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int k = 0; k < argc; ++k) ++k;
#pragma omp simd linear (S1) // expected-error {{'S1' does not refer to a value}}
for (int k = 0; k < argc; ++k) ++k;

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -105,7 +106,7 @@ template<class I, class C> int foomain(I argc, C **argv) {
for (int k = 0; k < argc; ++k) ++k;
#pragma omp simd private (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
for (int k = 0; k < argc; ++k) ++k;
#pragma omp simd private (argc)
#pragma omp simd private (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int k = 0; k < argc; ++k) ++k;
#pragma omp simd private (S1) // expected-error {{'S1' does not refer to a value}}
for (int k = 0; k < argc; ++k) ++k;

View File

@ -6,6 +6,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 %s
// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -124,7 +125,7 @@ T tmain(T argc) {
#pragma omp simd reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp simd reduction(&& : argc)
#pragma omp simd reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
for (int i = 0; i < 10; ++i)
foo();
#pragma omp simd reduction(^ : T) // expected-error {{'T' does not refer to a value}}

View File

@ -46,16 +46,16 @@ T tmain(T argc) {
SST<T> sst;
// CHECK: static T a;
#pragma omp parallel private(g)
#pragma omp single private(argc, b), firstprivate(c, d), nowait
#pragma omp single private(argc, b), firstprivate(c, d), nowait allocate(d)
foo();
// CHECK: #pragma omp parallel private(g)
// CHECK-NEXT: #pragma omp single private(argc,b) firstprivate(c,d) nowait
// CHECK-NEXT: #pragma omp single private(argc,b) firstprivate(c,d) nowait allocate(d)
// CHECK-NEXT: foo();
#pragma omp parallel private(g)
#pragma omp single private(argc, b), firstprivate(c, d), copyprivate(g)
#pragma omp single allocate(argc) private(argc, b), firstprivate(c, d), copyprivate(g)
foo();
// CHECK-NEXT: #pragma omp parallel private(g)
// CHECK-NEXT: #pragma omp single private(argc,b) firstprivate(c,d) copyprivate(g)
// CHECK-NEXT: #pragma omp single allocate(argc) private(argc,b) firstprivate(c,d) copyprivate(g)
// CHECK-NEXT: foo();
return T();
}

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -87,7 +88,7 @@ int foomain(int argc, char **argv) {
#pragma omp single firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
foo();
#pragma omp parallel
#pragma omp single firstprivate(argc)
#pragma omp single firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
foo();
#pragma omp parallel
#pragma omp single firstprivate(S1) // expected-error {{'S1' does not refer to a value}}

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
void foo() {
}
@ -110,7 +111,7 @@ int foomain(I argc, C **argv) {
foo();
#pragma omp single private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
foo();
#pragma omp single private(argc)
#pragma omp single private(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
foo();
#pragma omp single private(S1) // expected-error {{'S1' does not refer to a value}}
foo();

View File

@ -10,7 +10,7 @@ int main(int argc, char **argv) {
{}
L1:
foo();
#pragma omp target data map(a)
#pragma omp target data map(a) allocate(a) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp target data'}}
{
foo();
goto L1; // expected-error {{use of undeclared label 'L1'}}

View File

@ -12,7 +12,7 @@ int main(int argc, char **argv) {
#pragma omp target enter data map(r) // expected-error {{map type must be specified for '#pragma omp target enter data'}}
#pragma omp target enter data map(tofrom: r) // expected-error {{map type 'tofrom' is not allowed for '#pragma omp target enter data'}}
#pragma omp target enter data map(always, to: r)
#pragma omp target enter data map(always, to: r) allocate(r) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp target enter data'}}
#pragma omp target enter data map(always, alloc: r)
#pragma omp target enter data map(always, from: r) // expected-error {{map type 'from' is not allowed for '#pragma omp target enter data'}}
#pragma omp target enter data map(release: r) // expected-error {{map type 'release' is not allowed for '#pragma omp target enter data'}}

View File

@ -12,7 +12,7 @@ int main(int argc, char **argv) {
#pragma omp target exit data map(r) // expected-error {{map type must be specified for '#pragma omp target exit data'}}
#pragma omp target exit data map(tofrom: r) // expected-error {{map type 'tofrom' is not allowed for '#pragma omp target exit data'}}
#pragma omp target exit data map(always, from: r)
#pragma omp target exit data map(always, from: r) allocate(r) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp target exit data'}}
#pragma omp target exit data map(delete: r)
#pragma omp target exit data map(release: r)
#pragma omp target exit data map(always, alloc: r) // expected-error {{map type 'alloc' is not allowed for '#pragma omp target exit data'}}

View File

@ -2,6 +2,7 @@
// RUN: %clang_cc1 -verify -fopenmp-simd %s
extern int omp_default_mem_alloc;
struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
extern S1 a;
class S2 {
@ -103,7 +104,7 @@ int foomain(I argc, C **argv) {
{}
#pragma omp target firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
{}
#pragma omp target firstprivate(argc)
#pragma omp target firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}}
{}
#pragma omp target firstprivate(S1) // expected-error {{'S1' does not refer to a value}}
{}

View File

@ -41,9 +41,9 @@ T tmain(T argc, T *argv) {
T i, j, a[20];
#pragma omp target parallel
h=2;
#pragma omp target parallel default(none), private(argc,b) firstprivate(argv) shared (d) if (parallel:argc > 0) num_threads(C) proc_bind(master) reduction(+:c, arr1[argc]) reduction(max:e, arr[:C][0:10])
#pragma omp target parallel allocate(argv) default(none), private(argc,b) firstprivate(argv) shared (d) if (parallel:argc > 0) num_threads(C) proc_bind(master) reduction(+:c, arr1[argc]) reduction(max:e, arr[:C][0:10])
foo();
#pragma omp target parallel if (C) num_threads(s) proc_bind(close) reduction(^:e, f, arr[0:C][:argc]) reduction(&& : g)
#pragma omp target parallel if (C) num_threads(s) proc_bind(close) reduction(^:e, f, arr[0:C][:argc]) reduction(&& : g) allocate(g)
foo();
#pragma omp target parallel if (target:argc > 0)
foo();
@ -76,9 +76,9 @@ T tmain(T argc, T *argv) {
// CHECK-NEXT: T i, j, a[20]
// CHECK-NEXT: #pragma omp target parallel{{$}}
// CHECK-NEXT: h = 2;
// CHECK-NEXT: #pragma omp target parallel default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(C) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:C][0:10])
// CHECK-NEXT: #pragma omp target parallel allocate(argv) default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(C) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:C][0:10])
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel if(C) num_threads(s) proc_bind(close) reduction(^: e,f,arr[0:C][:argc]) reduction(&&: g)
// CHECK-NEXT: #pragma omp target parallel if(C) num_threads(s) proc_bind(close) reduction(^: e,f,arr[0:C][:argc]) reduction(&&: g) allocate(g)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel if(target: argc > 0)
// CHECK-NEXT: foo()
@ -108,9 +108,9 @@ T tmain(T argc, T *argv) {
// CHECK-NEXT: int i, j, a[20]
// CHECK-NEXT: #pragma omp target parallel
// CHECK-NEXT: h = 2;
// CHECK-NEXT: #pragma omp target parallel default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(5) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:5][0:10])
// CHECK-NEXT: #pragma omp target parallel allocate(argv) default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(5) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:5][0:10])
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel if(5) num_threads(s) proc_bind(close) reduction(^: e,f,arr[0:5][:argc]) reduction(&&: g)
// CHECK-NEXT: #pragma omp target parallel if(5) num_threads(s) proc_bind(close) reduction(^: e,f,arr[0:5][:argc]) reduction(&&: g) allocate(g)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel if(target: argc > 0)
// CHECK-NEXT: foo()
@ -140,9 +140,9 @@ T tmain(T argc, T *argv) {
// CHECK-NEXT: char i, j, a[20]
// CHECK-NEXT: #pragma omp target parallel
// CHECK-NEXT: h = 2;
// CHECK-NEXT: #pragma omp target parallel default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(1) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:1][0:10])
// CHECK-NEXT: #pragma omp target parallel allocate(argv) default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(1) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:1][0:10])
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel if(1) num_threads(s) proc_bind(close) reduction(^: e,f,arr[0:1][:argc]) reduction(&&: g)
// CHECK-NEXT: #pragma omp target parallel if(1) num_threads(s) proc_bind(close) reduction(^: e,f,arr[0:1][:argc]) reduction(&&: g) allocate(g)
// CHECK-NEXT: foo()
// CHECK-NEXT: #pragma omp target parallel if(target: argc > 0)
// CHECK-NEXT: foo()

Some files were not shown because too many files have changed in this diff Show More