Skip to content

Commit eea81aa

Browse files
authored
Revert "[OpenMP][TR12] change property of map-type modifier." (llvm#90885)
Breaks https://lab.llvm.org/buildbot/#/builders/5/builds/43086/steps/9/logs/stdio Reverts llvm#90499
1 parent 0e5ff62 commit eea81aa

File tree

4 files changed

+50
-162
lines changed

4 files changed

+50
-162
lines changed

clang/include/clang/Basic/DiagnosticParseKinds.td

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,18 +1438,13 @@ def err_omp_decl_in_declare_simd_variant : Error<
14381438
def err_omp_sink_and_source_iteration_not_allowd: Error<" '%0 %select{sink:|source:}1' must be with '%select{omp_cur_iteration - 1|omp_cur_iteration}1'">;
14391439
def err_omp_unknown_map_type : Error<
14401440
"incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'">;
1441-
def err_omp_more_one_map_type : Error<"map type is already specified">;
1442-
def note_previous_map_type_specified_here
1443-
: Note<"map type '%0' is previous specified here">;
14441441
def err_omp_unknown_map_type_modifier : Error<
14451442
"incorrect map type modifier, expected one of: 'always', 'close', 'mapper'"
14461443
"%select{|, 'present'|, 'present', 'iterator'}0%select{|, 'ompx_hold'}1">;
14471444
def err_omp_map_type_missing : Error<
14481445
"missing map type">;
14491446
def err_omp_map_type_modifier_missing : Error<
14501447
"missing map type modifier">;
1451-
def err_omp_map_modifier_specification_list : Error<
1452-
"empty modifier-specification-list is not allowed">;
14531448
def err_omp_declare_simd_inbranch_notinbranch : Error<
14541449
"unexpected '%0' clause, '%1' is specified already">;
14551450
def err_omp_expected_clause_argument

clang/lib/Parse/ParseOpenMP.cpp

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4228,20 +4228,13 @@ bool Parser::parseMapperModifier(SemaOpenMP::OpenMPVarListDataTy &Data) {
42284228
return T.consumeClose();
42294229
}
42304230

4231-
static OpenMPMapClauseKind isMapType(Parser &P);
4232-
42334231
/// Parse map-type-modifiers in map clause.
4234-
/// map([ [map-type-modifier[,] [map-type-modifier[,] ...] [map-type] : ] list)
4232+
/// map([ [map-type-modifier[,] [map-type-modifier[,] ...] map-type : ] list)
42354233
/// where, map-type-modifier ::= always | close | mapper(mapper-identifier) |
42364234
/// present
4237-
/// where, map-type ::= alloc | delete | from | release | to | tofrom
42384235
bool Parser::parseMapTypeModifiers(SemaOpenMP::OpenMPVarListDataTy &Data) {
4239-
bool HasMapType = false;
4240-
SourceLocation PreMapLoc = Tok.getLocation();
4241-
StringRef PreMapName = "";
42424236
while (getCurToken().isNot(tok::colon)) {
42434237
OpenMPMapModifierKind TypeModifier = isMapModifier(*this);
4244-
OpenMPMapClauseKind MapKind = isMapType(*this);
42454238
if (TypeModifier == OMPC_MAP_MODIFIER_always ||
42464239
TypeModifier == OMPC_MAP_MODIFIER_close ||
42474240
TypeModifier == OMPC_MAP_MODIFIER_present ||
@@ -4264,19 +4257,6 @@ bool Parser::parseMapTypeModifiers(SemaOpenMP::OpenMPVarListDataTy &Data) {
42644257
Diag(Data.MapTypeModifiersLoc.back(), diag::err_omp_missing_comma)
42654258
<< "map type modifier";
42664259

4267-
} else if (getLangOpts().OpenMP >= 60 && MapKind != OMPC_MAP_unknown) {
4268-
if (!HasMapType) {
4269-
HasMapType = true;
4270-
Data.ExtraModifier = MapKind;
4271-
MapKind = OMPC_MAP_unknown;
4272-
PreMapLoc = Tok.getLocation();
4273-
PreMapName = Tok.getIdentifierInfo()->getName();
4274-
} else {
4275-
Diag(Tok, diag::err_omp_more_one_map_type);
4276-
Diag(PreMapLoc, diag::note_previous_map_type_specified_here)
4277-
<< PreMapName;
4278-
}
4279-
ConsumeToken();
42804260
} else {
42814261
// For the case of unknown map-type-modifier or a map-type.
42824262
// Map-type is followed by a colon; the function returns when it
@@ -4287,14 +4267,8 @@ bool Parser::parseMapTypeModifiers(SemaOpenMP::OpenMPVarListDataTy &Data) {
42874267
continue;
42884268
}
42894269
// Potential map-type token as it is followed by a colon.
4290-
if (PP.LookAhead(0).is(tok::colon)) {
4291-
if (getLangOpts().OpenMP >= 60) {
4292-
break;
4293-
} else {
4294-
return false;
4295-
}
4296-
}
4297-
4270+
if (PP.LookAhead(0).is(tok::colon))
4271+
return false;
42984272
Diag(Tok, diag::err_omp_unknown_map_type_modifier)
42994273
<< (getLangOpts().OpenMP >= 51 ? (getLangOpts().OpenMP >= 52 ? 2 : 1)
43004274
: 0)
@@ -4304,14 +4278,6 @@ bool Parser::parseMapTypeModifiers(SemaOpenMP::OpenMPVarListDataTy &Data) {
43044278
if (getCurToken().is(tok::comma))
43054279
ConsumeToken();
43064280
}
4307-
if (getLangOpts().OpenMP >= 60 && !HasMapType) {
4308-
if (!Tok.is(tok::colon)) {
4309-
Diag(Tok, diag::err_omp_unknown_map_type);
4310-
ConsumeToken();
4311-
} else {
4312-
Data.ExtraModifier = OMPC_MAP_unknown;
4313-
}
4314-
}
43154281
return false;
43164282
}
43174283

@@ -4709,10 +4675,8 @@ bool Parser::ParseOpenMPVarList(OpenMPDirectiveKind DKind,
47094675
// Only parse map-type-modifier[s] and map-type if a colon is present in
47104676
// the map clause.
47114677
if (ColonPresent) {
4712-
if (getLangOpts().OpenMP >= 60 && getCurToken().is(tok::colon))
4713-
Diag(Tok, diag::err_omp_map_modifier_specification_list);
47144678
IsInvalidMapperModifier = parseMapTypeModifiers(Data);
4715-
if (getLangOpts().OpenMP < 60 && !IsInvalidMapperModifier)
4679+
if (!IsInvalidMapperModifier)
47164680
parseMapType(*this, Data);
47174681
else
47184682
SkipUntil(tok::colon, tok::annot_pragma_openmp_end, StopBeforeMatch);

clang/test/OpenMP/target_ast_print.cpp

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,64 +1201,6 @@ foo();
12011201
}
12021202
#endif // OMP52
12031203

1204-
#ifdef OMP60
1205-
1206-
///==========================================================================///
1207-
// RUN: %clang_cc1 -DOMP60 -verify -Wno-vla -fopenmp -fopenmp-version=60 -ast-print %s | FileCheck %s --check-prefix OMP60
1208-
// RUN: %clang_cc1 -DOMP60 -fopenmp -fopenmp-version=60 -x c++ -std=c++11 -emit-pch -o %t %s
1209-
// RUN: %clang_cc1 -DOMP60 -fopenmp -fopenmp-version=60 -std=c++11 -include-pch %t -fsyntax-only -verify -Wno-vla %s -ast-print | FileCheck %s --check-prefix OMP60
1210-
1211-
// RUN: %clang_cc1 -DOMP60 -verify -Wno-vla -fopenmp-simd -fopenmp-version=60 -ast-print %s | FileCheck %s --check-prefix OMP60
1212-
// RUN: %clang_cc1 -DOMP60 -fopenmp-simd -fopenmp-version=60 -x c++ -std=c++11 -emit-pch -o %t %s
1213-
// RUN: %clang_cc1 -DOMP60 -fopenmp-simd -fopenmp-version=60 -std=c++11 -include-pch %t -fsyntax-only -verify -Wno-vla %s -ast-print | FileCheck %s --check-prefix OMP60
1214-
1215-
void foo() {}
1216-
template <typename T, int C>
1217-
T tmain(T argc, T *argv) {
1218-
T i;
1219-
#pragma omp target map(from always: i)
1220-
foo();
1221-
#pragma omp target map(from, close: i)
1222-
foo();
1223-
#pragma omp target map(always,close: i)
1224-
foo();
1225-
return 0;
1226-
}
1227-
//OMP60: template <typename T, int C> T tmain(T argc, T *argv) {
1228-
//OMP60-NEXT: T i;
1229-
//OMP60-NEXT: #pragma omp target map(always,from: i)
1230-
//OMP60-NEXT: foo();
1231-
//OMP60-NEXT: #pragma omp target map(close,from: i)
1232-
//OMP60-NEXT: foo();
1233-
//OMP60-NEXT: #pragma omp target map(always,close,tofrom: i)
1234-
//OMP60-NEXT: foo();
1235-
//OMP60-NEXT: return 0;
1236-
//OMP60-NEXT:}
1237-
//OMP60: template<> int tmain<int, 5>(int argc, int *argv) {
1238-
//OMP60-NEXT: int i;
1239-
//OMP60-NEXT: #pragma omp target map(always,from: i)
1240-
//OMP60-NEXT: foo();
1241-
//OMP60-NEXT: #pragma omp target map(close,from: i)
1242-
//OMP60-NEXT: foo();
1243-
//OMP60-NEXT: #pragma omp target map(always,close,tofrom: i)
1244-
//OMP60-NEXT: foo();
1245-
//OMP60-NEXT: return 0;
1246-
//OMP60-NEXT:}
1247-
//OMP60: template<> char tmain<char, 1>(char argc, char *argv) {
1248-
//OMP60-NEXT: char i;
1249-
//OMP60-NEXT: #pragma omp target map(always,from: i)
1250-
//OMP60-NEXT: foo();
1251-
//OMP60-NEXT: #pragma omp target map(close,from: i)
1252-
//OMP60-NEXT: foo();
1253-
//OMP60-NEXT: #pragma omp target map(always,close,tofrom: i)
1254-
//OMP60-NEXT: foo();
1255-
//OMP60-NEXT: return 0;
1256-
//OMP60-NEXT:}
1257-
int main (int argc, char **argv) {
1258-
return tmain<int, 5>(argc, &argc) + tmain<char, 1>(argv[0][0], argv[0]);
1259-
}
1260-
#endif // OMP60
1261-
12621204
#ifdef OMPX
12631205

12641206
// RUN: %clang_cc1 -DOMPX -verify -Wno-vla -fopenmp -fopenmp-extensions -ast-print %s | FileCheck %s --check-prefix=OMPX

0 commit comments

Comments
 (0)