Skip to content

Commit b62c45c

Browse files
authored
Fix sanitize problem. (#90800)
Currently isMapType could return OpenMPMapModifierKind. The change is to return OpenMPMapTypeKind only, if it is not MapType Kind OMPC_MAP_unknown is returned.
1 parent d2af1ea commit b62c45c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

clang/lib/Parse/ParseOpenMP.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4282,7 +4282,7 @@ bool Parser::parseMapTypeModifiers(SemaOpenMP::OpenMPVarListDataTy &Data) {
42824282
}
42834283

42844284
/// Checks if the token is a valid map-type.
4285-
/// FIXME: It will return an OpenMPMapModifierKind if that's what it parses.
4285+
/// If it is not MapType kind, OMPC_MAP_unknown is returned.
42864286
static OpenMPMapClauseKind isMapType(Parser &P) {
42874287
Token Tok = P.getCurToken();
42884288
// The map-type token can be either an identifier or the C++ delete keyword.
@@ -4292,7 +4292,11 @@ static OpenMPMapClauseKind isMapType(Parser &P) {
42924292
OpenMPMapClauseKind MapType =
42934293
static_cast<OpenMPMapClauseKind>(getOpenMPSimpleClauseType(
42944294
OMPC_map, PP.getSpelling(Tok), P.getLangOpts()));
4295-
return MapType;
4295+
if (MapType == OMPC_MAP_to || MapType == OMPC_MAP_from ||
4296+
MapType == OMPC_MAP_tofrom || MapType == OMPC_MAP_alloc ||
4297+
MapType == OMPC_MAP_delete || MapType == OMPC_MAP_release)
4298+
return MapType;
4299+
return OMPC_MAP_unknown;
42964300
}
42974301

42984302
/// Parse map-type in map clause.

0 commit comments

Comments
 (0)