forked from OSchip/llvm-project
[OPENMP] Fix for declarative/standalone directives use.
Fixes processing of declarative directives and standalone executable directives. Declarative directives should not be allowed as an immediate statements and standalone executable directives are allowed to be used in case-stmt constructs. llvm-svn: 257586
This commit is contained in:
parent
529b940a77
commit
c4fad65bfc
|
@ -1644,13 +1644,22 @@ private:
|
||||||
/// A SmallVector of types.
|
/// A SmallVector of types.
|
||||||
typedef SmallVector<ParsedType, 12> TypeVector;
|
typedef SmallVector<ParsedType, 12> TypeVector;
|
||||||
|
|
||||||
StmtResult ParseStatement(SourceLocation *TrailingElseLoc = nullptr);
|
StmtResult ParseStatement(SourceLocation *TrailingElseLoc = nullptr,
|
||||||
|
bool AllowOpenMPStandalone = false);
|
||||||
|
enum AllowedContsructsKind {
|
||||||
|
/// \brief Allow any declarations, statements, OpenMP directives.
|
||||||
|
ACK_Any,
|
||||||
|
/// \brief Allow only statements and non-standalone OpenMP directives.
|
||||||
|
ACK_StatementsOpenMPNonStandalone,
|
||||||
|
/// \brief Allow statements and all executable OpenMP directives
|
||||||
|
ACK_StatementsOpenMPAnyExecutable
|
||||||
|
};
|
||||||
StmtResult
|
StmtResult
|
||||||
ParseStatementOrDeclaration(StmtVector &Stmts, bool OnlyStatement,
|
ParseStatementOrDeclaration(StmtVector &Stmts, AllowedContsructsKind Allowed,
|
||||||
SourceLocation *TrailingElseLoc = nullptr);
|
SourceLocation *TrailingElseLoc = nullptr);
|
||||||
StmtResult ParseStatementOrDeclarationAfterAttributes(
|
StmtResult ParseStatementOrDeclarationAfterAttributes(
|
||||||
StmtVector &Stmts,
|
StmtVector &Stmts,
|
||||||
bool OnlyStatement,
|
AllowedContsructsKind Allowed,
|
||||||
SourceLocation *TrailingElseLoc,
|
SourceLocation *TrailingElseLoc,
|
||||||
ParsedAttributesWithRange &Attrs);
|
ParsedAttributesWithRange &Attrs);
|
||||||
StmtResult ParseExprStatement();
|
StmtResult ParseExprStatement();
|
||||||
|
@ -1678,7 +1687,8 @@ private:
|
||||||
StmtResult ParseReturnStatement();
|
StmtResult ParseReturnStatement();
|
||||||
StmtResult ParseAsmStatement(bool &msAsm);
|
StmtResult ParseAsmStatement(bool &msAsm);
|
||||||
StmtResult ParseMicrosoftAsmStatement(SourceLocation AsmLoc);
|
StmtResult ParseMicrosoftAsmStatement(SourceLocation AsmLoc);
|
||||||
StmtResult ParsePragmaLoopHint(StmtVector &Stmts, bool OnlyStatement,
|
StmtResult ParsePragmaLoopHint(StmtVector &Stmts,
|
||||||
|
AllowedContsructsKind Allowed,
|
||||||
SourceLocation *TrailingElseLoc,
|
SourceLocation *TrailingElseLoc,
|
||||||
ParsedAttributesWithRange &Attrs);
|
ParsedAttributesWithRange &Attrs);
|
||||||
|
|
||||||
|
@ -2443,11 +2453,13 @@ private:
|
||||||
bool AllowScopeSpecifier);
|
bool AllowScopeSpecifier);
|
||||||
/// \brief Parses declarative or executable directive.
|
/// \brief Parses declarative or executable directive.
|
||||||
///
|
///
|
||||||
/// \param StandAloneAllowed true if allowed stand-alone directives,
|
/// \param Allowed ACK_Any, if any directives are allowed,
|
||||||
/// false - otherwise
|
/// ACK_StatementsOpenMPAnyExecutable - if any executable directives are
|
||||||
|
/// allowed, ACK_StatementsOpenMPNonStandalone - if only non-standalone
|
||||||
|
/// executable directives are allowed.
|
||||||
///
|
///
|
||||||
StmtResult
|
StmtResult
|
||||||
ParseOpenMPDeclarativeOrExecutableDirective(bool StandAloneAllowed);
|
ParseOpenMPDeclarativeOrExecutableDirective(AllowedContsructsKind Allowed);
|
||||||
/// \brief Parses clause of kind \a CKind for directive of a kind \a Kind.
|
/// \brief Parses clause of kind \a CKind for directive of a kind \a Kind.
|
||||||
///
|
///
|
||||||
/// \param DKind Kind of current directive.
|
/// \param DKind Kind of current directive.
|
||||||
|
|
|
@ -165,8 +165,8 @@ Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirective() {
|
||||||
/// 'distribute'
|
/// 'distribute'
|
||||||
/// annot_pragma_openmp_end
|
/// annot_pragma_openmp_end
|
||||||
///
|
///
|
||||||
StmtResult
|
StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective(
|
||||||
Parser::ParseOpenMPDeclarativeOrExecutableDirective(bool StandAloneAllowed) {
|
AllowedContsructsKind Allowed) {
|
||||||
assert(Tok.is(tok::annot_pragma_openmp) && "Not an OpenMP directive!");
|
assert(Tok.is(tok::annot_pragma_openmp) && "Not an OpenMP directive!");
|
||||||
ParenBraceBracketBalancer BalancerRAIIObj(*this);
|
ParenBraceBracketBalancer BalancerRAIIObj(*this);
|
||||||
SmallVector<Expr *, 5> Identifiers;
|
SmallVector<Expr *, 5> Identifiers;
|
||||||
|
@ -186,6 +186,10 @@ Parser::ParseOpenMPDeclarativeOrExecutableDirective(bool StandAloneAllowed) {
|
||||||
|
|
||||||
switch (DKind) {
|
switch (DKind) {
|
||||||
case OMPD_threadprivate:
|
case OMPD_threadprivate:
|
||||||
|
if (Allowed != ACK_Any) {
|
||||||
|
Diag(Tok, diag::err_omp_immediate_directive)
|
||||||
|
<< getOpenMPDirectiveName(DKind) << 0;
|
||||||
|
}
|
||||||
ConsumeToken();
|
ConsumeToken();
|
||||||
if (!ParseOpenMPSimpleVarList(OMPD_threadprivate, Identifiers, false)) {
|
if (!ParseOpenMPSimpleVarList(OMPD_threadprivate, Identifiers, false)) {
|
||||||
// The last seen token is annot_pragma_openmp_end - need to check for
|
// The last seen token is annot_pragma_openmp_end - need to check for
|
||||||
|
@ -213,7 +217,7 @@ Parser::ParseOpenMPDeclarativeOrExecutableDirective(bool StandAloneAllowed) {
|
||||||
case OMPD_taskwait:
|
case OMPD_taskwait:
|
||||||
case OMPD_cancellation_point:
|
case OMPD_cancellation_point:
|
||||||
case OMPD_cancel:
|
case OMPD_cancel:
|
||||||
if (!StandAloneAllowed) {
|
if (Allowed == ACK_StatementsOpenMPNonStandalone) {
|
||||||
Diag(Tok, diag::err_omp_immediate_directive)
|
Diag(Tok, diag::err_omp_immediate_directive)
|
||||||
<< getOpenMPDirectiveName(DKind) << 0;
|
<< getOpenMPDirectiveName(DKind) << 0;
|
||||||
}
|
}
|
||||||
|
@ -299,7 +303,7 @@ Parser::ParseOpenMPDeclarativeOrExecutableDirective(bool StandAloneAllowed) {
|
||||||
// If the depend clause is specified, the ordered construct is a stand-alone
|
// If the depend clause is specified, the ordered construct is a stand-alone
|
||||||
// directive.
|
// directive.
|
||||||
if (DKind == OMPD_ordered && FirstClauses[OMPC_depend].getInt()) {
|
if (DKind == OMPD_ordered && FirstClauses[OMPC_depend].getInt()) {
|
||||||
if (!StandAloneAllowed) {
|
if (Allowed == ACK_StatementsOpenMPNonStandalone) {
|
||||||
Diag(Loc, diag::err_omp_immediate_directive)
|
Diag(Loc, diag::err_omp_immediate_directive)
|
||||||
<< getOpenMPDirectiveName(DKind) << 1
|
<< getOpenMPDirectiveName(DKind) << 1
|
||||||
<< getOpenMPClauseName(OMPC_depend);
|
<< getOpenMPClauseName(OMPC_depend);
|
||||||
|
|
|
@ -32,14 +32,18 @@ using namespace clang;
|
||||||
|
|
||||||
/// \brief Parse a standalone statement (for instance, as the body of an 'if',
|
/// \brief Parse a standalone statement (for instance, as the body of an 'if',
|
||||||
/// 'while', or 'for').
|
/// 'while', or 'for').
|
||||||
StmtResult Parser::ParseStatement(SourceLocation *TrailingElseLoc) {
|
StmtResult Parser::ParseStatement(SourceLocation *TrailingElseLoc,
|
||||||
|
bool AllowOpenMPStandalone) {
|
||||||
StmtResult Res;
|
StmtResult Res;
|
||||||
|
|
||||||
// We may get back a null statement if we found a #pragma. Keep going until
|
// We may get back a null statement if we found a #pragma. Keep going until
|
||||||
// we get an actual statement.
|
// we get an actual statement.
|
||||||
do {
|
do {
|
||||||
StmtVector Stmts;
|
StmtVector Stmts;
|
||||||
Res = ParseStatementOrDeclaration(Stmts, true, TrailingElseLoc);
|
Res = ParseStatementOrDeclaration(
|
||||||
|
Stmts, AllowOpenMPStandalone ? ACK_StatementsOpenMPAnyExecutable
|
||||||
|
: ACK_StatementsOpenMPNonStandalone,
|
||||||
|
TrailingElseLoc);
|
||||||
} while (!Res.isInvalid() && !Res.get());
|
} while (!Res.isInvalid() && !Res.get());
|
||||||
|
|
||||||
return Res;
|
return Res;
|
||||||
|
@ -95,7 +99,8 @@ StmtResult Parser::ParseStatement(SourceLocation *TrailingElseLoc) {
|
||||||
/// [OBC] '@' 'throw' ';'
|
/// [OBC] '@' 'throw' ';'
|
||||||
///
|
///
|
||||||
StmtResult
|
StmtResult
|
||||||
Parser::ParseStatementOrDeclaration(StmtVector &Stmts, bool OnlyStatement,
|
Parser::ParseStatementOrDeclaration(StmtVector &Stmts,
|
||||||
|
AllowedContsructsKind Allowed,
|
||||||
SourceLocation *TrailingElseLoc) {
|
SourceLocation *TrailingElseLoc) {
|
||||||
|
|
||||||
ParenBraceBracketBalancer BalancerRAIIObj(*this);
|
ParenBraceBracketBalancer BalancerRAIIObj(*this);
|
||||||
|
@ -103,8 +108,8 @@ Parser::ParseStatementOrDeclaration(StmtVector &Stmts, bool OnlyStatement,
|
||||||
ParsedAttributesWithRange Attrs(AttrFactory);
|
ParsedAttributesWithRange Attrs(AttrFactory);
|
||||||
MaybeParseCXX11Attributes(Attrs, nullptr, /*MightBeObjCMessageSend*/ true);
|
MaybeParseCXX11Attributes(Attrs, nullptr, /*MightBeObjCMessageSend*/ true);
|
||||||
|
|
||||||
StmtResult Res = ParseStatementOrDeclarationAfterAttributes(Stmts,
|
StmtResult Res = ParseStatementOrDeclarationAfterAttributes(
|
||||||
OnlyStatement, TrailingElseLoc, Attrs);
|
Stmts, Allowed, TrailingElseLoc, Attrs);
|
||||||
|
|
||||||
assert((Attrs.empty() || Res.isInvalid() || Res.isUsable()) &&
|
assert((Attrs.empty() || Res.isInvalid() || Res.isUsable()) &&
|
||||||
"attributes on empty statement");
|
"attributes on empty statement");
|
||||||
|
@ -146,7 +151,7 @@ private:
|
||||||
|
|
||||||
StmtResult
|
StmtResult
|
||||||
Parser::ParseStatementOrDeclarationAfterAttributes(StmtVector &Stmts,
|
Parser::ParseStatementOrDeclarationAfterAttributes(StmtVector &Stmts,
|
||||||
bool OnlyStatement, SourceLocation *TrailingElseLoc,
|
AllowedContsructsKind Allowed, SourceLocation *TrailingElseLoc,
|
||||||
ParsedAttributesWithRange &Attrs) {
|
ParsedAttributesWithRange &Attrs) {
|
||||||
const char *SemiError = nullptr;
|
const char *SemiError = nullptr;
|
||||||
StmtResult Res;
|
StmtResult Res;
|
||||||
|
@ -202,7 +207,8 @@ Retry:
|
||||||
}
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
if ((getLangOpts().CPlusPlus || !OnlyStatement) && isDeclarationStatement()) {
|
if ((getLangOpts().CPlusPlus || Allowed == ACK_Any) &&
|
||||||
|
isDeclarationStatement()) {
|
||||||
SourceLocation DeclStart = Tok.getLocation(), DeclEnd;
|
SourceLocation DeclStart = Tok.getLocation(), DeclEnd;
|
||||||
DeclGroupPtrTy Decl = ParseDeclaration(Declarator::BlockContext,
|
DeclGroupPtrTy Decl = ParseDeclaration(Declarator::BlockContext,
|
||||||
DeclEnd, Attrs);
|
DeclEnd, Attrs);
|
||||||
|
@ -346,7 +352,7 @@ Retry:
|
||||||
|
|
||||||
case tok::annot_pragma_openmp:
|
case tok::annot_pragma_openmp:
|
||||||
ProhibitAttributes(Attrs);
|
ProhibitAttributes(Attrs);
|
||||||
return ParseOpenMPDeclarativeOrExecutableDirective(!OnlyStatement);
|
return ParseOpenMPDeclarativeOrExecutableDirective(Allowed);
|
||||||
|
|
||||||
case tok::annot_pragma_ms_pointers_to_members:
|
case tok::annot_pragma_ms_pointers_to_members:
|
||||||
ProhibitAttributes(Attrs);
|
ProhibitAttributes(Attrs);
|
||||||
|
@ -365,7 +371,7 @@ Retry:
|
||||||
|
|
||||||
case tok::annot_pragma_loop_hint:
|
case tok::annot_pragma_loop_hint:
|
||||||
ProhibitAttributes(Attrs);
|
ProhibitAttributes(Attrs);
|
||||||
return ParsePragmaLoopHint(Stmts, OnlyStatement, TrailingElseLoc, Attrs);
|
return ParsePragmaLoopHint(Stmts, Allowed, TrailingElseLoc, Attrs);
|
||||||
|
|
||||||
case tok::annot_pragma_dump:
|
case tok::annot_pragma_dump:
|
||||||
HandlePragmaDump();
|
HandlePragmaDump();
|
||||||
|
@ -587,7 +593,8 @@ StmtResult Parser::ParseLabeledStatement(ParsedAttributesWithRange &attrs) {
|
||||||
// can't handle GNU attributes), so only call it in the one case where
|
// can't handle GNU attributes), so only call it in the one case where
|
||||||
// GNU attributes are allowed.
|
// GNU attributes are allowed.
|
||||||
SubStmt = ParseStatementOrDeclarationAfterAttributes(
|
SubStmt = ParseStatementOrDeclarationAfterAttributes(
|
||||||
Stmts, /*OnlyStmts*/ true, nullptr, TempAttrs);
|
Stmts, /*Allowed=*/ACK_StatementsOpenMPNonStandalone, nullptr,
|
||||||
|
TempAttrs);
|
||||||
if (!TempAttrs.empty() && !SubStmt.isInvalid())
|
if (!TempAttrs.empty() && !SubStmt.isInvalid())
|
||||||
SubStmt = Actions.ProcessStmtAttributes(
|
SubStmt = Actions.ProcessStmtAttributes(
|
||||||
SubStmt.get(), TempAttrs.getList(), TempAttrs.Range);
|
SubStmt.get(), TempAttrs.getList(), TempAttrs.Range);
|
||||||
|
@ -726,7 +733,8 @@ StmtResult Parser::ParseCaseStatement(bool MissingCase, ExprResult Expr) {
|
||||||
// continue parsing the sub-stmt.
|
// continue parsing the sub-stmt.
|
||||||
if (Case.isInvalid()) {
|
if (Case.isInvalid()) {
|
||||||
if (TopLevelCase.isInvalid()) // No parsed case stmts.
|
if (TopLevelCase.isInvalid()) // No parsed case stmts.
|
||||||
return ParseStatement();
|
return ParseStatement(/*TrailingElseLoc=*/nullptr,
|
||||||
|
/*AllowOpenMPStandalone=*/true);
|
||||||
// Otherwise, just don't add it as a nested case.
|
// Otherwise, just don't add it as a nested case.
|
||||||
} else {
|
} else {
|
||||||
// If this is the first case statement we parsed, it becomes TopLevelCase.
|
// If this is the first case statement we parsed, it becomes TopLevelCase.
|
||||||
|
@ -746,7 +754,8 @@ StmtResult Parser::ParseCaseStatement(bool MissingCase, ExprResult Expr) {
|
||||||
StmtResult SubStmt;
|
StmtResult SubStmt;
|
||||||
|
|
||||||
if (Tok.isNot(tok::r_brace)) {
|
if (Tok.isNot(tok::r_brace)) {
|
||||||
SubStmt = ParseStatement();
|
SubStmt = ParseStatement(/*TrailingElseLoc=*/nullptr,
|
||||||
|
/*AllowOpenMPStandalone=*/true);
|
||||||
} else {
|
} else {
|
||||||
// Nicely diagnose the common error "switch (X) { case 4: }", which is
|
// Nicely diagnose the common error "switch (X) { case 4: }", which is
|
||||||
// not valid. If ColonLoc doesn't point to a valid text location, there was
|
// not valid. If ColonLoc doesn't point to a valid text location, there was
|
||||||
|
@ -798,7 +807,8 @@ StmtResult Parser::ParseDefaultStatement() {
|
||||||
StmtResult SubStmt;
|
StmtResult SubStmt;
|
||||||
|
|
||||||
if (Tok.isNot(tok::r_brace)) {
|
if (Tok.isNot(tok::r_brace)) {
|
||||||
SubStmt = ParseStatement();
|
SubStmt = ParseStatement(/*TrailingElseLoc=*/nullptr,
|
||||||
|
/*AllowOpenMPStandalone=*/true);
|
||||||
} else {
|
} else {
|
||||||
// Diagnose the common error "switch (X) {... default: }", which is
|
// Diagnose the common error "switch (X) {... default: }", which is
|
||||||
// not valid.
|
// not valid.
|
||||||
|
@ -972,7 +982,7 @@ StmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) {
|
||||||
|
|
||||||
StmtResult R;
|
StmtResult R;
|
||||||
if (Tok.isNot(tok::kw___extension__)) {
|
if (Tok.isNot(tok::kw___extension__)) {
|
||||||
R = ParseStatementOrDeclaration(Stmts, false);
|
R = ParseStatementOrDeclaration(Stmts, ACK_Any);
|
||||||
} else {
|
} else {
|
||||||
// __extension__ can start declarations and it can also be a unary
|
// __extension__ can start declarations and it can also be a unary
|
||||||
// operator for expressions. Consume multiple __extension__ markers here
|
// operator for expressions. Consume multiple __extension__ markers here
|
||||||
|
@ -1868,7 +1878,8 @@ StmtResult Parser::ParseReturnStatement() {
|
||||||
return Actions.ActOnReturnStmt(ReturnLoc, R.get(), getCurScope());
|
return Actions.ActOnReturnStmt(ReturnLoc, R.get(), getCurScope());
|
||||||
}
|
}
|
||||||
|
|
||||||
StmtResult Parser::ParsePragmaLoopHint(StmtVector &Stmts, bool OnlyStatement,
|
StmtResult Parser::ParsePragmaLoopHint(StmtVector &Stmts,
|
||||||
|
AllowedContsructsKind Allowed,
|
||||||
SourceLocation *TrailingElseLoc,
|
SourceLocation *TrailingElseLoc,
|
||||||
ParsedAttributesWithRange &Attrs) {
|
ParsedAttributesWithRange &Attrs) {
|
||||||
// Create temporary attribute list.
|
// Create temporary attribute list.
|
||||||
|
@ -1891,7 +1902,7 @@ StmtResult Parser::ParsePragmaLoopHint(StmtVector &Stmts, bool OnlyStatement,
|
||||||
MaybeParseCXX11Attributes(Attrs);
|
MaybeParseCXX11Attributes(Attrs);
|
||||||
|
|
||||||
StmtResult S = ParseStatementOrDeclarationAfterAttributes(
|
StmtResult S = ParseStatementOrDeclarationAfterAttributes(
|
||||||
Stmts, OnlyStatement, TrailingElseLoc, Attrs);
|
Stmts, Allowed, TrailingElseLoc, Attrs);
|
||||||
|
|
||||||
Attrs.takeAllFrom(TempAttrs);
|
Attrs.takeAllFrom(TempAttrs);
|
||||||
return S;
|
return S;
|
||||||
|
@ -2189,7 +2200,7 @@ void Parser::ParseMicrosoftIfExistsStatement(StmtVector &Stmts) {
|
||||||
|
|
||||||
// Condition is true, parse the statements.
|
// Condition is true, parse the statements.
|
||||||
while (Tok.isNot(tok::r_brace)) {
|
while (Tok.isNot(tok::r_brace)) {
|
||||||
StmtResult R = ParseStatementOrDeclaration(Stmts, false);
|
StmtResult R = ParseStatementOrDeclaration(Stmts, ACK_Any);
|
||||||
if (R.isUsable())
|
if (R.isUsable())
|
||||||
Stmts.push_back(R.get());
|
Stmts.push_back(R.get());
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,15 @@ template <class T>
|
||||||
T tmain(T argc) {
|
T tmain(T argc) {
|
||||||
static T a;
|
static T a;
|
||||||
#pragma omp barrier
|
#pragma omp barrier
|
||||||
|
switch (argc) {
|
||||||
|
case 0:
|
||||||
|
#pragma omp barrier
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
#pragma omp barrier
|
||||||
|
#pragma omp barrier
|
||||||
|
break;
|
||||||
|
}
|
||||||
return a + argc;
|
return a + argc;
|
||||||
}
|
}
|
||||||
// CHECK: static int a;
|
// CHECK: static int a;
|
||||||
|
@ -20,12 +29,39 @@ T tmain(T argc) {
|
||||||
// CHECK-NEXT: #pragma omp barrier
|
// CHECK-NEXT: #pragma omp barrier
|
||||||
// CHECK: static T a;
|
// CHECK: static T a;
|
||||||
// CHECK-NEXT: #pragma omp barrier
|
// CHECK-NEXT: #pragma omp barrier
|
||||||
|
// CHECK-NEXT: switch (argc) {
|
||||||
|
// CHECK-NEXT: case 0:
|
||||||
|
// CHECK-NEXT: #pragma omp barrier
|
||||||
|
// CHECK-NEXT: break;
|
||||||
|
// CHECK-NEXT: default:
|
||||||
|
// CHECK-NEXT: #pragma omp barrier
|
||||||
|
// CHECK-NEXT: #pragma omp barrier
|
||||||
|
// CHECK-NEXT: break;
|
||||||
|
// CHECK-NEXT: }
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
static int a;
|
static int a;
|
||||||
// CHECK: static int a;
|
// CHECK: static int a;
|
||||||
#pragma omp barrier
|
#pragma omp barrier
|
||||||
// CHECK-NEXT: #pragma omp barrier
|
// CHECK-NEXT: #pragma omp barrier
|
||||||
|
switch (argc) {
|
||||||
|
case 0:
|
||||||
|
#pragma omp barrier
|
||||||
|
#pragma omp barrier
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
#pragma omp barrier
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// CHECK-NEXT: switch (argc) {
|
||||||
|
// CHECK-NEXT: case 0:
|
||||||
|
// CHECK-NEXT: #pragma omp barrier
|
||||||
|
// CHECK-NEXT: #pragma omp barrier
|
||||||
|
// CHECK-NEXT: break;
|
||||||
|
// CHECK-NEXT: default:
|
||||||
|
// CHECK-NEXT: #pragma omp barrier
|
||||||
|
// CHECK-NEXT: break;
|
||||||
|
// CHECK-NEXT: }
|
||||||
return tmain(argc) + tmain(argv[0][0]) + a;
|
return tmain(argc) + tmain(argv[0][0]) + a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ T tmain(T argc) {
|
||||||
#pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}}
|
#pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}}
|
||||||
switch (argc)
|
switch (argc)
|
||||||
case 1:
|
case 1:
|
||||||
#pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}}
|
#pragma omp barrier
|
||||||
switch (argc)
|
switch (argc)
|
||||||
case 1: {
|
case 1: {
|
||||||
#pragma omp barrier
|
#pragma omp barrier
|
||||||
|
@ -35,7 +35,7 @@ T tmain(T argc) {
|
||||||
switch (argc) {
|
switch (argc) {
|
||||||
#pragma omp barrier
|
#pragma omp barrier
|
||||||
case 1:
|
case 1:
|
||||||
#pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}}
|
#pragma omp barrier
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
#pragma omp barrier
|
#pragma omp barrier
|
||||||
|
@ -81,7 +81,7 @@ int main(int argc, char **argv) {
|
||||||
#pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}}
|
#pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}}
|
||||||
switch (argc)
|
switch (argc)
|
||||||
case 1:
|
case 1:
|
||||||
#pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}}
|
#pragma omp barrier
|
||||||
switch (argc)
|
switch (argc)
|
||||||
case 1: {
|
case 1: {
|
||||||
#pragma omp barrier
|
#pragma omp barrier
|
||||||
|
@ -89,7 +89,7 @@ int main(int argc, char **argv) {
|
||||||
switch (argc) {
|
switch (argc) {
|
||||||
#pragma omp barrier
|
#pragma omp barrier
|
||||||
case 1:
|
case 1:
|
||||||
#pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}}
|
#pragma omp barrier
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
#pragma omp barrier
|
#pragma omp barrier
|
||||||
|
|
|
@ -53,7 +53,7 @@ int main(int argc, char **argv) {
|
||||||
#pragma omp cancel parallel // expected-error {{'#pragma omp cancel' cannot be an immediate substatement}}
|
#pragma omp cancel parallel // expected-error {{'#pragma omp cancel' cannot be an immediate substatement}}
|
||||||
switch (argc)
|
switch (argc)
|
||||||
case 1:
|
case 1:
|
||||||
#pragma omp cancel sections // expected-error {{'#pragma omp cancel' cannot be an immediate substatement}}
|
#pragma omp cancel sections
|
||||||
switch (argc)
|
switch (argc)
|
||||||
case 1: {
|
case 1: {
|
||||||
#pragma omp cancel for
|
#pragma omp cancel for
|
||||||
|
@ -61,7 +61,7 @@ int main(int argc, char **argv) {
|
||||||
switch (argc) {
|
switch (argc) {
|
||||||
#pragma omp cancel taskgroup
|
#pragma omp cancel taskgroup
|
||||||
case 1:
|
case 1:
|
||||||
#pragma omp cancel parallel // expected-error {{'#pragma omp cancel' cannot be an immediate substatement}}
|
#pragma omp cancel parallel
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
#pragma omp cancel sections
|
#pragma omp cancel sections
|
||||||
|
|
|
@ -53,7 +53,7 @@ int main(int argc, char **argv) {
|
||||||
#pragma omp cancellation point parallel // expected-error {{'#pragma omp cancellation point' cannot be an immediate substatement}}
|
#pragma omp cancellation point parallel // expected-error {{'#pragma omp cancellation point' cannot be an immediate substatement}}
|
||||||
switch (argc)
|
switch (argc)
|
||||||
case 1:
|
case 1:
|
||||||
#pragma omp cancellation point sections // expected-error {{'#pragma omp cancellation point' cannot be an immediate substatement}}
|
#pragma omp cancellation point sections
|
||||||
switch (argc)
|
switch (argc)
|
||||||
case 1: {
|
case 1: {
|
||||||
#pragma omp cancellation point for
|
#pragma omp cancellation point for
|
||||||
|
@ -61,7 +61,7 @@ int main(int argc, char **argv) {
|
||||||
switch (argc) {
|
switch (argc) {
|
||||||
#pragma omp cancellation point taskgroup
|
#pragma omp cancellation point taskgroup
|
||||||
case 1:
|
case 1:
|
||||||
#pragma omp cancellation point parallel // expected-error {{'#pragma omp cancellation point' cannot be an immediate substatement}}
|
#pragma omp cancellation point parallel
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
#pragma omp cancellation point sections
|
#pragma omp cancellation point sections
|
||||||
|
|
|
@ -31,7 +31,7 @@ T tmain(T argc) {
|
||||||
#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
|
#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
|
||||||
switch (argc)
|
switch (argc)
|
||||||
case 1:
|
case 1:
|
||||||
#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
|
#pragma omp flush
|
||||||
switch (argc)
|
switch (argc)
|
||||||
case 1: {
|
case 1: {
|
||||||
#pragma omp flush
|
#pragma omp flush
|
||||||
|
@ -39,7 +39,7 @@ T tmain(T argc) {
|
||||||
switch (argc) {
|
switch (argc) {
|
||||||
#pragma omp flush
|
#pragma omp flush
|
||||||
case 1:
|
case 1:
|
||||||
#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
|
#pragma omp flush
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
#pragma omp flush
|
#pragma omp flush
|
||||||
|
@ -95,7 +95,7 @@ int main(int argc, char **argv) {
|
||||||
#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
|
#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
|
||||||
switch (argc)
|
switch (argc)
|
||||||
case 1:
|
case 1:
|
||||||
#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
|
#pragma omp flush
|
||||||
switch (argc)
|
switch (argc)
|
||||||
case 1: {
|
case 1: {
|
||||||
#pragma omp flush
|
#pragma omp flush
|
||||||
|
@ -103,7 +103,7 @@ int main(int argc, char **argv) {
|
||||||
switch (argc) {
|
switch (argc) {
|
||||||
#pragma omp flush
|
#pragma omp flush
|
||||||
case 1:
|
case 1:
|
||||||
#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
|
#pragma omp flush
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
#pragma omp flush
|
#pragma omp flush
|
||||||
|
|
|
@ -27,7 +27,7 @@ T tmain(T argc) {
|
||||||
#pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}}
|
#pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}}
|
||||||
switch (argc)
|
switch (argc)
|
||||||
case 1:
|
case 1:
|
||||||
#pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}}
|
#pragma omp taskwait
|
||||||
switch (argc)
|
switch (argc)
|
||||||
case 1: {
|
case 1: {
|
||||||
#pragma omp taskwait
|
#pragma omp taskwait
|
||||||
|
@ -35,7 +35,7 @@ T tmain(T argc) {
|
||||||
switch (argc) {
|
switch (argc) {
|
||||||
#pragma omp taskwait
|
#pragma omp taskwait
|
||||||
case 1:
|
case 1:
|
||||||
#pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}}
|
#pragma omp taskwait
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
#pragma omp taskwait
|
#pragma omp taskwait
|
||||||
|
@ -81,7 +81,7 @@ int main(int argc, char **argv) {
|
||||||
#pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}}
|
#pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}}
|
||||||
switch (argc)
|
switch (argc)
|
||||||
case 1:
|
case 1:
|
||||||
#pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}}
|
#pragma omp taskwait
|
||||||
switch (argc)
|
switch (argc)
|
||||||
case 1: {
|
case 1: {
|
||||||
#pragma omp taskwait
|
#pragma omp taskwait
|
||||||
|
@ -89,7 +89,7 @@ int main(int argc, char **argv) {
|
||||||
switch (argc) {
|
switch (argc) {
|
||||||
#pragma omp taskwait
|
#pragma omp taskwait
|
||||||
case 1:
|
case 1:
|
||||||
#pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}}
|
#pragma omp taskwait
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
#pragma omp taskwait
|
#pragma omp taskwait
|
||||||
|
|
|
@ -27,7 +27,7 @@ T tmain(T argc) {
|
||||||
#pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
|
#pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
|
||||||
switch (argc)
|
switch (argc)
|
||||||
case 1:
|
case 1:
|
||||||
#pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
|
#pragma omp taskyield
|
||||||
switch (argc)
|
switch (argc)
|
||||||
case 1: {
|
case 1: {
|
||||||
#pragma omp taskyield
|
#pragma omp taskyield
|
||||||
|
@ -35,7 +35,7 @@ T tmain(T argc) {
|
||||||
switch (argc) {
|
switch (argc) {
|
||||||
#pragma omp taskyield
|
#pragma omp taskyield
|
||||||
case 1:
|
case 1:
|
||||||
#pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
|
#pragma omp taskyield
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
#pragma omp taskyield
|
#pragma omp taskyield
|
||||||
|
@ -81,7 +81,7 @@ int main(int argc, char **argv) {
|
||||||
#pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
|
#pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
|
||||||
switch (argc)
|
switch (argc)
|
||||||
case 1:
|
case 1:
|
||||||
#pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
|
#pragma omp taskyield
|
||||||
switch (argc)
|
switch (argc)
|
||||||
case 1: {
|
case 1: {
|
||||||
#pragma omp taskyield
|
#pragma omp taskyield
|
||||||
|
@ -89,7 +89,7 @@ int main(int argc, char **argv) {
|
||||||
switch (argc) {
|
switch (argc) {
|
||||||
#pragma omp taskyield
|
#pragma omp taskyield
|
||||||
case 1:
|
case 1:
|
||||||
#pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
|
#pragma omp taskyield
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
#pragma omp taskyield
|
#pragma omp taskyield
|
||||||
|
|
|
@ -118,6 +118,7 @@ int main(int argc, char **argv) { // expected-note {{'argc' defined here}}
|
||||||
static double d1;
|
static double d1;
|
||||||
static double d2;
|
static double d2;
|
||||||
static double d3; // expected-note {{'d3' defined here}}
|
static double d3; // expected-note {{'d3' defined here}}
|
||||||
|
static double d4;
|
||||||
static TestClass LocalClass(y); // expected-error {{variable with local storage in initial value of threadprivate variable}}
|
static TestClass LocalClass(y); // expected-error {{variable with local storage in initial value of threadprivate variable}}
|
||||||
#pragma omp threadprivate(LocalClass)
|
#pragma omp threadprivate(LocalClass)
|
||||||
|
|
||||||
|
@ -133,6 +134,8 @@ int main(int argc, char **argv) { // expected-note {{'argc' defined here}}
|
||||||
#pragma omp threadprivate(d3) // expected-error {{'#pragma omp threadprivate' must appear in the scope of the 'd3' variable declaration}}
|
#pragma omp threadprivate(d3) // expected-error {{'#pragma omp threadprivate' must appear in the scope of the 'd3' variable declaration}}
|
||||||
}
|
}
|
||||||
#pragma omp threadprivate(d3)
|
#pragma omp threadprivate(d3)
|
||||||
|
label:
|
||||||
|
#pragma omp threadprivate(d4) // expected-error {{'#pragma omp threadprivate' cannot be an immediate substatement}}
|
||||||
|
|
||||||
#pragma omp threadprivate(a) // expected-error {{'#pragma omp threadprivate' must appear in the scope of the 'a' variable declaration}}
|
#pragma omp threadprivate(a) // expected-error {{'#pragma omp threadprivate' must appear in the scope of the 'a' variable declaration}}
|
||||||
return (y);
|
return (y);
|
||||||
|
|
Loading…
Reference in New Issue