Index: clang/include/clang/Basic/OpenMPKinds.h =================================================================== --- clang/include/clang/Basic/OpenMPKinds.h +++ clang/include/clang/Basic/OpenMPKinds.h @@ -86,20 +86,12 @@ static constexpr unsigned NumberOfOMPMapClauseModifiers = OMPC_MAP_MODIFIER_last - OMPC_MAP_MODIFIER_unknown - 1; -/// OpenMP modifier kind for 'to' clause. -enum OpenMPToModifierKind { -#define OPENMP_TO_MODIFIER_KIND(Name) \ - OMPC_TO_MODIFIER_##Name, +/// OpenMP modifier kind for 'to' or 'from' clause. +enum OpenMPMotionModifierKind { +#define OPENMP_MOTION_MODIFIER_KIND(Name) \ + OMPC_MOTION_MODIFIER_##Name, #include "clang/Basic/OpenMPKinds.def" - OMPC_TO_MODIFIER_unknown -}; - -/// OpenMP modifier kind for 'from' clause. -enum OpenMPFromModifierKind { -#define OPENMP_FROM_MODIFIER_KIND(Name) \ - OMPC_FROM_MODIFIER_##Name, -#include "clang/Basic/OpenMPKinds.def" - OMPC_FROM_MODIFIER_unknown + OMPC_MOTION_MODIFIER_unknown }; /// OpenMP attributes for 'dist_schedule' clause. Index: clang/include/clang/Basic/OpenMPKinds.def =================================================================== --- clang/include/clang/Basic/OpenMPKinds.def +++ clang/include/clang/Basic/OpenMPKinds.def @@ -29,11 +29,8 @@ #ifndef OPENMP_MAP_MODIFIER_KIND #define OPENMP_MAP_MODIFIER_KIND(Name) #endif -#ifndef OPENMP_TO_MODIFIER_KIND -#define OPENMP_TO_MODIFIER_KIND(Name) -#endif -#ifndef OPENMP_FROM_MODIFIER_KIND -#define OPENMP_FROM_MODIFIER_KIND(Name) +#ifndef OPENMP_MOTION_MODIFIER_KIND +#define OPENMP_MOTION_MODIFIER_KIND(Name) #endif #ifndef OPENMP_DIST_SCHEDULE_KIND #define OPENMP_DIST_SCHEDULE_KIND(Name) @@ -126,11 +123,8 @@ OPENMP_MAP_MODIFIER_KIND(mapper) OPENMP_MAP_MODIFIER_KIND(present) -// Modifiers for 'to' clause. -OPENMP_TO_MODIFIER_KIND(mapper) - -// Modifiers for 'from' clause. -OPENMP_FROM_MODIFIER_KIND(mapper) +// Modifiers for 'to' or 'from' clause. +OPENMP_MOTION_MODIFIER_KIND(mapper) // Static attributes for 'dist_schedule' clause. OPENMP_DIST_SCHEDULE_KIND(static) @@ -163,8 +157,7 @@ #undef OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND #undef OPENMP_MAP_KIND #undef OPENMP_MAP_MODIFIER_KIND -#undef OPENMP_TO_MODIFIER_KIND -#undef OPENMP_FROM_MODIFIER_KIND +#undef OPENMP_MOTION_MODIFIER_KIND #undef OPENMP_DIST_SCHEDULE_KIND #undef OPENMP_DEFAULTMAP_KIND #undef OPENMP_DEFAULTMAP_MODIFIER Index: clang/lib/Basic/OpenMPKinds.cpp =================================================================== --- clang/lib/Basic/OpenMPKinds.cpp +++ clang/lib/Basic/OpenMPKinds.cpp @@ -64,17 +64,12 @@ return Type; } case OMPC_to: - return llvm::StringSwitch(Str) -#define OPENMP_TO_MODIFIER_KIND(Name) \ - .Case(#Name, static_cast(OMPC_TO_MODIFIER_##Name)) -#include "clang/Basic/OpenMPKinds.def" - .Default(OMPC_TO_MODIFIER_unknown); case OMPC_from: return llvm::StringSwitch(Str) -#define OPENMP_FROM_MODIFIER_KIND(Name) \ - .Case(#Name, static_cast(OMPC_FROM_MODIFIER_##Name)) +#define OPENMP_MOTION_MODIFIER_KIND(Name) \ + .Case(#Name, static_cast(OMPC_MOTION_MODIFIER_##Name)) #include "clang/Basic/OpenMPKinds.def" - .Default(OMPC_FROM_MODIFIER_unknown); + .Default(OMPC_MOTION_MODIFIER_unknown); case OMPC_dist_schedule: return llvm::StringSwitch(Str) #define OPENMP_DIST_SCHEDULE_KIND(Name) .Case(#Name, OMPC_DIST_SCHEDULE_##Name) @@ -258,29 +253,18 @@ } llvm_unreachable("Invalid OpenMP 'map' clause type"); case OMPC_to: - switch (Type) { - case OMPC_TO_MODIFIER_unknown: - return "unknown"; -#define OPENMP_TO_MODIFIER_KIND(Name) \ - case OMPC_TO_MODIFIER_##Name: \ - return #Name; -#include "clang/Basic/OpenMPKinds.def" - default: - break; - } - llvm_unreachable("Invalid OpenMP 'to' clause type"); case OMPC_from: switch (Type) { - case OMPC_FROM_MODIFIER_unknown: + case OMPC_MOTION_MODIFIER_unknown: return "unknown"; -#define OPENMP_FROM_MODIFIER_KIND(Name) \ - case OMPC_FROM_MODIFIER_##Name: \ +#define OPENMP_MOTION_MODIFIER_KIND(Name) \ + case OMPC_MOTION_MODIFIER_##Name: \ return #Name; #include "clang/Basic/OpenMPKinds.def" default: break; } - llvm_unreachable("Invalid OpenMP 'from' clause type"); + llvm_unreachable("Invalid OpenMP 'to' or 'from' clause type"); case OMPC_dist_schedule: switch (Type) { case OMPC_DIST_SCHEDULE_unknown: Index: clang/lib/Parse/ParseOpenMP.cpp =================================================================== --- clang/lib/Parse/ParseOpenMP.cpp +++ clang/lib/Parse/ParseOpenMP.cpp @@ -3442,21 +3442,10 @@ Data.ColonLoc = ConsumeToken(); } else if (Kind == OMPC_to || Kind == OMPC_from) { if (Tok.is(tok::identifier)) { - bool IsMapperModifier = false; - if (Kind == OMPC_to) { - auto Modifier = - static_cast(getOpenMPSimpleClauseType( - Kind, PP.getSpelling(Tok), getLangOpts().OpenMP)); - if (Modifier == OMPC_TO_MODIFIER_mapper) - IsMapperModifier = true; - } else { - auto Modifier = - static_cast(getOpenMPSimpleClauseType( - Kind, PP.getSpelling(Tok), getLangOpts().OpenMP)); - if (Modifier == OMPC_FROM_MODIFIER_mapper) - IsMapperModifier = true; - } - if (IsMapperModifier) { + auto Modifier = + static_cast(getOpenMPSimpleClauseType( + Kind, PP.getSpelling(Tok), getLangOpts().OpenMP)); + if (Modifier == OMPC_MOTION_MODIFIER_mapper) { // Parse the mapper modifier. ConsumeToken(); IsInvalidMapperModifier = parseMapperModifier(Data);