@@ -5249,19 +5249,14 @@ class OMPMapClause final : public OMPMappableExprListClause<OMPMapClause>,
52495249 return getUniqueDeclarationsNum () + getTotalComponentListNum ();
52505250 }
52515251
5252- public:
5253- // / Number of allowed map-type-modifiers.
5254- static constexpr unsigned NumberOfModifiers =
5255- OMPC_MAP_MODIFIER_last - OMPC_MAP_MODIFIER_unknown - 1 ;
5256-
52575252private:
52585253 // / Map-type-modifiers for the 'map' clause.
5259- OpenMPMapModifierKind MapTypeModifiers[NumberOfModifiers ] = {
5254+ OpenMPMapModifierKind MapTypeModifiers[NumberOfOMPMapClauseModifiers ] = {
52605255 OMPC_MAP_MODIFIER_unknown, OMPC_MAP_MODIFIER_unknown,
52615256 OMPC_MAP_MODIFIER_unknown};
52625257
52635258 // / Location of map-type-modifiers for the 'map' clause.
5264- SourceLocation MapTypeModifiersLoc[NumberOfModifiers ];
5259+ SourceLocation MapTypeModifiersLoc[NumberOfOMPMapClauseModifiers ];
52655260
52665261 // / Map type for the 'map' clause.
52675262 OpenMPMapClauseKind MapType = OMPC_MAP_unknown;
@@ -5330,7 +5325,7 @@ class OMPMapClause final : public OMPMappableExprListClause<OMPMapClause>,
53305325 // / \param I index for map-type-modifier.
53315326 // / \param T map-type-modifier for the clause.
53325327 void setMapTypeModifier (unsigned I, OpenMPMapModifierKind T) {
5333- assert (I < NumberOfModifiers &&
5328+ assert (I < NumberOfOMPMapClauseModifiers &&
53345329 " Unexpected index to store map type modifier, exceeds array size." );
53355330 MapTypeModifiers[I] = T;
53365331 }
@@ -5340,7 +5335,7 @@ class OMPMapClause final : public OMPMappableExprListClause<OMPMapClause>,
53405335 // / \param I index for map-type-modifier location.
53415336 // / \param TLoc map-type-modifier location.
53425337 void setMapTypeModifierLoc (unsigned I, SourceLocation TLoc) {
5343- assert (I < NumberOfModifiers &&
5338+ assert (I < NumberOfOMPMapClauseModifiers &&
53445339 " Index to store map type modifier location exceeds array size." );
53455340 MapTypeModifiersLoc[I] = TLoc;
53465341 }
@@ -5415,7 +5410,7 @@ class OMPMapClause final : public OMPMappableExprListClause<OMPMapClause>,
54155410 // /
54165411 // / \param Cnt index for map-type-modifier.
54175412 OpenMPMapModifierKind getMapTypeModifier (unsigned Cnt) const LLVM_READONLY {
5418- assert (Cnt < NumberOfModifiers &&
5413+ assert (Cnt < NumberOfOMPMapClauseModifiers &&
54195414 " Requested modifier exceeds the total number of modifiers." );
54205415 return MapTypeModifiers[Cnt];
54215416 }
@@ -5425,7 +5420,7 @@ class OMPMapClause final : public OMPMappableExprListClause<OMPMapClause>,
54255420 // /
54265421 // / \param Cnt index for map-type-modifier location.
54275422 SourceLocation getMapTypeModifierLoc (unsigned Cnt) const LLVM_READONLY {
5428- assert (Cnt < NumberOfModifiers &&
5423+ assert (Cnt < NumberOfOMPMapClauseModifiers &&
54295424 " Requested modifier location exceeds total number of modifiers." );
54305425 return MapTypeModifiersLoc[Cnt];
54315426 }
@@ -7144,6 +7139,19 @@ class OMPClausePrinter final : public OMPClauseVisitor<OMPClausePrinter> {
71447139#include " clang/Basic/OpenMPKinds.def"
71457140};
71467141
7142+ struct OMPTraitProperty {
7143+ llvm::omp::TraitProperty Kind = llvm::omp::TraitProperty::invalid;
7144+ };
7145+ struct OMPTraitSelector {
7146+ Expr *ScoreOrCondition = nullptr ;
7147+ llvm::omp::TraitSelector Kind = llvm::omp::TraitSelector::invalid;
7148+ llvm::SmallVector<OMPTraitProperty, 1 > Properties;
7149+ };
7150+ struct OMPTraitSet {
7151+ llvm::omp::TraitSet Kind = llvm::omp::TraitSet::invalid;
7152+ llvm::SmallVector<OMPTraitSelector, 2 > Selectors;
7153+ };
7154+
71477155// / Helper data structure representing the traits in a match clause of an
71487156// / `declare variant` or `metadirective`. The outer level is an ordered
71497157// / collection of selector sets, each with an associated kind and an ordered
@@ -7158,27 +7166,14 @@ class OMPTraitInfo {
71587166 // / Reconstruct a (partial) OMPTraitInfo object from a mangled name.
71597167 OMPTraitInfo (StringRef MangledName);
71607168
7161- struct OMPTraitProperty {
7162- llvm::omp::TraitProperty Kind = llvm::omp::TraitProperty::invalid;
7163- };
7164- struct OMPTraitSelector {
7165- Expr *ScoreOrCondition = nullptr ;
7166- llvm::omp::TraitSelector Kind = llvm::omp::TraitSelector::invalid;
7167- llvm::SmallVector<OMPTraitProperty, 1 > Properties;
7168- };
7169- struct OMPTraitSet {
7170- llvm::omp::TraitSet Kind = llvm::omp::TraitSet::invalid;
7171- llvm::SmallVector<OMPTraitSelector, 2 > Selectors;
7172- };
7173-
71747169 // / The outermost level of selector sets.
71757170 llvm::SmallVector<OMPTraitSet, 2 > Sets;
71767171
71777172 bool anyScoreOrCondition (
71787173 llvm::function_ref<bool (Expr *&, bool /* IsScore */ )> Cond) {
7179- return llvm::any_of (Sets, [&](OMPTraitInfo:: OMPTraitSet &Set) {
7174+ return llvm::any_of (Sets, [&](OMPTraitSet &Set) {
71807175 return llvm::any_of (
7181- Set.Selectors , [&](OMPTraitInfo:: OMPTraitSelector &Selector) {
7176+ Set.Selectors , [&](OMPTraitSelector &Selector) {
71827177 return Cond (Selector.ScoreOrCondition ,
71837178 /* IsScore */ Selector.Kind !=
71847179 llvm::omp::TraitSelector::user_condition);
0 commit comments