[OPENMP50]Basic support for conditional lastprivate.

Added parsing/sema checks for conditional lastprivates.
This commit is contained in:
Alexey Bataev 2019-12-20 11:04:57 -05:00
parent 0d47399167
commit 93dc40dddd
47 changed files with 434 additions and 153 deletions

View File

@ -2152,6 +2152,13 @@ class OMPLastprivateClause final
friend OMPVarListClause; friend OMPVarListClause;
friend TrailingObjects; friend TrailingObjects;
/// Optional lastprivate kind, e.g. 'conditional', if specified by user.
OpenMPLastprivateModifier LPKind;
/// Optional location of the lasptrivate kind, if specified by user.
SourceLocation LPKindLoc;
/// Optional colon location, if specified by user.
SourceLocation ColonLoc;
/// Build clause with number of variables \a N. /// Build clause with number of variables \a N.
/// ///
/// \param StartLoc Starting location of the clause. /// \param StartLoc Starting location of the clause.
@ -2159,10 +2166,13 @@ class OMPLastprivateClause final
/// \param EndLoc Ending location of the clause. /// \param EndLoc Ending location of the clause.
/// \param N Number of the variables in the clause. /// \param N Number of the variables in the clause.
OMPLastprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc, OMPLastprivateClause(SourceLocation StartLoc, SourceLocation LParenLoc,
SourceLocation EndLoc, unsigned N) SourceLocation EndLoc, OpenMPLastprivateModifier LPKind,
SourceLocation LPKindLoc, SourceLocation ColonLoc,
unsigned N)
: OMPVarListClause<OMPLastprivateClause>(OMPC_lastprivate, StartLoc, : OMPVarListClause<OMPLastprivateClause>(OMPC_lastprivate, StartLoc,
LParenLoc, EndLoc, N), LParenLoc, EndLoc, N),
OMPClauseWithPostUpdate(this) {} OMPClauseWithPostUpdate(this), LPKind(LPKind), LPKindLoc(LPKindLoc),
ColonLoc(ColonLoc) {}
/// Build an empty clause. /// Build an empty clause.
/// ///
@ -2223,6 +2233,13 @@ class OMPLastprivateClause final
return llvm::makeArrayRef(getDestinationExprs().end(), varlist_size()); return llvm::makeArrayRef(getDestinationExprs().end(), varlist_size());
} }
/// Sets lastprivate kind.
void setKind(OpenMPLastprivateModifier Kind) { LPKind = Kind; }
/// Sets location of the lastprivate kind.
void setKindLoc(SourceLocation Loc) { LPKindLoc = Loc; }
/// Sets colon symbol location.
void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
public: public:
/// Creates clause with a list of variables \a VL. /// Creates clause with a list of variables \a VL.
/// ///
@ -2244,6 +2261,9 @@ public:
/// \endcode /// \endcode
/// Required for proper codegen of final assignment performed by the /// Required for proper codegen of final assignment performed by the
/// lastprivate clause. /// lastprivate clause.
/// \param LPKind Lastprivate kind, e.g. 'conditional'.
/// \param LPKindLoc Location of the lastprivate kind.
/// \param ColonLoc Location of the ':' symbol if lastprivate kind is used.
/// \param PreInit Statement that must be executed before entering the OpenMP /// \param PreInit Statement that must be executed before entering the OpenMP
/// region with this clause. /// region with this clause.
/// \param PostUpdate Expression that must be executed after exit from the /// \param PostUpdate Expression that must be executed after exit from the
@ -2252,7 +2272,8 @@ public:
Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs, SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps, ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps,
Stmt *PreInit, Expr *PostUpdate); OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc,
SourceLocation ColonLoc, Stmt *PreInit, Expr *PostUpdate);
/// Creates an empty clause with the place for \a N variables. /// Creates an empty clause with the place for \a N variables.
/// ///
@ -2260,6 +2281,13 @@ public:
/// \param N The number of variables. /// \param N The number of variables.
static OMPLastprivateClause *CreateEmpty(const ASTContext &C, unsigned N); static OMPLastprivateClause *CreateEmpty(const ASTContext &C, unsigned N);
/// Lastprivate kind.
OpenMPLastprivateModifier getKind() const { return LPKind; }
/// Returns the location of the lastprivate kind.
SourceLocation getKindLoc() const { return LPKindLoc; }
/// Returns the location of the ':' symbol, if any.
SourceLocation getColonLoc() const { return ColonLoc; }
using helper_expr_iterator = MutableArrayRef<Expr *>::iterator; using helper_expr_iterator = MutableArrayRef<Expr *>::iterator;
using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator; using helper_expr_const_iterator = ArrayRef<const Expr *>::iterator;
using helper_expr_range = llvm::iterator_range<helper_expr_iterator>; using helper_expr_range = llvm::iterator_range<helper_expr_iterator>;

View File

@ -9768,6 +9768,9 @@ def warn_omp_declare_variant_marked_as_declare_variant : Warning<
def note_omp_marked_declare_variant_here : Note<"marked as 'declare variant' here">; def note_omp_marked_declare_variant_here : Note<"marked as 'declare variant' here">;
def err_omp_one_defaultmap_each_category: Error< def err_omp_one_defaultmap_each_category: Error<
"at most one defaultmap clause for each variable-category can appear on the directive">; "at most one defaultmap clause for each variable-category can appear on the directive">;
def err_omp_lastprivate_conditional_non_scalar : Error<
"expected list item of scalar type in 'lastprivate' clause with 'conditional' modifier"
>;
} // end of OpenMP category } // end of OpenMP category
let CategoryName = "Related Result Type Issue" in { let CategoryName = "Related Result Type Issue" in {

View File

@ -212,6 +212,9 @@
#ifndef OPENMP_CONTEXT_SELECTOR #ifndef OPENMP_CONTEXT_SELECTOR
#define OPENMP_CONTEXT_SELECTOR(Name) #define OPENMP_CONTEXT_SELECTOR(Name)
#endif #endif
#ifndef OPENMP_LASTPRIVATE_KIND
#define OPENMP_LASTPRIVATE_KIND(Name)
#endif
// OpenMP context selector sets. // OpenMP context selector sets.
OPENMP_CONTEXT_SELECTOR_SET(implementation) OPENMP_CONTEXT_SELECTOR_SET(implementation)
@ -1057,6 +1060,10 @@ OPENMP_DEVICE_TYPE_KIND(any)
// Clauses allowed for OpenMP directive 'declare variant'. // Clauses allowed for OpenMP directive 'declare variant'.
OPENMP_DECLARE_VARIANT_CLAUSE(match) OPENMP_DECLARE_VARIANT_CLAUSE(match)
// Type of the 'lastprivate' clause.
OPENMP_LASTPRIVATE_KIND(conditional)
#undef OPENMP_LASTPRIVATE_KIND
#undef OPENMP_CONTEXT_SELECTOR #undef OPENMP_CONTEXT_SELECTOR
#undef OPENMP_CONTEXT_SELECTOR_SET #undef OPENMP_CONTEXT_SELECTOR_SET
#undef OPENMP_DECLARE_VARIANT_CLAUSE #undef OPENMP_DECLARE_VARIANT_CLAUSE

View File

@ -195,6 +195,13 @@ enum OpenMPDeviceType {
OMPC_DEVICE_TYPE_unknown OMPC_DEVICE_TYPE_unknown
}; };
/// OpenMP 'lastprivate' clause modifier.
enum OpenMPLastprivateModifier {
#define OPENMP_LASTPRIVATE_KIND(Name) OMPC_LASTPRIVATE_##Name,
#include "clang/Basic/OpenMPKinds.def"
OMPC_LASTPRIVATE_unknown,
};
/// Scheduling data for loop-based OpenMP directives. /// Scheduling data for loop-based OpenMP directives.
struct OpenMPScheduleTy final { struct OpenMPScheduleTy final {
OpenMPScheduleClauseKind Schedule = OMPC_SCHEDULE_unknown; OpenMPScheduleClauseKind Schedule = OMPC_SCHEDULE_unknown;

View File

@ -2970,15 +2970,14 @@ public:
SourceLocation RLoc; SourceLocation RLoc;
CXXScopeSpec ReductionOrMapperIdScopeSpec; CXXScopeSpec ReductionOrMapperIdScopeSpec;
DeclarationNameInfo ReductionOrMapperId; DeclarationNameInfo ReductionOrMapperId;
OpenMPDependClauseKind DepKind = OMPC_DEPEND_unknown; int ExtraModifier = -1; ///< Additional modifier for linear, map, depend or
OpenMPLinearClauseKind LinKind = OMPC_LINEAR_val; ///< lastprivate clause.
SmallVector<OpenMPMapModifierKind, OMPMapClause::NumberOfModifiers> SmallVector<OpenMPMapModifierKind, OMPMapClause::NumberOfModifiers>
MapTypeModifiers; MapTypeModifiers;
SmallVector<SourceLocation, OMPMapClause::NumberOfModifiers> SmallVector<SourceLocation, OMPMapClause::NumberOfModifiers>
MapTypeModifiersLoc; MapTypeModifiersLoc;
OpenMPMapClauseKind MapType = OMPC_MAP_unknown;
bool IsMapTypeImplicit = false; bool IsMapTypeImplicit = false;
SourceLocation DepLinMapLoc; SourceLocation DepLinMapLastLoc;
}; };
/// Parses clauses with list. /// Parses clauses with list.

View File

@ -10144,11 +10144,10 @@ public:
OpenMPClauseKind Kind, ArrayRef<Expr *> Vars, Expr *TailExpr, OpenMPClauseKind Kind, ArrayRef<Expr *> Vars, Expr *TailExpr,
const OMPVarListLocTy &Locs, SourceLocation ColonLoc, const OMPVarListLocTy &Locs, SourceLocation ColonLoc,
CXXScopeSpec &ReductionOrMapperIdScopeSpec, CXXScopeSpec &ReductionOrMapperIdScopeSpec,
DeclarationNameInfo &ReductionOrMapperId, OpenMPDependClauseKind DepKind, DeclarationNameInfo &ReductionOrMapperId, int ExtraModifier,
OpenMPLinearClauseKind LinKind,
ArrayRef<OpenMPMapModifierKind> MapTypeModifiers, ArrayRef<OpenMPMapModifierKind> MapTypeModifiers,
ArrayRef<SourceLocation> MapTypeModifiersLoc, OpenMPMapClauseKind MapType, ArrayRef<SourceLocation> MapTypeModifiersLoc, bool IsMapTypeImplicit,
bool IsMapTypeImplicit, SourceLocation DepLinMapLoc); SourceLocation DepLinMapLastLoc);
/// Called on well-formed 'allocate' clause. /// Called on well-formed 'allocate' clause.
OMPClause * OMPClause *
ActOnOpenMPAllocateClause(Expr *Allocator, ArrayRef<Expr *> VarList, ActOnOpenMPAllocateClause(Expr *Allocator, ArrayRef<Expr *> VarList,
@ -10165,10 +10164,10 @@ public:
SourceLocation LParenLoc, SourceLocation LParenLoc,
SourceLocation EndLoc); SourceLocation EndLoc);
/// Called on well-formed 'lastprivate' clause. /// Called on well-formed 'lastprivate' clause.
OMPClause *ActOnOpenMPLastprivateClause(ArrayRef<Expr *> VarList, OMPClause *ActOnOpenMPLastprivateClause(
SourceLocation StartLoc, ArrayRef<Expr *> VarList, OpenMPLastprivateModifier LPKind,
SourceLocation LParenLoc, SourceLocation LPKindLoc, SourceLocation ColonLoc,
SourceLocation EndLoc); SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc);
/// Called on well-formed 'shared' clause. /// Called on well-formed 'shared' clause.
OMPClause *ActOnOpenMPSharedClause(ArrayRef<Expr *> VarList, OMPClause *ActOnOpenMPSharedClause(ArrayRef<Expr *> VarList,
SourceLocation StartLoc, SourceLocation StartLoc,

View File

@ -15,6 +15,7 @@
#include "clang/AST/Decl.h" #include "clang/AST/Decl.h"
#include "clang/AST/DeclOpenMP.h" #include "clang/AST/DeclOpenMP.h"
#include "clang/Basic/LLVM.h" #include "clang/Basic/LLVM.h"
#include "clang/Basic/OpenMPKinds.h"
#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Support/Casting.h" #include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ErrorHandling.h"
@ -404,11 +405,12 @@ void OMPLastprivateClause::setAssignmentOps(ArrayRef<Expr *> AssignmentOps) {
OMPLastprivateClause *OMPLastprivateClause::Create( OMPLastprivateClause *OMPLastprivateClause::Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs, SourceLocation EndLoc, ArrayRef<Expr *> VL, ArrayRef<Expr *> SrcExprs,
ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps, Stmt *PreInit, ArrayRef<Expr *> DstExprs, ArrayRef<Expr *> AssignmentOps,
Expr *PostUpdate) { OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc,
SourceLocation ColonLoc, Stmt *PreInit, Expr *PostUpdate) {
void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(5 * VL.size())); void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(5 * VL.size()));
OMPLastprivateClause *Clause = OMPLastprivateClause *Clause = new (Mem) OMPLastprivateClause(
new (Mem) OMPLastprivateClause(StartLoc, LParenLoc, EndLoc, VL.size()); StartLoc, LParenLoc, EndLoc, LPKind, LPKindLoc, ColonLoc, VL.size());
Clause->setVarRefs(VL); Clause->setVarRefs(VL);
Clause->setSourceExprs(SrcExprs); Clause->setSourceExprs(SrcExprs);
Clause->setDestinationExprs(DstExprs); Clause->setDestinationExprs(DstExprs);
@ -1428,7 +1430,13 @@ void OMPClausePrinter::VisitOMPFirstprivateClause(OMPFirstprivateClause *Node) {
void OMPClausePrinter::VisitOMPLastprivateClause(OMPLastprivateClause *Node) { void OMPClausePrinter::VisitOMPLastprivateClause(OMPLastprivateClause *Node) {
if (!Node->varlist_empty()) { if (!Node->varlist_empty()) {
OS << "lastprivate"; OS << "lastprivate";
VisitOMPClauseList(Node, '('); OpenMPLastprivateModifier LPKind = Node->getKind();
if (LPKind != OMPC_LASTPRIVATE_unknown) {
OS << "("
<< getOpenMPSimpleClauseTypeName(OMPC_lastprivate, Node->getKind())
<< ":";
}
VisitOMPClauseList(Node, LPKind == OMPC_LASTPRIVATE_unknown ? '(' : ' ');
OS << ")"; OS << ")";
} }
} }

View File

@ -175,6 +175,11 @@ unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind,
#define OPENMP_DEVICE_TYPE_KIND(Name) .Case(#Name, OMPC_DEVICE_TYPE_##Name) #define OPENMP_DEVICE_TYPE_KIND(Name) .Case(#Name, OMPC_DEVICE_TYPE_##Name)
#include "clang/Basic/OpenMPKinds.def" #include "clang/Basic/OpenMPKinds.def"
.Default(OMPC_DEVICE_TYPE_unknown); .Default(OMPC_DEVICE_TYPE_unknown);
case OMPC_lastprivate:
return llvm::StringSwitch<OpenMPLastprivateModifier>(Str)
#define OPENMP_LASTPRIVATE_KIND(Name) .Case(#Name, OMPC_LASTPRIVATE_##Name)
#include "clang/Basic/OpenMPKinds.def"
.Default(OMPC_LASTPRIVATE_unknown);
case OMPC_unknown: case OMPC_unknown:
case OMPC_threadprivate: case OMPC_threadprivate:
case OMPC_if: case OMPC_if:
@ -187,7 +192,6 @@ unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind,
case OMPC_collapse: case OMPC_collapse:
case OMPC_private: case OMPC_private:
case OMPC_firstprivate: case OMPC_firstprivate:
case OMPC_lastprivate:
case OMPC_shared: case OMPC_shared:
case OMPC_reduction: case OMPC_reduction:
case OMPC_task_reduction: case OMPC_task_reduction:
@ -370,6 +374,16 @@ const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind,
#include "clang/Basic/OpenMPKinds.def" #include "clang/Basic/OpenMPKinds.def"
} }
llvm_unreachable("Invalid OpenMP 'device_type' clause type"); llvm_unreachable("Invalid OpenMP 'device_type' clause type");
case OMPC_lastprivate:
switch (Type) {
case OMPC_LASTPRIVATE_unknown:
return "unknown";
#define OPENMP_LASTPRIVATE_KIND(Name) \
case OMPC_LASTPRIVATE_##Name: \
return #Name;
#include "clang/Basic/OpenMPKinds.def"
}
llvm_unreachable("Invalid OpenMP 'lastprivate' clause type");
case OMPC_unknown: case OMPC_unknown:
case OMPC_threadprivate: case OMPC_threadprivate:
case OMPC_if: case OMPC_if:
@ -382,7 +396,6 @@ const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind,
case OMPC_collapse: case OMPC_collapse:
case OMPC_private: case OMPC_private:
case OMPC_firstprivate: case OMPC_firstprivate:
case OMPC_lastprivate:
case OMPC_shared: case OMPC_shared:
case OMPC_reduction: case OMPC_reduction:
case OMPC_task_reduction: case OMPC_task_reduction:

View File

@ -12,6 +12,7 @@
#include "clang/AST/ASTContext.h" #include "clang/AST/ASTContext.h"
#include "clang/AST/StmtOpenMP.h" #include "clang/AST/StmtOpenMP.h"
#include "clang/Basic/OpenMPKinds.h"
#include "clang/Parse/ParseDiagnostic.h" #include "clang/Parse/ParseDiagnostic.h"
#include "clang/Parse/Parser.h" #include "clang/Parse/Parser.h"
#include "clang/Parse/RAIIObjectsForParser.h" #include "clang/Parse/RAIIObjectsForParser.h"
@ -746,11 +747,12 @@ static bool parseDeclareSimdClauses(
if (CKind == OMPC_aligned) { if (CKind == OMPC_aligned) {
Alignments.append(Aligneds.size() - Alignments.size(), Data.TailExpr); Alignments.append(Aligneds.size() - Alignments.size(), Data.TailExpr);
} else if (CKind == OMPC_linear) { } else if (CKind == OMPC_linear) {
if (P.getActions().CheckOpenMPLinearModifier(Data.LinKind, if (P.getActions().CheckOpenMPLinearModifier(
Data.DepLinMapLoc)) static_cast<OpenMPLinearClauseKind>(Data.ExtraModifier),
Data.LinKind = OMPC_LINEAR_val; Data.DepLinMapLastLoc))
Data.ExtraModifier = OMPC_LINEAR_val;
LinModifiers.append(Linears.size() - LinModifiers.size(), LinModifiers.append(Linears.size() - LinModifiers.size(),
Data.LinKind); Data.ExtraModifier);
Steps.append(Linears.size() - Steps.size(), Data.TailExpr); Steps.append(Linears.size() - Steps.size(), Data.TailExpr);
} }
} else } else
@ -2640,8 +2642,8 @@ static void parseMapType(Parser &P, Parser::OpenMPVarListDataTy &Data) {
P.Diag(Tok, diag::err_omp_map_type_missing); P.Diag(Tok, diag::err_omp_map_type_missing);
return; return;
} }
Data.MapType = isMapType(P); Data.ExtraModifier = isMapType(P);
if (Data.MapType == OMPC_MAP_unknown) if (Data.ExtraModifier == OMPC_MAP_unknown)
P.Diag(Tok, diag::err_omp_unknown_map_type); P.Diag(Tok, diag::err_omp_unknown_map_type);
P.ConsumeToken(); P.ConsumeToken();
} }
@ -2686,20 +2688,18 @@ bool Parser::ParseOpenMPVarList(OpenMPDirectiveKind DKind,
Data.ReductionOrMapperId = Data.ReductionOrMapperId =
Actions.GetNameFromUnqualifiedId(UnqualifiedReductionId); Actions.GetNameFromUnqualifiedId(UnqualifiedReductionId);
} else if (Kind == OMPC_depend) { } else if (Kind == OMPC_depend) {
// Handle dependency type for depend clause. // Handle dependency type for depend clause.
ColonProtectionRAIIObject ColonRAII(*this); ColonProtectionRAIIObject ColonRAII(*this);
Data.DepKind = Data.ExtraModifier = getOpenMPSimpleClauseType(
static_cast<OpenMPDependClauseKind>(getOpenMPSimpleClauseType( Kind, Tok.is(tok::identifier) ? PP.getSpelling(Tok) : "");
Kind, Tok.is(tok::identifier) ? PP.getSpelling(Tok) : "")); Data.DepLinMapLastLoc = Tok.getLocation();
Data.DepLinMapLoc = Tok.getLocation(); if (Data.ExtraModifier == OMPC_DEPEND_unknown) {
if (Data.DepKind == OMPC_DEPEND_unknown) {
SkipUntil(tok::colon, tok::r_paren, tok::annot_pragma_openmp_end, SkipUntil(tok::colon, tok::r_paren, tok::annot_pragma_openmp_end,
StopBeforeMatch); StopBeforeMatch);
} else { } else {
ConsumeToken(); ConsumeToken();
// Special processing for depend(source) clause. // Special processing for depend(source) clause.
if (DKind == OMPD_ordered && Data.DepKind == OMPC_DEPEND_source) { if (DKind == OMPD_ordered && Data.ExtraModifier == OMPC_DEPEND_source) {
// Parse ')'. // Parse ')'.
T.consumeClose(); T.consumeClose();
return false; return false;
@ -2714,13 +2714,32 @@ bool Parser::ParseOpenMPVarList(OpenMPDirectiveKind DKind,
} }
} else if (Kind == OMPC_linear) { } else if (Kind == OMPC_linear) {
// Try to parse modifier if any. // Try to parse modifier if any.
Data.ExtraModifier = OMPC_LINEAR_val;
if (Tok.is(tok::identifier) && PP.LookAhead(0).is(tok::l_paren)) { if (Tok.is(tok::identifier) && PP.LookAhead(0).is(tok::l_paren)) {
Data.LinKind = static_cast<OpenMPLinearClauseKind>( Data.ExtraModifier = getOpenMPSimpleClauseType(Kind, PP.getSpelling(Tok));
getOpenMPSimpleClauseType(Kind, PP.getSpelling(Tok))); Data.DepLinMapLastLoc = ConsumeToken();
Data.DepLinMapLoc = ConsumeToken();
LinearT.consumeOpen(); LinearT.consumeOpen();
NeedRParenForLinear = true; NeedRParenForLinear = true;
} }
} else if (Kind == OMPC_lastprivate) {
// Try to parse modifier if any.
Data.ExtraModifier = OMPC_LASTPRIVATE_unknown;
// Conditional modifier allowed only in OpenMP 5.0 and not supported in
// distribute and taskloop based directives.
if ((getLangOpts().OpenMP >= 50 && !isOpenMPDistributeDirective(DKind) &&
!isOpenMPTaskLoopDirective(DKind)) &&
Tok.is(tok::identifier) && PP.LookAhead(0).is(tok::colon)) {
Data.ExtraModifier = getOpenMPSimpleClauseType(Kind, PP.getSpelling(Tok));
Data.DepLinMapLastLoc = Tok.getLocation();
if (Data.ExtraModifier == OMPC_LASTPRIVATE_unknown) {
SkipUntil(tok::colon, tok::r_paren, tok::annot_pragma_openmp_end,
StopBeforeMatch);
} else {
ConsumeToken();
}
assert(Tok.is(tok::colon) && "Expected colon.");
Data.ColonLoc = ConsumeToken();
}
} else if (Kind == OMPC_map) { } else if (Kind == OMPC_map) {
// Handle map type for map clause. // Handle map type for map clause.
ColonProtectionRAIIObject ColonRAII(*this); ColonProtectionRAIIObject ColonRAII(*this);
@ -2728,7 +2747,8 @@ bool Parser::ParseOpenMPVarList(OpenMPDirectiveKind DKind,
// The first identifier may be a list item, a map-type or a // The first identifier may be a list item, a map-type or a
// map-type-modifier. The map-type can also be delete which has the same // map-type-modifier. The map-type can also be delete which has the same
// spelling of the C++ delete keyword. // spelling of the C++ delete keyword.
Data.DepLinMapLoc = Tok.getLocation(); Data.ExtraModifier = OMPC_MAP_unknown;
Data.DepLinMapLastLoc = Tok.getLocation();
// Check for presence of a colon in the map clause. // Check for presence of a colon in the map clause.
TentativeParsingAction TPA(*this); TentativeParsingAction TPA(*this);
@ -2748,8 +2768,8 @@ bool Parser::ParseOpenMPVarList(OpenMPDirectiveKind DKind,
else else
SkipUntil(tok::colon, tok::annot_pragma_openmp_end, StopBeforeMatch); SkipUntil(tok::colon, tok::annot_pragma_openmp_end, StopBeforeMatch);
} }
if (Data.MapType == OMPC_MAP_unknown) { if (Data.ExtraModifier == OMPC_MAP_unknown) {
Data.MapType = OMPC_MAP_tofrom; Data.ExtraModifier = OMPC_MAP_tofrom;
Data.IsMapTypeImplicit = true; Data.IsMapTypeImplicit = true;
} }
@ -2815,8 +2835,8 @@ bool Parser::ParseOpenMPVarList(OpenMPDirectiveKind DKind,
(Kind != OMPC_reduction && Kind != OMPC_task_reduction && (Kind != OMPC_reduction && Kind != OMPC_task_reduction &&
Kind != OMPC_in_reduction && Kind != OMPC_depend && Kind != OMPC_map) || Kind != OMPC_in_reduction && Kind != OMPC_depend && Kind != OMPC_map) ||
(Kind == OMPC_reduction && !InvalidReductionId) || (Kind == OMPC_reduction && !InvalidReductionId) ||
(Kind == OMPC_map && Data.MapType != OMPC_MAP_unknown) || (Kind == OMPC_map && Data.ExtraModifier != OMPC_MAP_unknown) ||
(Kind == OMPC_depend && Data.DepKind != OMPC_DEPEND_unknown); (Kind == OMPC_depend && Data.ExtraModifier != OMPC_DEPEND_unknown);
const bool MayHaveTail = (Kind == OMPC_linear || Kind == OMPC_aligned); const bool MayHaveTail = (Kind == OMPC_linear || Kind == OMPC_aligned);
while (IsComma || (Tok.isNot(tok::r_paren) && Tok.isNot(tok::colon) && while (IsComma || (Tok.isNot(tok::r_paren) && Tok.isNot(tok::colon) &&
Tok.isNot(tok::annot_pragma_openmp_end))) { Tok.isNot(tok::annot_pragma_openmp_end))) {
@ -2866,7 +2886,7 @@ bool Parser::ParseOpenMPVarList(OpenMPDirectiveKind DKind,
Data.RLoc = Tok.getLocation(); Data.RLoc = Tok.getLocation();
if (!T.consumeClose()) if (!T.consumeClose())
Data.RLoc = T.getCloseLocation(); Data.RLoc = T.getCloseLocation();
return (Kind == OMPC_depend && Data.DepKind != OMPC_DEPEND_unknown && return (Kind == OMPC_depend && Data.ExtraModifier != OMPC_DEPEND_unknown &&
Vars.empty()) || Vars.empty()) ||
(Kind != OMPC_depend && Kind != OMPC_map && Vars.empty()) || (Kind != OMPC_depend && Kind != OMPC_map && Vars.empty()) ||
(MustHaveTail && !Data.TailExpr) || InvalidReductionId || (MustHaveTail && !Data.TailExpr) || InvalidReductionId ||
@ -2936,8 +2956,8 @@ OMPClause *Parser::ParseOpenMPVarListClause(OpenMPDirectiveKind DKind,
OMPVarListLocTy Locs(Loc, LOpen, Data.RLoc); OMPVarListLocTy Locs(Loc, LOpen, Data.RLoc);
return Actions.ActOnOpenMPVarListClause( return Actions.ActOnOpenMPVarListClause(
Kind, Vars, Data.TailExpr, Locs, Data.ColonLoc, Kind, Vars, Data.TailExpr, Locs, Data.ColonLoc,
Data.ReductionOrMapperIdScopeSpec, Data.ReductionOrMapperId, Data.DepKind, Data.ReductionOrMapperIdScopeSpec, Data.ReductionOrMapperId,
Data.LinKind, Data.MapTypeModifiers, Data.MapTypeModifiersLoc, Data.ExtraModifier, Data.MapTypeModifiers, Data.MapTypeModifiersLoc,
Data.MapType, Data.IsMapTypeImplicit, Data.DepLinMapLoc); Data.IsMapTypeImplicit, Data.DepLinMapLastLoc);
} }

View File

@ -12402,11 +12402,10 @@ OMPClause *Sema::ActOnOpenMPVarListClause(
OpenMPClauseKind Kind, ArrayRef<Expr *> VarList, Expr *TailExpr, OpenMPClauseKind Kind, ArrayRef<Expr *> VarList, Expr *TailExpr,
const OMPVarListLocTy &Locs, SourceLocation ColonLoc, const OMPVarListLocTy &Locs, SourceLocation ColonLoc,
CXXScopeSpec &ReductionOrMapperIdScopeSpec, CXXScopeSpec &ReductionOrMapperIdScopeSpec,
DeclarationNameInfo &ReductionOrMapperId, OpenMPDependClauseKind DepKind, DeclarationNameInfo &ReductionOrMapperId, int ExtraModifier,
OpenMPLinearClauseKind LinKind,
ArrayRef<OpenMPMapModifierKind> MapTypeModifiers, ArrayRef<OpenMPMapModifierKind> MapTypeModifiers,
ArrayRef<SourceLocation> MapTypeModifiersLoc, OpenMPMapClauseKind MapType, ArrayRef<SourceLocation> MapTypeModifiersLoc, bool IsMapTypeImplicit,
bool IsMapTypeImplicit, SourceLocation DepLinMapLoc) { SourceLocation DepLinMapLastLoc) {
SourceLocation StartLoc = Locs.StartLoc; SourceLocation StartLoc = Locs.StartLoc;
SourceLocation LParenLoc = Locs.LParenLoc; SourceLocation LParenLoc = Locs.LParenLoc;
SourceLocation EndLoc = Locs.EndLoc; SourceLocation EndLoc = Locs.EndLoc;
@ -12419,7 +12418,9 @@ OMPClause *Sema::ActOnOpenMPVarListClause(
Res = ActOnOpenMPFirstprivateClause(VarList, StartLoc, LParenLoc, EndLoc); Res = ActOnOpenMPFirstprivateClause(VarList, StartLoc, LParenLoc, EndLoc);
break; break;
case OMPC_lastprivate: case OMPC_lastprivate:
Res = ActOnOpenMPLastprivateClause(VarList, StartLoc, LParenLoc, EndLoc); Res = ActOnOpenMPLastprivateClause(
VarList, static_cast<OpenMPLastprivateModifier>(ExtraModifier),
DepLinMapLastLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
break; break;
case OMPC_shared: case OMPC_shared:
Res = ActOnOpenMPSharedClause(VarList, StartLoc, LParenLoc, EndLoc); Res = ActOnOpenMPSharedClause(VarList, StartLoc, LParenLoc, EndLoc);
@ -12440,8 +12441,10 @@ OMPClause *Sema::ActOnOpenMPVarListClause(
ReductionOrMapperId); ReductionOrMapperId);
break; break;
case OMPC_linear: case OMPC_linear:
Res = ActOnOpenMPLinearClause(VarList, TailExpr, StartLoc, LParenLoc, Res = ActOnOpenMPLinearClause(
LinKind, DepLinMapLoc, ColonLoc, EndLoc); VarList, TailExpr, StartLoc, LParenLoc,
static_cast<OpenMPLinearClauseKind>(ExtraModifier), DepLinMapLastLoc,
ColonLoc, EndLoc);
break; break;
case OMPC_aligned: case OMPC_aligned:
Res = ActOnOpenMPAlignedClause(VarList, TailExpr, StartLoc, LParenLoc, Res = ActOnOpenMPAlignedClause(VarList, TailExpr, StartLoc, LParenLoc,
@ -12457,14 +12460,15 @@ OMPClause *Sema::ActOnOpenMPVarListClause(
Res = ActOnOpenMPFlushClause(VarList, StartLoc, LParenLoc, EndLoc); Res = ActOnOpenMPFlushClause(VarList, StartLoc, LParenLoc, EndLoc);
break; break;
case OMPC_depend: case OMPC_depend:
Res = ActOnOpenMPDependClause(DepKind, DepLinMapLoc, ColonLoc, VarList, Res = ActOnOpenMPDependClause(
StartLoc, LParenLoc, EndLoc); static_cast<OpenMPDependClauseKind>(ExtraModifier), DepLinMapLastLoc,
ColonLoc, VarList, StartLoc, LParenLoc, EndLoc);
break; break;
case OMPC_map: case OMPC_map:
Res = ActOnOpenMPMapClause(MapTypeModifiers, MapTypeModifiersLoc, Res = ActOnOpenMPMapClause(
ReductionOrMapperIdScopeSpec, MapTypeModifiers, MapTypeModifiersLoc, ReductionOrMapperIdScopeSpec,
ReductionOrMapperId, MapType, IsMapTypeImplicit, ReductionOrMapperId, static_cast<OpenMPMapClauseKind>(ExtraModifier),
DepLinMapLoc, ColonLoc, VarList, Locs); IsMapTypeImplicit, DepLinMapLastLoc, ColonLoc, VarList, Locs);
break; break;
case OMPC_to: case OMPC_to:
Res = ActOnOpenMPToClause(VarList, ReductionOrMapperIdScopeSpec, Res = ActOnOpenMPToClause(VarList, ReductionOrMapperIdScopeSpec,
@ -12990,10 +12994,19 @@ OMPClause *Sema::ActOnOpenMPFirstprivateClause(ArrayRef<Expr *> VarList,
buildPreInits(Context, ExprCaptures)); buildPreInits(Context, ExprCaptures));
} }
OMPClause *Sema::ActOnOpenMPLastprivateClause(ArrayRef<Expr *> VarList, OMPClause *Sema::ActOnOpenMPLastprivateClause(
SourceLocation StartLoc, ArrayRef<Expr *> VarList, OpenMPLastprivateModifier LPKind,
SourceLocation LParenLoc, SourceLocation LPKindLoc, SourceLocation ColonLoc, SourceLocation StartLoc,
SourceLocation EndLoc) { SourceLocation LParenLoc, SourceLocation EndLoc) {
if (LPKind == OMPC_LASTPRIVATE_unknown && LPKindLoc.isValid()) {
assert(ColonLoc.isValid() && "Colon location must be valid.");
Diag(LPKindLoc, diag::err_omp_unexpected_clause_value)
<< getListOfPossibleValues(OMPC_lastprivate, /*First=*/0,
/*Last=*/OMPC_LASTPRIVATE_unknown)
<< getOpenMPClauseName(OMPC_lastprivate);
return nullptr;
}
SmallVector<Expr *, 8> Vars; SmallVector<Expr *, 8> Vars;
SmallVector<Expr *, 8> SrcExprs; SmallVector<Expr *, 8> SrcExprs;
SmallVector<Expr *, 8> DstExprs; SmallVector<Expr *, 8> DstExprs;
@ -13039,6 +13052,19 @@ OMPClause *Sema::ActOnOpenMPLastprivateClause(ArrayRef<Expr *> VarList,
if (rejectConstNotMutableType(*this, D, Type, OMPC_lastprivate, ELoc)) if (rejectConstNotMutableType(*this, D, Type, OMPC_lastprivate, ELoc))
continue; continue;
// OpenMP 5.0 [2.19.4.5 lastprivate Clause, Restrictions]
// A list item that appears in a lastprivate clause with the conditional
// modifier must be a scalar variable.
if (LPKind == OMPC_LASTPRIVATE_conditional && !Type->isScalarType()) {
Diag(ELoc, diag::err_omp_lastprivate_conditional_non_scalar);
bool IsDecl = !VD || VD->isThisDeclarationADefinition(Context) ==
VarDecl::DeclarationOnly;
Diag(D->getLocation(),
IsDecl ? diag::note_previous_decl : diag::note_defined_here)
<< D;
continue;
}
OpenMPDirectiveKind CurrDir = DSAStack->getCurrentDirective(); OpenMPDirectiveKind CurrDir = DSAStack->getCurrentDirective();
// OpenMP [2.14.1.1, Data-sharing Attribute Rules for Variables Referenced // OpenMP [2.14.1.1, Data-sharing Attribute Rules for Variables Referenced
// in a Construct] // in a Construct]
@ -13147,6 +13173,7 @@ OMPClause *Sema::ActOnOpenMPLastprivateClause(ArrayRef<Expr *> VarList,
return OMPLastprivateClause::Create(Context, StartLoc, LParenLoc, EndLoc, return OMPLastprivateClause::Create(Context, StartLoc, LParenLoc, EndLoc,
Vars, SrcExprs, DstExprs, AssignmentOps, Vars, SrcExprs, DstExprs, AssignmentOps,
LPKind, LPKindLoc, ColonLoc,
buildPreInits(Context, ExprCaptures), buildPreInits(Context, ExprCaptures),
buildPostUpdate(*this, ExprPostUpdates)); buildPostUpdate(*this, ExprPostUpdates));
} }

View File

@ -1678,11 +1678,14 @@ public:
/// By default, performs semantic analysis to build the new OpenMP clause. /// By default, performs semantic analysis to build the new OpenMP clause.
/// Subclasses may override this routine to provide different behavior. /// Subclasses may override this routine to provide different behavior.
OMPClause *RebuildOMPLastprivateClause(ArrayRef<Expr *> VarList, OMPClause *RebuildOMPLastprivateClause(ArrayRef<Expr *> VarList,
OpenMPLastprivateModifier LPKind,
SourceLocation LPKindLoc,
SourceLocation ColonLoc,
SourceLocation StartLoc, SourceLocation StartLoc,
SourceLocation LParenLoc, SourceLocation LParenLoc,
SourceLocation EndLoc) { SourceLocation EndLoc) {
return getSema().ActOnOpenMPLastprivateClause(VarList, StartLoc, LParenLoc, return getSema().ActOnOpenMPLastprivateClause(
EndLoc); VarList, LPKind, LPKindLoc, ColonLoc, StartLoc, LParenLoc, EndLoc);
} }
/// Build a new OpenMP 'shared' clause. /// Build a new OpenMP 'shared' clause.
@ -8782,7 +8785,8 @@ TreeTransform<Derived>::TransformOMPLastprivateClause(OMPLastprivateClause *C) {
Vars.push_back(EVar.get()); Vars.push_back(EVar.get());
} }
return getDerived().RebuildOMPLastprivateClause( return getDerived().RebuildOMPLastprivateClause(
Vars, C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc()); Vars, C->getKind(), C->getKindLoc(), C->getColonLoc(), C->getBeginLoc(),
C->getLParenLoc(), C->getEndLoc());
} }
template <typename Derived> template <typename Derived>

View File

@ -10,6 +10,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "clang/Basic/OpenMPKinds.h"
#include "clang/Serialization/ASTRecordReader.h" #include "clang/Serialization/ASTRecordReader.h"
#include "ASTCommon.h" #include "ASTCommon.h"
#include "ASTReaderInternals.h" #include "ASTReaderInternals.h"
@ -11878,6 +11879,9 @@ void OMPClauseReader::VisitOMPFirstprivateClause(OMPFirstprivateClause *C) {
void OMPClauseReader::VisitOMPLastprivateClause(OMPLastprivateClause *C) { void OMPClauseReader::VisitOMPLastprivateClause(OMPLastprivateClause *C) {
VisitOMPClauseWithPostUpdate(C); VisitOMPClauseWithPostUpdate(C);
C->setLParenLoc(Record.readSourceLocation()); C->setLParenLoc(Record.readSourceLocation());
C->setKind(Record.readEnum<OpenMPLastprivateModifier>());
C->setKindLoc(Record.readSourceLocation());
C->setColonLoc(Record.readSourceLocation());
unsigned NumVars = C->varlist_size(); unsigned NumVars = C->varlist_size();
SmallVector<Expr *, 16> Vars; SmallVector<Expr *, 16> Vars;
Vars.reserve(NumVars); Vars.reserve(NumVars);

View File

@ -6170,6 +6170,9 @@ void OMPClauseWriter::VisitOMPLastprivateClause(OMPLastprivateClause *C) {
Record.push_back(C->varlist_size()); Record.push_back(C->varlist_size());
VisitOMPClauseWithPostUpdate(C); VisitOMPClauseWithPostUpdate(C);
Record.AddSourceLocation(C->getLParenLoc()); Record.AddSourceLocation(C->getLParenLoc());
Record.writeEnum(C->getKind());
Record.AddSourceLocation(C->getKindLoc());
Record.AddSourceLocation(C->getColonLoc());
for (auto *VE : C->varlists()) for (auto *VE : C->varlists())
Record.AddStmt(VE); Record.AddStmt(VE);
for (auto *E : C->private_copies()) for (auto *E : C->private_copies())

View File

@ -1,6 +1,8 @@
// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 %s -Wuninitialized
void foo() { void foo() {
} }
@ -107,6 +109,11 @@ int foomain(int argc, char **argv) {
++k; ++k;
#pragma omp target #pragma omp target
#pragma omp teams #pragma omp teams
#pragma omp distribute parallel for lastprivate(conditional: argc) lastprivate(conditional: // expected-error 2 {{use of undeclared identifier 'conditional'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp target
#pragma omp teams
#pragma omp distribute parallel for lastprivate(S1) // expected-error {{'S1' does not refer to a value}} #pragma omp distribute parallel for lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;

View File

@ -1,6 +1,8 @@
// RUN: %clang_cc1 -verify -fopenmp %s -Wno-openmp-mapping -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 %s -Wno-openmp-mapping -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -fopenmp-version=50 %s -Wno-openmp-mapping -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wno-openmp-mapping -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 %s -Wno-openmp-mapping -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -fopenmp-version=50 %s -Wno-openmp-mapping -Wuninitialized
extern int omp_default_mem_alloc; extern int omp_default_mem_alloc;
void foo() { void foo() {
@ -108,6 +110,11 @@ int foomain(int argc, char **argv) {
++k; ++k;
#pragma omp target #pragma omp target
#pragma omp teams #pragma omp teams
#pragma omp distribute parallel for simd lastprivate(conditional: argc) lastprivate(conditional: // expected-error 2 {{use of undeclared identifier 'conditional'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp target
#pragma omp teams
#pragma omp distribute parallel for simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}} #pragma omp distribute parallel for simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;
@ -298,8 +305,8 @@ int main(int argc, char **argv) {
foo(); foo();
#pragma omp target #pragma omp target
#pragma omp teams #pragma omp teams
#pragma omp distribute parallel for simd lastprivate(i) // expected-note {{defined as lastprivate}} #pragma omp distribute parallel for simd lastprivate(i) // omp45-note {{defined as lastprivate}}
for (i = 0; i < argc; ++i) // expected-error{{loop iteration variable in the associated loop of 'omp distribute parallel for simd' directive may not be lastprivate, predetermined as linear}} for (i = 0; i < argc; ++i) // omp45-error {{loop iteration variable in the associated loop of 'omp distribute parallel for simd' directive may not be lastprivate, predetermined as linear}}
foo(); foo();
#pragma omp target #pragma omp target
#pragma omp teams #pragma omp teams

View File

@ -1,6 +1,8 @@
// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp-simd %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp-simd %s -Wuninitialized
extern int omp_default_mem_alloc; extern int omp_default_mem_alloc;
void foo() { void foo() {
@ -113,6 +115,11 @@ int foomain(int argc, char **argv) {
++k; ++k;
#pragma omp target #pragma omp target
#pragma omp teams #pragma omp teams
#pragma omp distribute simd lastprivate(conditional: argc) lastprivate(conditional: // expected-error 2 {{use of undeclared identifier 'conditional'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp target
#pragma omp teams
#pragma omp distribute simd lastprivate(a, b) // expected-error {{lastprivate variable with incomplete type 'S1'}} expected-warning {{Type 'const S2' is not trivially copyable and not guaranteed to be mapped correctly}} #pragma omp distribute simd lastprivate(a, b) // expected-error {{lastprivate variable with incomplete type 'S1'}} expected-warning {{Type 'const S2' is not trivially copyable and not guaranteed to be mapped correctly}}
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;
@ -298,8 +305,8 @@ int main(int argc, char **argv) {
foo(); foo();
#pragma omp target #pragma omp target
#pragma omp teams #pragma omp teams
#pragma omp distribute simd lastprivate(i) // expected-note {{defined as lastprivate}} #pragma omp distribute simd lastprivate(i) // omp45-note {{defined as lastprivate}}
for (i = 0; i < argc; ++i) // expected-error{{loop iteration variable in the associated loop of 'omp distribute simd' directive may not be lastprivate, predetermined as linear}} for (i = 0; i < argc; ++i) // omp45-error{{loop iteration variable in the associated loop of 'omp distribute simd' directive may not be lastprivate, predetermined as linear}}
foo(); foo();
#pragma omp target #pragma omp target
#pragma omp teams #pragma omp teams

View File

@ -1,6 +1,8 @@
// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp-simd %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp-simd %s -Wuninitialized
extern int omp_default_mem_alloc; extern int omp_default_mem_alloc;
void foo() { void foo() {
@ -55,7 +57,7 @@ public:
}; };
class S6 { class S6 {
int a; int a;
S6() : a(0) {} S6() : a(0) {} // omp45-note 2 {{implicitly declared private here}}
public: public:
S6(const S6 &s6) : a(s6.a) {} S6(const S6 &s6) : a(s6.a) {}
@ -71,6 +73,7 @@ int foomain(int argc, char **argv) {
I g(5); I g(5);
int i, k; int i, k;
int &j = i; int &j = i;
S6 s(0); // omp50-note {{'s' defined here}}
#pragma omp parallel #pragma omp parallel
#pragma omp for lastprivate // expected-error {{expected '(' after 'lastprivate'}} #pragma omp for lastprivate // expected-error {{expected '(' after 'lastprivate'}}
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
@ -104,6 +107,10 @@ int foomain(int argc, char **argv) {
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;
#pragma omp parallel #pragma omp parallel
#pragma omp for lastprivate(conditional: argc,s) lastprivate(conditional: // omp45-error 2 {{use of undeclared identifier 'conditional'}} omp50-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp45-error 2 {{calling a private constructor of class 'S6'}} omp50-error {{expected list item of scalar type in 'lastprivate' clause with 'conditional' modifier}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel
#pragma omp for lastprivate(a, b) // expected-error {{lastprivate variable with incomplete type 'S1'}} #pragma omp for lastprivate(a, b) // expected-error {{lastprivate variable with incomplete type 'S1'}}
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;

View File

@ -1,6 +1,8 @@
// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp-simd %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp-simd %s -Wuninitialized
extern int omp_default_mem_alloc; extern int omp_default_mem_alloc;
void foo() { void foo() {
@ -55,7 +57,7 @@ public:
}; };
class S6 { class S6 {
int a; int a;
S6() : a(0) {} S6() : a(0) {} // omp45-note 2 {{implicitly declared private here}}
public: public:
S6(const S6 &s6) : a(s6.a) {} S6(const S6 &s6) : a(s6.a) {}
@ -71,6 +73,7 @@ int foomain(int argc, char **argv) {
I g(5); I g(5);
int i, z; int i, z;
int &j = i; int &j = i;
S6 s(0); // omp50-note {{'s' defined here}}
#pragma omp parallel #pragma omp parallel
#pragma omp for simd lastprivate // expected-error {{expected '(' after 'lastprivate'}} #pragma omp for simd lastprivate // expected-error {{expected '(' after 'lastprivate'}}
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
@ -104,6 +107,10 @@ int foomain(int argc, char **argv) {
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;
#pragma omp parallel #pragma omp parallel
#pragma omp for simd lastprivate(conditional: argc,s) lastprivate(conditional: // omp45-error 2 {{use of undeclared identifier 'conditional'}} omp50-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp45-error 2 {{calling a private constructor of class 'S6'}} omp50-error {{expected list item of scalar type in 'lastprivate' clause with 'conditional' modifier}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel
#pragma omp for simd lastprivate(z, a, b) // expected-error {{lastprivate variable with incomplete type 'S1'}} #pragma omp for simd lastprivate(z, a, b) // expected-error {{lastprivate variable with incomplete type 'S1'}}
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;
@ -252,8 +259,8 @@ int main(int argc, char **argv) {
for (i = 0; i < argc; ++i) for (i = 0; i < argc; ++i)
foo(); foo();
#pragma omp parallel #pragma omp parallel
#pragma omp for simd lastprivate(i) // expected-note {{defined as lastprivate}} #pragma omp for simd lastprivate(i) // omp45-note {{defined as lastprivate}}
for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp for simd' directive may not be lastprivate, predetermined as linear}} for (i = 0; i < argc; ++i) // omp45-error {{loop iteration variable in the associated loop of 'omp for simd' directive may not be lastprivate, predetermined as linear}}
foo(); foo();
#pragma omp parallel private(xa) // expected-note {{defined as private}} #pragma omp parallel private(xa) // expected-note {{defined as private}}
#pragma omp for simd lastprivate(xa) // expected-error {{lastprivate variable must be shared}} #pragma omp for simd lastprivate(xa) // expected-error {{lastprivate variable must be shared}}

View File

@ -1,6 +1,8 @@
// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp-simd %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp-simd %s -Wuninitialized
typedef void **omp_allocator_handle_t; typedef void **omp_allocator_handle_t;
extern const omp_allocator_handle_t omp_default_mem_alloc; extern const omp_allocator_handle_t omp_default_mem_alloc;
@ -109,6 +111,10 @@ int foomain(int argc, char **argv) {
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;
#pragma omp parallel #pragma omp parallel
#pragma omp master taskloop lastprivate(conditional: argc) lastprivate(conditional: // expected-error 2 {{use of undeclared identifier 'conditional'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel
#pragma omp master taskloop lastprivate(S1) // expected-error {{'S1' does not refer to a value}} #pragma omp master taskloop lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;

View File

@ -63,7 +63,7 @@ T tmain(T argc) {
// CHECK-LABEL: int main(int argc, char **argv) { // CHECK-LABEL: int main(int argc, char **argv) {
int main(int argc, char **argv) { int main(int argc, char **argv) {
int b = argc, c, d, e, f, g; int b = argc, c, d, e, f, g, h;
static int a; static int a;
// CHECK: static int a; // CHECK: static int a;
#pragma omp taskgroup task_reduction(+: d) #pragma omp taskgroup task_reduction(+: d)

View File

@ -1,6 +1,8 @@
// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp-simd %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp-simd %s -Wuninitialized
typedef void **omp_allocator_handle_t; typedef void **omp_allocator_handle_t;
extern const omp_allocator_handle_t omp_default_mem_alloc; extern const omp_allocator_handle_t omp_default_mem_alloc;
@ -113,6 +115,10 @@ int foomain(int argc, char **argv) {
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;
#pragma omp parallel #pragma omp parallel
#pragma omp master taskloop simd lastprivate(conditional: argc) lastprivate(conditional: // expected-error 2 {{use of undeclared identifier 'conditional'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel
#pragma omp master taskloop simd lastprivate(z, a, b) // expected-error {{lastprivate variable with incomplete type 'S1'}} #pragma omp master taskloop simd lastprivate(z, a, b) // expected-error {{lastprivate variable with incomplete type 'S1'}}
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;
@ -268,8 +274,8 @@ int main(int argc, char **argv) {
for (i = 0; i < argc; ++i) for (i = 0; i < argc; ++i)
foo(); foo();
#pragma omp parallel #pragma omp parallel
#pragma omp master taskloop simd lastprivate(i) // expected-note {{defined as lastprivate}} #pragma omp master taskloop simd lastprivate(i) // omp45-note {{defined as lastprivate}}
for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp master taskloop simd' directive may not be lastprivate, predetermined as linear}} for (i = 0; i < argc; ++i) // omp45-error {{loop iteration variable in the associated loop of 'omp master taskloop simd' directive may not be lastprivate, predetermined as linear}}
foo(); foo();
#pragma omp parallel private(xa) #pragma omp parallel private(xa)
#pragma omp master taskloop simd lastprivate(xa) #pragma omp master taskloop simd lastprivate(xa)

View File

@ -70,8 +70,8 @@ T tmain(T argc) {
// CHECK: static T a; // CHECK: static T a;
static T g; static T g;
#pragma omp threadprivate(g) #pragma omp threadprivate(g)
#pragma omp parallel for schedule(dynamic) default(none) copyin(g) linear(a) allocate(a) #pragma omp parallel for schedule(dynamic) default(none) copyin(g) linear(a) allocate(a) lastprivate(conditional: d, e,f)
// CHECK: #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) lastprivate(conditional: d,e,f)
for (int i = 0; i < 2; ++i) for (int i = 0; i < 2; ++i)
a = 2; a = 2;
// CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: for (int i = 0; i < 2; ++i)

View File

@ -1,6 +1,8 @@
// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp-simd %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp-simd %s -Wuninitialized
extern int omp_default_mem_alloc; extern int omp_default_mem_alloc;
void foo() { void foo() {
@ -55,7 +57,7 @@ public:
}; };
class S6 { class S6 {
int a; int a;
S6() : a(0) {} S6() : a(0) {} // omp45-note 2 {{implicitly declared private here}}
public: public:
S6(const S6 &s6) : a(s6.a) {} S6(const S6 &s6) : a(s6.a) {}
@ -71,6 +73,7 @@ int foomain(int argc, char **argv) {
I g(5); I g(5);
int i, z; int i, z;
int &j = i; int &j = i;
S6 s(0); // omp50-note {{'s' defined here}}
#pragma omp parallel for lastprivate // expected-error {{expected '(' after 'lastprivate'}} #pragma omp parallel for lastprivate // expected-error {{expected '(' after 'lastprivate'}}
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;
@ -92,6 +95,9 @@ int foomain(int argc, char **argv) {
#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 '('}} #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) for (int k = 0; k < argc; ++k)
++k; ++k;
#pragma omp parallel for lastprivate(conditional: argc,s) lastprivate(conditional: // omp50-error {{expected expression}} omp45-error 2 {{use of undeclared identifier 'conditional'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp45-error 2 {{calling a private constructor of class 'S6'}} omp50-error {{expected list item of scalar type in 'lastprivate' clause with 'conditional' modifier}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel for lastprivate(S1) // expected-error {{'S1' does not refer to a value}} #pragma omp parallel for lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;

View File

@ -155,11 +155,11 @@ int main (int argc, char **argv) {
static int *a; static int *a;
// CHECK: static int *a; // CHECK: static int *a;
#ifdef OMP5 #ifdef OMP5
#pragma omp parallel for simd if(parallel :b) ordered if(simd: b) nontemporal(argc, c) #pragma omp parallel for simd if(parallel :b) ordered if(simd: b) nontemporal(argc, c) lastprivate(conditional:d,f)
#else #else
#pragma omp parallel for simd if(parallel :b) ordered #pragma omp parallel for simd if(parallel :b) ordered
#endif // OMP5 #endif // OMP5
// OMP50-NEXT: #pragma omp parallel for simd if(parallel: b) ordered if(simd: b) nontemporal(argc,c) // OMP50-NEXT: #pragma omp parallel for simd if(parallel: b) ordered if(simd: b) nontemporal(argc,c) lastprivate(conditional: d,f)
// OMP45-NEXT: #pragma omp parallel for simd if(parallel: b) ordered // OMP45-NEXT: #pragma omp parallel for simd if(parallel: b) ordered
for (int i=0; i < 2; ++i)*a=2; for (int i=0; i < 2; ++i)*a=2;
// CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: for (int i = 0; i < 2; ++i)

View File

@ -1,6 +1,8 @@
// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp-simd %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp-simd %s -Wuninitialized
extern int omp_default_mem_alloc; extern int omp_default_mem_alloc;
void foo() { void foo() {
@ -70,6 +72,7 @@ int foomain(int argc, char **argv) {
I g(5); I g(5);
int i, z; int i, z;
int &j = i; int &j = i;
S6 s(0); // omp50-note {{'s' defined here}}
#pragma omp parallel for simd lastprivate // expected-error {{expected '(' after 'lastprivate'}} #pragma omp parallel for simd lastprivate // expected-error {{expected '(' after 'lastprivate'}}
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;
@ -91,6 +94,9 @@ int foomain(int argc, char **argv) {
#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 '('}} #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) for (int k = 0; k < argc; ++k)
++k; ++k;
#pragma omp parallel for simd lastprivate(conditional: s,argc) lastprivate(conditional: // omp50-error {{expected expression}} omp45-error 2 {{use of undeclared identifier 'conditional'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp50-error {{expected list item of scalar type in 'lastprivate' clause with 'conditional' modifier}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel for simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}} #pragma omp parallel for simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;
@ -214,8 +220,8 @@ int main(int argc, char **argv) {
#pragma omp parallel for simd private(xa), lastprivate(xa) // expected-error {{private variable cannot be lastprivate}} expected-note {{defined as private}} #pragma omp parallel for simd private(xa), lastprivate(xa) // expected-error {{private variable cannot be lastprivate}} expected-note {{defined as private}}
for (i = 0; i < argc; ++i) for (i = 0; i < argc; ++i)
foo(); foo();
#pragma omp parallel for simd lastprivate(i) // expected-note {{defined as lastprivate}} #pragma omp parallel for simd lastprivate(i) // omp45-note {{defined as lastprivate}}
for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp parallel for simd' directive may not be lastprivate, predetermined as linear}} for (i = 0; i < argc; ++i) // omp45-error {{loop iteration variable in the associated loop of 'omp parallel for simd' directive may not be lastprivate, predetermined as linear}}
foo(); foo();
#pragma omp parallel private(xa) #pragma omp parallel private(xa)
#pragma omp parallel for simd lastprivate(xa) #pragma omp parallel for simd lastprivate(xa)

View File

@ -1,6 +1,8 @@
// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp-simd %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp-simd %s -Wuninitialized
typedef void **omp_allocator_handle_t; typedef void **omp_allocator_handle_t;
extern const omp_allocator_handle_t omp_default_mem_alloc; extern const omp_allocator_handle_t omp_default_mem_alloc;
@ -109,6 +111,10 @@ int foomain(int argc, char **argv) {
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;
#pragma omp parallel #pragma omp parallel
#pragma omp parallel master taskloop lastprivate(conditional: argc) lastprivate(conditional: // expected-error 2 {{use of undeclared identifier 'conditional'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel
#pragma omp parallel master taskloop lastprivate(S1) // expected-error {{'S1' does not refer to a value}} #pragma omp parallel master taskloop lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;

View File

@ -62,7 +62,7 @@ T tmain(T argc) {
// CHECK-LABEL: int main(int argc, char **argv) { // CHECK-LABEL: int main(int argc, char **argv) {
int main(int argc, char **argv) { int main(int argc, char **argv) {
int b = argc, c, d, e, f, g; int b = argc, c, d, e, f, g, h;
static int a; static int a;
// CHECK: static int a; // CHECK: static int a;
#pragma omp taskgroup task_reduction(+: d) #pragma omp taskgroup task_reduction(+: d)

View File

@ -1,6 +1,8 @@
// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp-simd %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp-simd %s -Wuninitialized
typedef void **omp_allocator_handle_t; typedef void **omp_allocator_handle_t;
extern const omp_allocator_handle_t omp_default_mem_alloc; extern const omp_allocator_handle_t omp_default_mem_alloc;
@ -109,6 +111,10 @@ int foomain(int argc, char **argv) {
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;
#pragma omp parallel #pragma omp parallel
#pragma omp parallel master taskloop simd lastprivate(conditional: argc) lastprivate(conditional: // expected-error 2 {{use of undeclared identifier 'conditional'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel
#pragma omp parallel master taskloop simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}} #pragma omp parallel master taskloop simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;

View File

@ -1,6 +1,8 @@
// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp-simd %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp-simd %s -Wuninitialized
extern int omp_default_mem_alloc; extern int omp_default_mem_alloc;
void foo() { void foo() {
@ -66,7 +68,7 @@ S3 h;
template <class I, class C> template <class I, class C>
int foomain(int argc, char **argv) { int foomain(int argc, char **argv) {
I e(4); I e(4); // omp50-note {{'e' defined here}}
I g(5); I g(5);
int i; int i;
int &j = i; int &j = i;
@ -98,6 +100,10 @@ int foomain(int argc, char **argv) {
{ {
foo(); foo();
} }
#pragma omp parallel sections lastprivate(conditional: e,argc) lastprivate(conditional: // omp50-error {{expected expression}} omp45-error 2 {{use of undeclared identifier 'conditional'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp50-error {{expected list item of scalar type in 'lastprivate' clause with 'conditional' modifier}}
{
foo();
}
#pragma omp parallel sections lastprivate(S1) // expected-error {{'S1' does not refer to a value}} #pragma omp parallel sections lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
{ {
foo(); foo();

View File

@ -1,6 +1,8 @@
// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp-simd %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp-simd %s -Wuninitialized
extern int omp_default_mem_alloc; extern int omp_default_mem_alloc;
void foo() { void foo() {
@ -54,7 +56,7 @@ public:
}; };
class S6 { class S6 {
int a; int a;
S6() : a(0) {} S6() : a(0) {} // omp45-note 2 {{implicitly declared private here}}
public: public:
S6(const S6 &s6) : a(s6.a) {} S6(const S6 &s6) : a(s6.a) {}
@ -70,6 +72,7 @@ int foomain(int argc, char **argv) {
I g(5); I g(5);
int i, k; int i, k;
int &j = i; int &j = i;
S6 s(0); // omp50-note {{'s' defined here}}
#pragma omp parallel #pragma omp parallel
#pragma omp sections lastprivate // expected-error {{expected '(' after 'lastprivate'}} #pragma omp sections lastprivate // expected-error {{expected '(' after 'lastprivate'}}
{ {
@ -106,6 +109,11 @@ int foomain(int argc, char **argv) {
foo(); foo();
} }
#pragma omp parallel #pragma omp parallel
#pragma omp sections lastprivate(conditional: argc,s) lastprivate(conditional: // omp50-error {{expected expression}} omp45-error 2 {{use of undeclared identifier 'conditional'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp45-error 2 {{calling a private constructor of class 'S6'}} omp50-error {{expected list item of scalar type in 'lastprivate' clause with 'conditional' modifier}}}
{
foo();
}
#pragma omp parallel
#pragma omp sections lastprivate(S1) // expected-error {{'S1' does not refer to a value}} #pragma omp sections lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
{ {
foo(); foo();

View File

@ -164,8 +164,8 @@ int main (int argc, char **argv) {
// CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: for (int i = 0; i < 2; ++i)
// CHECK-NEXT: *a = 2; // CHECK-NEXT: *a = 2;
#ifdef OMP5 #ifdef OMP5
#pragma omp simd private(argc, b),lastprivate(d,f) collapse(2) aligned(a : 4) if(simd:a) nontemporal(argc, c, d) #pragma omp simd private(argc, b),lastprivate(d,f) collapse(2) aligned(a : 4) if(simd:a) nontemporal(argc, c, d) lastprivate(conditional: e, f)
// OMP50-NEXT: #pragma omp simd private(argc,b) lastprivate(d,f) collapse(2) aligned(a: 4) if(simd: a) nontemporal(argc,c,d) // OMP50-NEXT: #pragma omp simd private(argc,b) lastprivate(d,f) collapse(2) aligned(a: 4) if(simd: a) nontemporal(argc,c,d) lastprivate(conditional: e,f)
#else #else
#pragma omp simd private(argc, b),lastprivate(d,f) collapse(2) aligned(a : 4) #pragma omp simd private(argc, b),lastprivate(d,f) collapse(2) aligned(a : 4)
// OMP45-NEXT: #pragma omp simd private(argc,b) lastprivate(d,f) collapse(2) aligned(a: 4) // OMP45-NEXT: #pragma omp simd private(argc,b) lastprivate(d,f) collapse(2) aligned(a: 4)

View File

@ -1,6 +1,8 @@
// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp-simd %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp-simd %s -Wuninitialized
extern int omp_default_mem_alloc; extern int omp_default_mem_alloc;
void foo() { void foo() {
@ -91,6 +93,9 @@ int foomain(I argc, C **argv) {
#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 '('}} #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) for (int k = 0; k < argc; ++k)
++k; ++k;
#pragma omp simd lastprivate(conditional: argc,g) lastprivate(conditional: // omp50-error {{expected expression}} omp45-error 2 {{use of undeclared identifier 'conditional'}} expected-error {{expected ')'}} expected-note {{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}} #pragma omp simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;
@ -205,8 +210,8 @@ int main(int argc, char **argv) {
#pragma omp simd private(xa), lastprivate(xa) // expected-error {{private variable cannot be lastprivate}} expected-note {{defined as private}} #pragma omp simd private(xa), lastprivate(xa) // expected-error {{private variable cannot be lastprivate}} expected-note {{defined as private}}
for (i = 0; i < argc; ++i) for (i = 0; i < argc; ++i)
foo(); foo();
#pragma omp simd lastprivate(i) // expected-note {{defined as lastprivate}} #pragma omp simd lastprivate(i) // omp45-note {{defined as lastprivate}}
for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp simd' directive may not be lastprivate, predetermined as linear}} for (i = 0; i < argc; ++i) // omp45-error {{loop iteration variable in the associated loop of 'omp simd' directive may not be lastprivate, predetermined as linear}}
foo(); foo();
#pragma omp parallel private(xa) #pragma omp parallel private(xa)
#pragma omp simd lastprivate(xa) // OK: may be lastprivate #pragma omp simd lastprivate(xa) // OK: may be lastprivate

View File

@ -1,6 +1,8 @@
// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp-simd %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp-simd %s -Wuninitialized
typedef void **omp_allocator_handle_t; typedef void **omp_allocator_handle_t;
extern const omp_allocator_handle_t omp_default_mem_alloc; extern const omp_allocator_handle_t omp_default_mem_alloc;
@ -80,6 +82,7 @@ int foomain(int argc, char **argv) {
I g(5); I g(5);
int i; int i;
int &j = i; int &j = i;
S6 s(0); // omp50-note {{'s' defined here}}
#pragma omp target parallel for lastprivate // expected-error {{expected '(' after 'lastprivate'}} #pragma omp target parallel for lastprivate // expected-error {{expected '(' after 'lastprivate'}}
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;
@ -101,6 +104,9 @@ int foomain(int argc, char **argv) {
#pragma omp target 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 '('}} #pragma omp target 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) for (int k = 0; k < argc; ++k)
++k; ++k;
#pragma omp target parallel for lastprivate(conditional: s,argc) lastprivate(conditional: // omp50-error {{expected expression}} omp45-error 2 {{use of undeclared identifier 'conditional'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp50-error {{expected list item of scalar type in 'lastprivate' clause with 'conditional' modifier}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp target parallel for lastprivate(S1) // expected-error {{'S1' does not refer to a value}} #pragma omp target parallel for lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;

View File

@ -1,6 +1,8 @@
// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp-simd %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp-simd %s -Wuninitialized
typedef void **omp_allocator_handle_t; typedef void **omp_allocator_handle_t;
extern const omp_allocator_handle_t omp_default_mem_alloc; extern const omp_allocator_handle_t omp_default_mem_alloc;
@ -64,7 +66,7 @@ public:
}; };
class S6 { class S6 {
int a; int a;
S6() : a(0) {} S6() : a(0) {} // omp45-note 2 {{implicitly declared private here}}
public: public:
S6(const S6 &s6) : a(s6.a) {} S6(const S6 &s6) : a(s6.a) {}
@ -80,6 +82,7 @@ int foomain(int argc, char **argv) {
I g(5); I g(5);
int i, z; int i, z;
int &j = i; int &j = i;
S6 s(0); // omp50-note {{'s' defined here}}
#pragma omp target parallel for simd lastprivate // expected-error {{expected '(' after 'lastprivate'}} #pragma omp target parallel for simd lastprivate // expected-error {{expected '(' after 'lastprivate'}}
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;
@ -101,6 +104,9 @@ int foomain(int argc, char **argv) {
#pragma omp target parallel for simd allocate(omp_thread_mem_alloc: argc) lastprivate(argc) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target parallel for simd' directive}} #pragma omp target parallel for simd allocate(omp_thread_mem_alloc: argc) lastprivate(argc) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target parallel for simd' directive}}
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;
#pragma omp target parallel for simd lastprivate(conditional: argc,s) lastprivate(conditional: // omp50-error {{expected expression}} omp45-error 2 {{use of undeclared identifier 'conditional'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp45-error 2 {{calling a private constructor of class 'S6'}} omp50-error {{expected list item of scalar type in 'lastprivate' clause with 'conditional' modifier}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp target parallel for simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}} #pragma omp target parallel for simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;
@ -221,8 +227,8 @@ int main(int argc, char **argv) {
#pragma omp target parallel for simd private(xa), lastprivate(xa) // expected-error {{private variable cannot be lastprivate}} expected-note {{defined as private}} #pragma omp target parallel for simd private(xa), lastprivate(xa) // expected-error {{private variable cannot be lastprivate}} expected-note {{defined as private}}
for (i = 0; i < argc; ++i) for (i = 0; i < argc; ++i)
foo(); foo();
// expected-note@+2 {{defined as lastprivate}} // omp45-note@+2 {{defined as lastprivate}}
// expected-error@+2 {{loop iteration variable in the associated loop of 'omp target parallel for simd' directive may not be lastprivate, predetermined as linear}} // omp45-error@+2 {{loop iteration variable in the associated loop of 'omp target parallel for simd' directive may not be lastprivate, predetermined as linear}}
#pragma omp target parallel for simd lastprivate(i) #pragma omp target parallel for simd lastprivate(i)
for (i = 0; i < argc; ++i) for (i = 0; i < argc; ++i)
foo(); foo();

View File

@ -242,13 +242,13 @@ int main(int argc, char **argv) {
// CHECK-NEXT: } // CHECK-NEXT: }
#ifdef OMP5 #ifdef OMP5
#pragma omp target simd if (target:argc > 0) if(simd:argc) nontemporal(argc, c, d) #pragma omp target simd if (target:argc > 0) if(simd:argc) nontemporal(argc, c, d) lastprivate(conditional: d, f)
#else #else
#pragma omp target simd if (target:argc > 0) #pragma omp target simd if (target:argc > 0)
#endif // OMP5 #endif // OMP5
for (int i = 0; i < 2; ++i) {} for (int i = 0; i < 2; ++i) {}
// OMP45: #pragma omp target simd if(target: argc > 0) // OMP45: #pragma omp target simd if(target: argc > 0)
// OMP50: #pragma omp target simd if(target: argc > 0) if(simd: argc) nontemporal(argc,c,d) // OMP50: #pragma omp target simd if(target: argc > 0) if(simd: argc) nontemporal(argc,c,d) lastprivate(conditional: d,f)
// CHECK-NEXT: for (int i = 0; i < 2; ++i) { // CHECK-NEXT: for (int i = 0; i < 2; ++i) {
// CHECK-NEXT: } // CHECK-NEXT: }

View File

@ -1,6 +1,8 @@
// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp-simd %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp-simd %s -Wuninitialized
typedef void **omp_allocator_handle_t; typedef void **omp_allocator_handle_t;
extern const omp_allocator_handle_t omp_default_mem_alloc; extern const omp_allocator_handle_t omp_default_mem_alloc;
@ -80,6 +82,7 @@ int foomain(int argc, char **argv) {
I g(5); I g(5);
int i; int i;
int &j = i; int &j = i;
S6 s(0); // omp50-note {{'s' defined here}}
#pragma omp target simd lastprivate // expected-error {{expected '(' after 'lastprivate'}} #pragma omp target simd lastprivate // expected-error {{expected '(' after 'lastprivate'}}
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;
@ -101,6 +104,9 @@ int foomain(int argc, char **argv) {
#pragma omp target 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 '('}} #pragma omp target 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) for (int k = 0; k < argc; ++k)
++k; ++k;
#pragma omp target simd lastprivate(conditional: s,argc) lastprivate(conditional: // omp45-error 2 {{use of undeclared identifier 'conditional'}} omp50-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp50-error {{expected list item of scalar type in 'lastprivate' clause with 'conditional' modifier}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp target simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}} #pragma omp target simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;
@ -221,8 +227,8 @@ int main(int argc, char **argv) {
#pragma omp target simd private(xa), lastprivate(xa) // expected-error {{private variable cannot be lastprivate}} expected-note {{defined as private}} #pragma omp target simd private(xa), lastprivate(xa) // expected-error {{private variable cannot be lastprivate}} expected-note {{defined as private}}
for (i = 0; i < argc; ++i) for (i = 0; i < argc; ++i)
foo(); foo();
#pragma omp target simd lastprivate(i) // expected-note {{defined as lastprivate}} #pragma omp target simd lastprivate(i) // omp45-note {{defined as lastprivate}}
for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp target simd' directive may not be lastprivate, predetermined as linear}} for (i = 0; i < argc; ++i) // omp45-error {{loop iteration variable in the associated loop of 'omp target simd' directive may not be lastprivate, predetermined as linear}}
foo(); foo();
#pragma omp parallel private(xa) #pragma omp parallel private(xa)
#pragma omp target simd lastprivate(xa) #pragma omp target simd lastprivate(xa)

View File

@ -1,6 +1,8 @@
// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp-simd %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp-simd %s -Wuninitialized
typedef void **omp_allocator_handle_t; typedef void **omp_allocator_handle_t;
extern const omp_allocator_handle_t omp_default_mem_alloc; extern const omp_allocator_handle_t omp_default_mem_alloc;
@ -175,6 +177,8 @@ int main(int argc, char **argv) {
#pragma omp target teams distribute 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 '('}} #pragma omp target teams distribute 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(); for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute lastprivate(conditional: argc) lastprivate(conditional: // expected-error 2 {{use of undeclared identifier 'conditional'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (i = 0; i < argc; ++i) foo();
#pragma omp target teams distribute lastprivate(S1) // expected-error {{'S1' does not refer to a value}} #pragma omp target teams distribute lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
for (i = 0; i < argc; ++i) foo(); for (i = 0; i < argc; ++i) foo();

View File

@ -1,9 +1,10 @@
// RUN: %clang_cc1 -verify=expected,le45 -fopenmp %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,le45 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,le45 -fopenmp-version=40 -fopenmp %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,le45 -fopenmp-version=40 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,le45 -fopenmp-version=45 -fopenmp %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,le45 -fopenmp-version=45 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected -fopenmp-version=50 -fopenmp %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,le45 -fopenmp-simd %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,le45 -fopenmp-version=45 -fopenmp-simd %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp-simd %s -Wuninitialized
typedef void **omp_allocator_handle_t; typedef void **omp_allocator_handle_t;
extern const omp_allocator_handle_t omp_default_mem_alloc; extern const omp_allocator_handle_t omp_default_mem_alloc;
@ -104,6 +105,8 @@ int foomain(int argc, char **argv) {
#pragma omp target teams 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 '('}} #pragma omp target teams 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; for (int k = 0; k < argc; ++k) ++k;
#pragma omp target teams distribute parallel for lastprivate(conditional: argc) lastprivate(conditional: // expected-error 2 {{use of undeclared identifier 'conditional'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int k = 0; k < argc; ++k) ++k;
#pragma omp target teams distribute parallel for lastprivate(S1) // expected-error {{'S1' does not refer to a value}} #pragma omp target teams distribute parallel for lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
for (int k = 0; k < argc; ++k) ++k; for (int k = 0; k < argc; ++k) ++k;

View File

@ -4,6 +4,7 @@
// RUN: %clang_cc1 -verify=expected -fopenmp-version=50 -fopenmp %s -Wuninitialized // RUN: %clang_cc1 -verify=expected -fopenmp-version=50 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,le45 -fopenmp-simd %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,le45 -fopenmp-simd %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected -fopenmp-version=50 -fopenmp-simd %s -Wuninitialized
typedef void **omp_allocator_handle_t; typedef void **omp_allocator_handle_t;
extern const omp_allocator_handle_t omp_default_mem_alloc; extern const omp_allocator_handle_t omp_default_mem_alloc;
@ -104,6 +105,9 @@ int foomain(int argc, char **argv) {
#pragma omp target teams 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 '('}} #pragma omp target teams 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 (int k = 0; k < argc; ++k) ++k; for (int k = 0; k < argc; ++k) ++k;
#pragma omp target teams distribute parallel for simd lastprivate(conditional: argc) lastprivate(conditional: // expected-error 2 {{use of undeclared identifier 'conditional'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int k = 0; k < argc; ++k) ++k;
#pragma omp target teams distribute parallel for simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}} #pragma omp target teams distribute parallel for simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
for (int k = 0; k < argc; ++k) ++k; for (int k = 0; k < argc; ++k) ++k;

View File

@ -4,6 +4,7 @@
// RUN: %clang_cc1 -verify=expected -fopenmp-version=50 -fopenmp %s -Wuninitialized // RUN: %clang_cc1 -verify=expected -fopenmp-version=50 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,le45 -fopenmp-simd %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,le45 -fopenmp-simd %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected -fopenmp-version=50 -fopenmp-simd %s -Wuninitialized
typedef void **omp_allocator_handle_t; typedef void **omp_allocator_handle_t;
extern const omp_allocator_handle_t omp_default_mem_alloc; extern const omp_allocator_handle_t omp_default_mem_alloc;
@ -104,6 +105,9 @@ int foomain(int argc, char **argv) {
#pragma omp target teams 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 '('}} #pragma omp target teams 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 (int k = 0; k < argc; ++k) ++k; for (int k = 0; k < argc; ++k) ++k;
#pragma omp target teams distribute simd lastprivate(conditional: argc) lastprivate(conditional: // expected-error 2 {{use of undeclared identifier 'conditional'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int k = 0; k < argc; ++k) ++k;
#pragma omp target teams distribute simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}} #pragma omp target teams distribute simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
for (int k = 0; k < argc; ++k) ++k; for (int k = 0; k < argc; ++k) ++k;

View File

@ -1,6 +1,8 @@
// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp-simd %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp-simd %s -Wuninitialized
typedef void **omp_allocator_handle_t; typedef void **omp_allocator_handle_t;
extern const omp_allocator_handle_t omp_default_mem_alloc; extern const omp_allocator_handle_t omp_default_mem_alloc;
@ -109,6 +111,10 @@ int foomain(int argc, char **argv) {
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;
#pragma omp parallel #pragma omp parallel
#pragma omp taskloop lastprivate(conditional: argc) lastprivate(conditional: // expected-error 2 {{use of undeclared identifier 'conditional'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel
#pragma omp taskloop lastprivate(S1) // expected-error {{'S1' does not refer to a value}} #pragma omp taskloop lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;

View File

@ -63,7 +63,7 @@ T tmain(T argc) {
// CHECK-LABEL: int main(int argc, char **argv) { // CHECK-LABEL: int main(int argc, char **argv) {
int main(int argc, char **argv) { int main(int argc, char **argv) {
int b = argc, c, d, e, f, g; int b = argc, c, d, e, f, g, h;
static int a; static int a;
// CHECK: static int a; // CHECK: static int a;
#pragma omp taskgroup task_reduction(+: d) #pragma omp taskgroup task_reduction(+: d)

View File

@ -1,6 +1,8 @@
// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp %s -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp-simd %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp-simd %s -Wuninitialized
typedef void **omp_allocator_handle_t; typedef void **omp_allocator_handle_t;
extern const omp_allocator_handle_t omp_default_mem_alloc; extern const omp_allocator_handle_t omp_default_mem_alloc;
@ -109,6 +111,10 @@ int foomain(int argc, char **argv) {
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;
#pragma omp parallel #pragma omp parallel
#pragma omp taskloop simd lastprivate(conditional: argc) lastprivate(conditional: // expected-error 2 {{use of undeclared identifier 'conditional'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int k = 0; k < argc; ++k)
++k;
#pragma omp parallel
#pragma omp taskloop simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}} #pragma omp taskloop simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
for (int k = 0; k < argc; ++k) for (int k = 0; k < argc; ++k)
++k; ++k;
@ -268,8 +274,8 @@ int main(int argc, char **argv) {
for (i = 0; i < argc; ++i) for (i = 0; i < argc; ++i)
foo(); foo();
#pragma omp parallel #pragma omp parallel
#pragma omp taskloop simd lastprivate(i) // expected-note {{defined as lastprivate}} #pragma omp taskloop simd lastprivate(i) // omp45-note {{defined as lastprivate}}
for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp taskloop simd' directive may not be lastprivate, predetermined as linear}} for (i = 0; i < argc; ++i) // omp45-error {{loop iteration variable in the associated loop of 'omp taskloop simd' directive may not be lastprivate, predetermined as linear}}
foo(); foo();
#pragma omp parallel private(xa) #pragma omp parallel private(xa)
#pragma omp taskloop simd lastprivate(xa) #pragma omp taskloop simd lastprivate(xa)

View File

@ -1,6 +1,8 @@
// RUN: %clang_cc1 -verify -fopenmp %s -Wno-openmp-mapping -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp %s -Wno-openmp-mapping -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp %s -Wno-openmp-mapping -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wno-openmp-mapping -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp-simd %s -Wno-openmp-mapping -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp-simd %s -Wno-openmp-mapping -Wuninitialized
extern int omp_default_mem_alloc; extern int omp_default_mem_alloc;
void foo() { void foo() {
@ -99,6 +101,10 @@ int foomain(int argc, char **argv) {
#pragma omp teams distribute 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 '('}} #pragma omp teams distribute 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; for (int k = 0; k < argc; ++k) ++k;
#pragma omp target
#pragma omp teams distribute lastprivate(conditional: argc) lastprivate(conditional: // expected-error 2 {{use of undeclared identifier 'conditional'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int k = 0; k < argc; ++k) ++k;
#pragma omp target #pragma omp target
#pragma omp teams distribute lastprivate(S1) // expected-error {{'S1' does not refer to a value}} #pragma omp teams distribute lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
for (int k = 0; k < argc; ++k) ++k; for (int k = 0; k < argc; ++k) ++k;

View File

@ -1,6 +1,8 @@
// RUN: %clang_cc1 -verify -fopenmp %s -Wno-openmp-mapping -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp %s -Wno-openmp-mapping -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp %s -Wno-openmp-mapping -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wno-openmp-mapping -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp-simd %s -Wno-openmp-mapping -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp-simd %s -Wno-openmp-mapping -Wuninitialized
extern int omp_default_mem_alloc; extern int omp_default_mem_alloc;
void foo() { void foo() {
@ -99,6 +101,10 @@ int foomain(int argc, char **argv) {
#pragma omp teams 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 '('}} #pragma omp teams 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; for (int k = 0; k < argc; ++k) ++k;
#pragma omp target
#pragma omp teams distribute parallel for lastprivate(conditional: argc) lastprivate(conditional: // expected-error 2 {{use of undeclared identifier 'conditional'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int k = 0; k < argc; ++k) ++k;
#pragma omp target #pragma omp target
#pragma omp teams distribute parallel for lastprivate(S1) // expected-error {{'S1' does not refer to a value}} #pragma omp teams distribute parallel for lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
for (int k = 0; k < argc; ++k) ++k; for (int k = 0; k < argc; ++k) ++k;

View File

@ -1,6 +1,8 @@
// RUN: %clang_cc1 -verify -fopenmp %s -Wno-openmp-mapping -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp %s -Wno-openmp-mapping -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp %s -Wno-openmp-mapping -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wno-openmp-mapping -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp-simd %s -Wno-openmp-mapping -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp-simd %s -Wno-openmp-mapping -Wuninitialized
extern int omp_default_mem_alloc; extern int omp_default_mem_alloc;
void foo() { void foo() {
@ -99,6 +101,10 @@ int foomain(int argc, char **argv) {
#pragma omp teams 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 '('}} #pragma omp teams 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 (int k = 0; k < argc; ++k) ++k; for (int k = 0; k < argc; ++k) ++k;
#pragma omp target
#pragma omp teams distribute parallel for simd lastprivate(conditional: argc) lastprivate(conditional: // expected-error 2 {{use of undeclared identifier 'conditional'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int k = 0; k < argc; ++k) ++k;
#pragma omp target #pragma omp target
#pragma omp teams distribute parallel for simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}} #pragma omp teams distribute parallel for simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
for (int k = 0; k < argc; ++k) ++k; for (int k = 0; k < argc; ++k) ++k;

View File

@ -1,6 +1,8 @@
// RUN: %clang_cc1 -verify -fopenmp %s -Wno-openmp-mapping -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp %s -Wno-openmp-mapping -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp %s -Wno-openmp-mapping -Wuninitialized
// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wno-openmp-mapping -Wuninitialized // RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-version=45 -fopenmp-simd %s -Wno-openmp-mapping -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-version=50 -fopenmp-simd %s -Wno-openmp-mapping -Wuninitialized
extern int omp_default_mem_alloc; extern int omp_default_mem_alloc;
void foo() { void foo() {
@ -103,6 +105,10 @@ int foomain(int argc, char **argv) {
#pragma omp teams distribute simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}} #pragma omp teams distribute simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
for (int k = 0; k < argc; ++k) ++k; for (int k = 0; k < argc; ++k) ++k;
#pragma omp target
#pragma omp teams distribute simd lastprivate(conditional: argc) lastprivate(conditional: // expected-error 2 {{use of undeclared identifier 'conditional'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
for (int k = 0; k < argc; ++k) ++k;
#pragma omp target #pragma omp target
#pragma omp teams distribute simd lastprivate(k, a, b) // expected-error {{lastprivate variable with incomplete type 'S1'}} #pragma omp teams distribute simd lastprivate(k, a, b) // expected-error {{lastprivate variable with incomplete type 'S1'}}
for (int k = 0; k < argc; ++k) ++k; for (int k = 0; k < argc; ++k) ++k;