diff --git a/clang/include/clang/Basic/OpenACCKinds.h b/clang/include/clang/Basic/OpenACCKinds.h index 8f85ffed7842..87da3fc108ce 100644 --- a/clang/include/clang/Basic/OpenACCKinds.h +++ b/clang/include/clang/Basic/OpenACCKinds.h @@ -208,6 +208,12 @@ enum class OpenACCClauseKind { /// 'copyout' clause, allowed on Compute and Combined constructs, plus 'data', /// 'exit data', and 'declare'. CopyOut, + /// 'copyin' clause, allowed on Compute and Combined constructs, plus 'data', + /// 'enter data', and 'declare'. + CopyIn, + /// 'copyin' clause, allowed on Compute and Combined constructs, plus 'data', + /// 'enter data', and 'declare'. + Create, /// Represents an invalid clause, for the purposes of parsing. Invalid, @@ -294,6 +300,12 @@ inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &Out, case OpenACCClauseKind::CopyOut: return Out << "copyout"; + case OpenACCClauseKind::CopyIn: + return Out << "copyin"; + + case OpenACCClauseKind::Create: + return Out << "create"; + case OpenACCClauseKind::Invalid: return Out << ""; } diff --git a/clang/lib/Parse/ParseOpenACC.cpp b/clang/lib/Parse/ParseOpenACC.cpp index cdc7cf24b663..d34cc5f799c9 100644 --- a/clang/lib/Parse/ParseOpenACC.cpp +++ b/clang/lib/Parse/ParseOpenACC.cpp @@ -91,7 +91,9 @@ OpenACCClauseKind getOpenACCClauseKind(Token Tok) { Tok.getIdentifierInfo()->getName()) .Case("attach", OpenACCClauseKind::Attach) .Case("auto", OpenACCClauseKind::Auto) + .Case("create", OpenACCClauseKind::Create) .Case("copy", OpenACCClauseKind::Copy) + .Case("copyin", OpenACCClauseKind::CopyIn) .Case("copyout", OpenACCClauseKind::CopyOut) .Case("default", OpenACCClauseKind::Default) .Case("delete", OpenACCClauseKind::Delete) @@ -398,7 +400,9 @@ ClauseParensKind getClauseParensKind(OpenACCClauseKind Kind) { case OpenACCClauseKind::Default: case OpenACCClauseKind::If: + case OpenACCClauseKind::Create: case OpenACCClauseKind::Copy: + case OpenACCClauseKind::CopyIn: case OpenACCClauseKind::CopyOut: case OpenACCClauseKind::UseDevice: case OpenACCClauseKind::NoCreate: @@ -559,6 +563,13 @@ bool Parser::ParseOpenACCClauseParams(OpenACCClauseKind Kind) { return true; break; } + case OpenACCClauseKind::CopyIn: + tryParseAndConsumeSpecialTokenKind( + *this, OpenACCSpecialTokenKind::ReadOnly, Kind); + if (ParseOpenACCClauseVarList(Kind)) + return true; + break; + case OpenACCClauseKind::Create: case OpenACCClauseKind::CopyOut: tryParseAndConsumeSpecialTokenKind(*this, OpenACCSpecialTokenKind::Zero, Kind); diff --git a/clang/test/ParserOpenACC/parse-clauses.c b/clang/test/ParserOpenACC/parse-clauses.c index bbabbf6b082f..5cbcf5410845 100644 --- a/clang/test/ParserOpenACC/parse-clauses.c +++ b/clang/test/ParserOpenACC/parse-clauses.c @@ -529,6 +529,72 @@ void VarListClauses() { // expected-error@+2{{use of undeclared identifier 'invalid'}} // expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}} #pragma acc serial copyout(invalid s.array[s.value : 5], s.value), seq + + // expected-error@+2{{expected ','}} + // expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}} +#pragma acc serial create(s.array[s.value] s.array[s.value :5] ), seq + + // expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}} +#pragma acc serial create(s.array[s.value : 5], s.value), seq + + // expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}} +#pragma acc serial create(zero:s.array[s.value : 5], s.value), seq + + // expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}} +#pragma acc serial create(zero : s.array[s.value : 5], s.value), seq + + // expected-error@+2{{use of undeclared identifier 'zero'}} + // expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}} +#pragma acc serial create(zero s.array[s.value : 5], s.value), seq + + // expected-error@+2{{invalid tag 'readonly' on 'create' clause}} + // expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}} +#pragma acc serial create(readonly:s.array[s.value : 5], s.value), seq + + // expected-error@+2{{invalid tag 'invalid' on 'create' clause}} + // expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}} +#pragma acc serial create(invalid:s.array[s.value : 5], s.value), seq + + // expected-error@+2{{invalid tag 'invalid' on 'create' clause}} + // expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}} +#pragma acc serial create(invalid:s.array[s.value : 5], s.value), seq + + // expected-error@+2{{use of undeclared identifier 'invalid'}} + // expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}} +#pragma acc serial create(invalid s.array[s.value : 5], s.value), seq + + // expected-error@+2{{expected ','}} + // expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}} +#pragma acc serial copyin(s.array[s.value] s.array[s.value :5] ), seq + + // expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}} +#pragma acc serial copyin(s.array[s.value : 5], s.value), seq + + // expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}} +#pragma acc serial copyin(readonly:s.array[s.value : 5], s.value), seq + + // expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}} +#pragma acc serial copyin(readonly : s.array[s.value : 5], s.value), seq + + // expected-error@+2{{use of undeclared identifier 'readonly'}} + // expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}} +#pragma acc serial copyin(readonly s.array[s.value : 5], s.value), seq + + // expected-error@+2{{invalid tag 'zero' on 'copyin' clause}} + // expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}} +#pragma acc serial copyin(zero :s.array[s.value : 5], s.value), seq + + // expected-error@+2{{invalid tag 'invalid' on 'copyin' clause}} + // expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}} +#pragma acc serial copyin(invalid:s.array[s.value : 5], s.value), seq + + // expected-error@+2{{invalid tag 'invalid' on 'copyin' clause}} + // expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}} +#pragma acc serial copyin(invalid:s.array[s.value : 5], s.value), seq + + // expected-error@+2{{use of undeclared identifier 'invalid'}} + // expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}} +#pragma acc serial copyin(invalid s.array[s.value : 5], s.value), seq } // expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}}