aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Parse/ParseOpenMP.cpp
diff options
context:
space:
mode:
authorjyu2-git <jennifer.yu@intel.com>2024-05-02 20:54:20 -0700
committerGitHub <noreply@github.com>2024-05-02 20:54:20 -0700
commitb62c45cfe514237f71a7f461ba283dd13a92bfe0 (patch)
treea5a5f662cde2f66786f05fab7e2bce83e759308a /clang/lib/Parse/ParseOpenMP.cpp
parentd2af1ea81dd0170133c53ebd67c9a9be125dfd31 (diff)
downloadllvm-b62c45cfe514237f71a7f461ba283dd13a92bfe0.zip
llvm-b62c45cfe514237f71a7f461ba283dd13a92bfe0.tar.gz
llvm-b62c45cfe514237f71a7f461ba283dd13a92bfe0.tar.bz2
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.
Diffstat (limited to 'clang/lib/Parse/ParseOpenMP.cpp')
-rw-r--r--clang/lib/Parse/ParseOpenMP.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index 480201b..18ba1185 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -4282,7 +4282,7 @@ bool Parser::parseMapTypeModifiers(SemaOpenMP::OpenMPVarListDataTy &Data) {
}
/// Checks if the token is a valid map-type.
-/// FIXME: It will return an OpenMPMapModifierKind if that's what it parses.
+/// If it is not MapType kind, OMPC_MAP_unknown is returned.
static OpenMPMapClauseKind isMapType(Parser &P) {
Token Tok = P.getCurToken();
// The map-type token can be either an identifier or the C++ delete keyword.
@@ -4292,7 +4292,11 @@ static OpenMPMapClauseKind isMapType(Parser &P) {
OpenMPMapClauseKind MapType =
static_cast<OpenMPMapClauseKind>(getOpenMPSimpleClauseType(
OMPC_map, PP.getSpelling(Tok), P.getLangOpts()));
- return MapType;
+ 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 MapType;
+ return OMPC_MAP_unknown;
}
/// Parse map-type in map clause.