diff options
author | Weaver <Tom.Weaver@sony.com> | 2024-05-08 11:12:14 +0100 |
---|---|---|
committer | Weaver <Tom.Weaver@sony.com> | 2024-05-08 11:12:14 +0100 |
commit | 341aecc2dd0f6debcbe9f251a6d2e8a60d327eea (patch) | |
tree | 95d4bde3da215b6fc3601e4ca2295bbe9b942022 /clang/lib/Parse/ParseOpenMP.cpp | |
parent | aefad851672e6dd17592895066a39aa5b388e5db (diff) | |
download | llvm-341aecc2dd0f6debcbe9f251a6d2e8a60d327eea.zip llvm-341aecc2dd0f6debcbe9f251a6d2e8a60d327eea.tar.gz llvm-341aecc2dd0f6debcbe9f251a6d2e8a60d327eea.tar.bz2 |
Revert "Revert "Revert "[OpenMP][TR12] change property of map-type modifier."… (#91141)"
This reverts commit a99ce615f19fec6fbb835490b89f53cba3cf9eff.
Caused test failure on following buildbot:
https://lab.llvm.org/buildbot/#/builders/139/builds/65066
Diffstat (limited to 'clang/lib/Parse/ParseOpenMP.cpp')
-rw-r--r-- | clang/lib/Parse/ParseOpenMP.cpp | 51 |
1 files changed, 8 insertions, 43 deletions
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp index 5265d8f..18ba1185 100644 --- a/clang/lib/Parse/ParseOpenMP.cpp +++ b/clang/lib/Parse/ParseOpenMP.cpp @@ -4228,20 +4228,13 @@ bool Parser::parseMapperModifier(SemaOpenMP::OpenMPVarListDataTy &Data) { return T.consumeClose(); } -static OpenMPMapClauseKind isMapType(Parser &P); - /// Parse map-type-modifiers in map clause. -/// map([ [map-type-modifier[,] [map-type-modifier[,] ...] [map-type] : ] list) +/// map([ [map-type-modifier[,] [map-type-modifier[,] ...] map-type : ] list) /// where, map-type-modifier ::= always | close | mapper(mapper-identifier) | /// present -/// where, map-type ::= alloc | delete | from | release | to | tofrom bool Parser::parseMapTypeModifiers(SemaOpenMP::OpenMPVarListDataTy &Data) { - bool HasMapType = false; - SourceLocation PreMapLoc = Tok.getLocation(); - StringRef PreMapName = ""; while (getCurToken().isNot(tok::colon)) { OpenMPMapModifierKind TypeModifier = isMapModifier(*this); - OpenMPMapClauseKind MapKind = isMapType(*this); if (TypeModifier == OMPC_MAP_MODIFIER_always || TypeModifier == OMPC_MAP_MODIFIER_close || TypeModifier == OMPC_MAP_MODIFIER_present || @@ -4264,19 +4257,6 @@ bool Parser::parseMapTypeModifiers(SemaOpenMP::OpenMPVarListDataTy &Data) { Diag(Data.MapTypeModifiersLoc.back(), diag::err_omp_missing_comma) << "map type modifier"; - } else if (getLangOpts().OpenMP >= 60 && MapKind != OMPC_MAP_unknown) { - if (!HasMapType) { - HasMapType = true; - Data.ExtraModifier = MapKind; - MapKind = OMPC_MAP_unknown; - PreMapLoc = Tok.getLocation(); - PreMapName = Tok.getIdentifierInfo()->getName(); - } else { - Diag(Tok, diag::err_omp_more_one_map_type); - Diag(PreMapLoc, diag::note_previous_map_type_specified_here) - << PreMapName; - } - ConsumeToken(); } else { // For the case of unknown map-type-modifier or a map-type. // Map-type is followed by a colon; the function returns when it @@ -4287,14 +4267,8 @@ bool Parser::parseMapTypeModifiers(SemaOpenMP::OpenMPVarListDataTy &Data) { continue; } // Potential map-type token as it is followed by a colon. - if (PP.LookAhead(0).is(tok::colon)) { - if (getLangOpts().OpenMP >= 60) { - break; - } else { - return false; - } - } - + if (PP.LookAhead(0).is(tok::colon)) + return false; Diag(Tok, diag::err_omp_unknown_map_type_modifier) << (getLangOpts().OpenMP >= 51 ? (getLangOpts().OpenMP >= 52 ? 2 : 1) : 0) @@ -4304,14 +4278,6 @@ bool Parser::parseMapTypeModifiers(SemaOpenMP::OpenMPVarListDataTy &Data) { if (getCurToken().is(tok::comma)) ConsumeToken(); } - if (getLangOpts().OpenMP >= 60 && !HasMapType) { - if (!Tok.is(tok::colon)) { - Diag(Tok, diag::err_omp_unknown_map_type); - ConsumeToken(); - } else { - Data.ExtraModifier = OMPC_MAP_unknown; - } - } return false; } @@ -4323,12 +4289,13 @@ static OpenMPMapClauseKind isMapType(Parser &P) { if (!Tok.isOneOf(tok::identifier, tok::kw_delete)) return OMPC_MAP_unknown; Preprocessor &PP = P.getPreprocessor(); - unsigned MapType = - getOpenMPSimpleClauseType(OMPC_map, PP.getSpelling(Tok), P.getLangOpts()); + OpenMPMapClauseKind MapType = + static_cast<OpenMPMapClauseKind>(getOpenMPSimpleClauseType( + OMPC_map, PP.getSpelling(Tok), P.getLangOpts())); if (MapType == OMPC_MAP_to || MapType == OMPC_MAP_from || MapType == OMPC_MAP_tofrom || MapType == OMPC_MAP_alloc || MapType == OMPC_MAP_delete || MapType == OMPC_MAP_release) - return static_cast<OpenMPMapClauseKind>(MapType); + return MapType; return OMPC_MAP_unknown; } @@ -4712,10 +4679,8 @@ bool Parser::ParseOpenMPVarList(OpenMPDirectiveKind DKind, // Only parse map-type-modifier[s] and map-type if a colon is present in // the map clause. if (ColonPresent) { - if (getLangOpts().OpenMP >= 60 && getCurToken().is(tok::colon)) - Diag(Tok, diag::err_omp_map_modifier_specification_list); IsInvalidMapperModifier = parseMapTypeModifiers(Data); - if (getLangOpts().OpenMP < 60 && !IsInvalidMapperModifier) + if (!IsInvalidMapperModifier) parseMapType(*this, Data); else SkipUntil(tok::colon, tok::annot_pragma_openmp_end, StopBeforeMatch); |