Skip to content

Conversation

@jyu2-git
Copy link
Contributor

@jyu2-git jyu2-git commented May 1, 2024

Currently isMapType could return OpenMPMapModifierKind.

The change is to return OpenMPMapTypeKind only, if it is not MapType Kind OMPC_MAP_unknown is returned.

Currently isMapType could return OpenMPMapModifierKind.

The change is to return OpenMPMapTypeKind only, if it is not MapType
Kind OMPC_MAP_unknown is returned.
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:openmp OpenMP related changes to Clang labels May 1, 2024
@llvmbot
Copy link
Member

llvmbot commented May 1, 2024

@llvm/pr-subscribers-clang

Author: None (jyu2-git)

Changes

Currently isMapType could return OpenMPMapModifierKind.

The change is to return OpenMPMapTypeKind only, if it is not MapType Kind OMPC_MAP_unknown is returned.


Full diff: https://github.com/llvm/llvm-project/pull/90800.diff

1 Files Affected:

  • (modified) clang/lib/Parse/ParseOpenMP.cpp (+6-2)
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index 53d89ce2fa3e99..b1cff11af590a5 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -4316,7 +4316,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.
@@ -4326,7 +4326,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.

@jyu2-git jyu2-git requested a review from alexey-bataev May 2, 2024 00:22
@jyu2-git jyu2-git assigned jyu2-git and unassigned alexey-bataev May 2, 2024
@alexey-bataev
Copy link
Member

A test?

@jyu2-git
Copy link
Contributor Author

jyu2-git commented May 2, 2024

A test?

I don't really know how to test this, as I don't know how to reproduce the problem. Any suggestion?

@alexey-bataev
Copy link
Member

A test?

I don't really know how to test this, as I don't know how to reproduce the problem. Any suggestion?

What is the problem?

@jyu2-git
Copy link
Contributor Author

jyu2-git commented May 2, 2024

A test?

I don't really know how to test this, as I don't know how to reproduce the problem. Any suggestion?

What is the problem?

https://lab.llvm.org/buildbot/#/builders/85/builds/23835

Copy link
Member

@alexey-bataev alexey-bataev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG

@vitalybuka
Copy link
Collaborator

Please include this fix into re-land.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:openmp OpenMP related changes to Clang clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants